Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Main/Include/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class commandsystem
static truth AssignName(character*);
static truth Search(character*);
static truth Consume(character*, cchar*, cchar*, sorter, truth = false);
static truth Mode3(character*);
static truth ShowWorldSeed(character*);
#ifdef WIZARD
static truth WizardMode(character*);
Expand Down
8 changes: 8 additions & 0 deletions Main/Include/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "femath.h"
#include "festring.h"
#include "ivandef.h"
#include "iconf.h"

#ifndef LIGHT_BORDER
#define LIGHT_BORDER 80
Expand Down Expand Up @@ -288,6 +289,8 @@ class game
static v2 CalculateScreenCoordinates(v2);
static truth PosCurrentlyOnScreen(v2);
static v2 ScreenCoordinatesToPos(v2);
static int AdjustForFacing(int d);
static int UnadjustForFacing(int d);
static void BusyAnimation();
static void BusyAnimation(bitmap*, truth);
static v2 PositionQuestion(cfestring&, v2, positionhandler = 0, positionkeyhandler = 0, truth = true);
Expand Down Expand Up @@ -395,6 +398,9 @@ class game
static lsquare* GetHighlightedMapNoteLSquare();
static bool ToggleShowMapNotes();
static bool CheckAddAutoMapNote(square* =NULL);
static void SetFacing(int x) { Mode3Facing = x; }
static int GetFacing();
static const v2 GetFacingVector(int I) { return FacingVector[I]; }
static int CheckAutoPickup(square* sqr = NULL);
static void UpdateAutoPickUpMatching();
static int RotateMapNotes();
Expand Down Expand Up @@ -572,6 +578,8 @@ class game
static int FreedomStoryState;
static int AslonaStoryState;
static int RebelStoryState;
static int Mode3Facing;
static const v2 FacingVector[];
static truth InGetCommand;
static truth PlayerHurtByExplosion;
static area* CurrentArea;
Expand Down
15 changes: 15 additions & 0 deletions Main/Include/iconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ class ivanconfig
static truth GetSmartOpenCloseApply() { return SmartOpenCloseApply.Value; }
static truth IsSetupCustomKeys() { return SetupCustomKeys.Value; }
static truth GetBeNice() { return BeNice.Value; }
static truth GetMode3() { return Mode3.Value; }
static void SwitchMode3() { Mode3.Value = !Mode3.Value; }
static truth GetIsoMode() { return IsoMode.Value; }
static truth GetShowAllInIso() { return ShowAllInIso.Value; }
static truth GetAnaglyph() { return Anaglyph.Value; }
static truth GetShowMiniMap() { return ShowMiniMap.Value; }

static truth Mode3Iso() { return Mode3.Value && IsoMode.Value; }
static truth Mode3FPP() { return Mode3.Value && !IsoMode.Value; }

static int GetAltListItemPos() { return AltListItemPos.Value; }
static truth GetPlaySounds() { return PlaySounds.Value; }
static truth IsShowTurn() { return ShowTurn.Value; }
Expand Down Expand Up @@ -274,6 +284,11 @@ class ivanconfig
#endif

static col24 ContrastLuminance;
static truthoption Mode3;
static truthoption IsoMode;
static truthoption ShowAllInIso;
static numberoption Anaglyph;
static truthoption ShowMiniMap;
static truthoption PlaySounds;
static truthoption ShowTurn;

Expand Down
20 changes: 20 additions & 0 deletions Main/Include/igraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class rawbitmap;
class outputfile;
class inputfile;
class festring;
struct blitdata;

/* memcmp doesn't like alignment of structure members */

Expand Down Expand Up @@ -121,6 +122,13 @@ class igraph
static void BlitBackGround(bitmap* bmpAt, v2 Pos, v2 Border);
static void CreateBackGround(int);
static bitmap* GenerateScarBitmap(int, int, int);

/* IVAN3D additions */
static int defx, defy;
static truth noCeiling;
static void fDrawRainPixel(v2 x, col16 c);
static void Blit3(const bitmap *b, blitdata &B, int mode);

static cbitmap* GetSmileyGraphic() { return Graphic[GR_SMILEY]; }
static void AddOutlinesIfNeeded();
private:
Expand Down Expand Up @@ -148,4 +156,16 @@ class igraph
static int CurrentColorType;
};

#define MF_BLIT_FLAGS 15

#define MF_BLIT_LUMINANCE 1
#define MF_BLIT_PRIORITY 2
#define MF_BLIT_ALPHA 4
#define MF_BLIT_MASKED 8

#define MF_BLIT_ALPHA_PRIORITY MF_BLIT_ALPHA | MF_BLIT_PRIORITY
#define MF_BLIT_ALPHA_LUMINANCE MF_BLIT_ALPHA | MF_BLIT_LUMINANCE
#define MF_BLIT_LUMINANCE_MASKED MF_BLIT_LUMINANCE | MF_BLIT_MASKED
#define MF_BLIT_MASKED_PRIORITY MF_BLIT_MASKED | MF_BLIT_PRIORITY

#endif
13 changes: 13 additions & 0 deletions Main/Include/ivandef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,18 @@ cv2 SILHOUETTE_SIZE(48, 64); // it is TILE_SIZE*3,TILE_SIZE*4 tho..
#define FORCE_THE 8
#define SHOW_MATERIAL 16 // only works for terrains

/* IVAN3D Spatial Flags */
#define MF_OBJECT 256
#define MF_FLOOR 512
#define MF_CEIL 1024
#define MF_WALL 2048
#define MF_ONFLOOR 4096
#define MF_LOWWALL 8192
#define MF_TABLE 16384
#define MF_WINDOW 128
#define MF_LARGE 64
#define MF_STAIR 32

/****************************/
/* Character DataBase flags */
/****************************/
Expand Down Expand Up @@ -1185,6 +1197,7 @@ cv2 TILE_V2(TILE_SIZE, TILE_SIZE);
#define SQUARE_INDEX_MASK 0xFFFF
#define ALLOW_ANIMATE 0x10000
#define ALLOW_ALPHA 0x20000
#define DO_BLIT3 0x40000

#define TALENTS 5

Expand Down
2 changes: 2 additions & 0 deletions Main/Include/level.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class material;
class team;
struct node;
struct emitter;
struct blitdata;
template <class type> struct fearray;

struct nodepointerstorer
Expand Down Expand Up @@ -197,6 +198,7 @@ class level : public area
void Explosion(character*, cfestring&, v2, int, truth = true, truth = false);
truth CollectCreatures(charactervector&, character*, truth);
void ApplyLSquareScript(const squarescript*);
virtual void Draw3(int x, int y, truth esp, blitdata &BlitData) const;
void DrawHitEffects(cint XMin,cint XMax,cint YMin,cint YMax) const;
virtual void Draw(truth) const;
v2 GetEntryPos(ccharacter*, int) const;
Expand Down
3 changes: 3 additions & 0 deletions Main/Include/lterra.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct lterraindatabase : public databasebase
fearray<long> MaterialConfigChances;
long MaterialConfigChanceSum;
int OKVisualEffects;
int SpatialFlags;
col16 MaterialColorB;
col16 MaterialColorC;
col16 MaterialColorD;
Expand Down Expand Up @@ -175,6 +176,7 @@ class glterrain : public lterrain, public gterrain
virtual DATA_BASE_VALUE(const fearray<long>&, MaterialConfigChances);
virtual DATA_BASE_VALUE(long, MaterialConfigChanceSum);
DATA_BASE_VALUE(int, OKVisualEffects);
DATA_BASE_VALUE(int, SpatialFlags);
virtual DATA_BASE_VALUE_WITH_PARAMETER(col16, MaterialColorB, int);
virtual DATA_BASE_VALUE_WITH_PARAMETER(col16, MaterialColorC, int);
virtual DATA_BASE_VALUE_WITH_PARAMETER(col16, MaterialColorD, int);
Expand Down Expand Up @@ -288,6 +290,7 @@ class olterrain : public lterrain, public oterrain
virtual DATA_BASE_VALUE(const fearray<long>&, MaterialConfigChances);
virtual DATA_BASE_VALUE(long, MaterialConfigChanceSum);
DATA_BASE_VALUE(int, OKVisualEffects);
DATA_BASE_VALUE(int, SpatialFlags);
virtual DATA_BASE_VALUE_WITH_PARAMETER(col16, MaterialColorB, int);
virtual DATA_BASE_VALUE_WITH_PARAMETER(col16, MaterialColorC, int);
virtual DATA_BASE_VALUE_WITH_PARAMETER(col16, MaterialColorD, int);
Expand Down
10 changes: 5 additions & 5 deletions Main/Source/bodypart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2549,9 +2549,9 @@ void bodypart::Draw(blitdata& BlitData) const
cbitmap* P = GraphicData.Picture[F];

if(BlitData.CustomData & ALLOW_ALPHA)
P->AlphaPriorityBlit(BlitData);
igraph::Blit3(P, BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);
else
P->MaskedPriorityBlit(BlitData);
igraph::Blit3(P, BlitData, MF_BLIT_MASKED_PRIORITY | MF_OBJECT);

if(Fluid && ShowFluids())
DrawFluids(BlitData);
Expand Down Expand Up @@ -3014,7 +3014,7 @@ void bodypart::DrawEquipment(const graphicdata& GraphicData, blitdata& BlitData)
if(EAF)
{
int F = !(BlitData.CustomData & ALLOW_ANIMATE) || EAF == 1 ? 0 : GET_TICK() & (EAF - 1);
GraphicData.Picture[F]->AlphaPriorityBlit(BlitData);
igraph::Blit3(GraphicData.Picture[F], BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);
}
}

Expand Down Expand Up @@ -3424,9 +3424,9 @@ void dogtorso::Draw(blitdata& BlitData) const
cbitmap* P = GraphicData.Picture[Index];

if(BlitData.CustomData & ALLOW_ALPHA)
P->AlphaPriorityBlit(BlitData);
igraph::Blit3(P, BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);
else
P->MaskedPriorityBlit(BlitData);
igraph::Blit3(P, BlitData, MF_BLIT_MASKED_PRIORITY | MF_OBJECT);
}

void corpse::SetLifeExpectancy(int Base, int RandPlus)
Expand Down
43 changes: 36 additions & 7 deletions Main/Source/char.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3674,11 +3674,38 @@

int c;
for(c = 0; c < DIRECTION_COMMAND_KEYS; ++c)
if(Key == game::GetMoveCommandKey(c))
MoveByVector(game::GetMoveVector(c));
if(Key == game::GetMoveCommandKey(c)){

if(ivanconfig::Mode3FPP() && !game::IsInWilderness())
{
if(c == 3){
game::SetFacing(game::AdjustForFacing(0));
ValidKeyPressed = true;
}
if(c == 4){
game::SetFacing(game::AdjustForFacing(2));
ValidKeyPressed = true;
}
}

if(!ValidKeyPressed){
int d = game::AdjustForFacing(c);
if(!ivanconfig::Mode3FPP()) game::SetFacing(d);
MoveByVector(game::GetMoveVector(d));
}
}

if(Key >= KEY_CONTROLLER_DIRECTION + 1 && Key <= KEY_CONTROLLER_DIRECTION + 9)
MoveByVector(game::GetDirectionVectorForKey(Key));
{
if(ivanconfig::GetMode3())
{
auto v = game::GetDirectionVectorForKey(Key);
for(int c = 0; c < DIRECTION_COMMAND_KEYS; ++c)
if(game::GetMoveVector(c) == v)
MoveByVector(game::GetMoveVector(game::AdjustForFacing(c)));
}
else MoveByVector(game::GetDirectionVectorForKey(Key));
}

if(ValidKeyPressed) return;

Expand Down Expand Up @@ -7425,30 +7452,32 @@
BlitData.Src.Y = 16;
cint SquareIndex = BlitData.CustomData & SQUARE_INDEX_MASK;

const bitmap *b = (bitmap*) igraph::GetSymbolGraphic();

if(GetTeam() == PLAYER->GetTeam() && !IsPlayer()
&& SquareIndex == GetTameSymbolSquareIndex())
{
BlitData.Src.X = 32;
igraph::GetSymbolGraphic()->LuminanceMaskedBlit(BlitData);
igraph::Blit3(b, BlitData, MF_BLIT_LUMINANCE_MASKED | MF_OBJECT);
}

if(IsFlying() && SquareIndex == GetFlySymbolSquareIndex())
{
BlitData.Src.X = 128;
igraph::GetSymbolGraphic()->LuminanceMaskedBlit(BlitData);
igraph::Blit3(b, BlitData, MF_BLIT_LUMINANCE_MASKED | MF_OBJECT);
}

if(IsSwimming() && SquareIndex == GetSwimmingSymbolSquareIndex())
{
BlitData.Src.X = 240;
igraph::GetSymbolGraphic()->LuminanceMaskedBlit(BlitData);
igraph::Blit3(b, BlitData, MF_BLIT_LUMINANCE_MASKED | MF_OBJECT);
}

if(GetAction() && GetAction()->IsUnconsciousness()
&& SquareIndex == GetUnconsciousSymbolSquareIndex())
{
BlitData.Src.X = 224;
igraph::GetSymbolGraphic()->LuminanceMaskedBlit(BlitData);
igraph::Blit3(b, BlitData, MF_BLIT_LUMINANCE_MASKED | MF_OBJECT);
}

BlitData.Src.X = BlitData.Src.Y = 0;
Expand Down
12 changes: 12 additions & 0 deletions Main/Source/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ command* commandsystem::Command[] =
new command(&Apply, "apply item", 'a', 'a', 'a', false),
new command(&ApplyAgain, "apply last item again", 'A', 'A', 'A', false),
new command(&Zap, "zap a wand", 'z', 'z', 'z', false),
new command(&Mode3, "switch 3D mode", 'Z', 'Z', 'Z', true),
new command(&Read, "read", 'r', 'r', 'r', false),
new command(&Eat, "eat", 'e', 'e', 'e', true),
new command(&Drink, "drink liquid", 'D', 'D', 'D', true),
Expand Down Expand Up @@ -1723,6 +1724,17 @@ truth commandsystem::ZapItem(character* Char, item* Item)
}
}

truth commandsystem::Mode3(character*)
{
ivanconfig::SwitchMode3();
if(ivanconfig::GetMode3())
ADD_MESSAGE("3D mode activated.");
else
ADD_MESSAGE("Map mode activated.");
game::GetCurrentArea()->SendNewDrawRequest();
return false;
}

truth commandsystem::Rest(character* Char)
{
if(Char->StateIsActivated(PANIC))
Expand Down
1 change: 1 addition & 0 deletions Main/Source/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ void databasecreator<type>::CreateLTerrainDataBaseMemberMap()
ADD_MEMBER(MaterialConfigChances);
ADD_MEMBER(IsAbstract);
ADD_MEMBER(OKVisualEffects);
ADD_MEMBER(SpatialFlags);
ADD_MEMBER(MaterialColorB);
ADD_MEMBER(MaterialColorC);
ADD_MEMBER(MaterialColorD);
Expand Down
12 changes: 6 additions & 6 deletions Main/Source/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void fluid::Load(inputfile& SaveFile)

void fluid::SimpleDraw(blitdata& BlitData) const
{
Image.Picture->AlphaLuminanceBlit(BlitData);
igraph::Blit3(Image.Picture, BlitData, MF_BLIT_ALPHA_LUMINANCE | MF_FLOOR);
}

void fluid::Draw(blitdata& BlitData) const
Expand All @@ -198,10 +198,10 @@ void fluid::Draw(blitdata& BlitData) const
{
/* Priority Bug!!! */
Picture->BlitAndCopyAlpha(igraph::GetFlagBuffer(), SpecialFlags);
igraph::GetFlagBuffer()->AlphaLuminanceBlit(BlitData);
igraph::Blit3(igraph::GetFlagBuffer(), BlitData, MF_BLIT_ALPHA_LUMINANCE | MF_OBJECT);
}
else
Picture->AlphaPriorityBlit(BlitData);
igraph::Blit3(Picture, BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);

if(MotherItem && BlitData.CustomData & ALLOW_ANIMATE)
Image.Animate(BlitData, SpecialFlags);
Expand Down Expand Up @@ -425,10 +425,10 @@ void fluid::DrawGearPicture(blitdata& BlitData, int SpecialFlags) const
if(SpecialFlags & 0x7)
{
Picture->BlitAndCopyAlpha(igraph::GetFlagBuffer(), SpecialFlags);
igraph::GetFlagBuffer()->AlphaPriorityBlit(BlitData);
igraph::Blit3(igraph::GetFlagBuffer(), BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);
}
else
GearImage->Picture->AlphaPriorityBlit(BlitData);
igraph::Blit3(GearImage->Picture, BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);

if(BlitData.CustomData & ALLOW_ANIMATE)
GearImage->Animate(BlitData, SpecialFlags);
Expand All @@ -446,7 +446,7 @@ void fluid::DrawBodyArmorPicture(blitdata& BlitData, int SpecialFlags) const
if(Index >= BODY_ARMOR_PARTS)
Index = 0;

GearImage[Index].Picture->AlphaPriorityBlit(BlitData);
igraph::Blit3(GearImage[Index].Picture, BlitData, MF_BLIT_ALPHA_PRIORITY | MF_OBJECT);

if(BlitData.CustomData & ALLOW_ANIMATE)
GearImage[Index].Animate(BlitData, 0);
Expand Down
Loading
Loading