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
2 changes: 1 addition & 1 deletion FeLib/Source/hscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void highscore::Draw() const
}

List.SetFlags(FADE);
List.SetPageLength(40);
List.SetPageLength(20);
List.Draw();
}

Expand Down
6 changes: 3 additions & 3 deletions Main/Source/char.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3700,7 +3700,7 @@ void character::PerformPlayerCommand(int Key, bool& HasActed, bool& ValidKeyPres
if(ivanconfig::GetMode3())
{
auto v = game::GetDirectionVectorForKey(Key);
for(int c = 0; c < DIRECTION_COMMAND_KEYS; ++c)
for(c = 0; c < DIRECTION_COMMAND_KEYS; ++c)
if(game::GetMoveVector(c) == v)
MoveByVector(game::GetMoveVector(game::AdjustForFacing(c)));
}
Expand Down Expand Up @@ -9502,8 +9502,8 @@ void character::ShowAdventureInfoAlt() const
game::GetCurrentArea()->SendNewDrawRequest();
game::DrawEverything();
while(true) {
felist List(CONST_S("What do you want to see?"));
List.AddEntry("n = nothing", LIGHT_GRAY, 0, NO_IMAGE, true);
felist List(CONST_S("Unfortunately you died. What do you want to see?"));
List.AddEntry("n = nothing (end the game)", LIGHT_GRAY, 0, NO_IMAGE, true);
List.AddEntry("i = inventory", LIGHT_GRAY, 0, NO_IMAGE, true);
List.AddEntry("m = message history", LIGHT_GRAY, 0, NO_IMAGE, true);
List.AddEntry("k = kill list", LIGHT_GRAY, 0, NO_IMAGE, true);
Expand Down
3 changes: 3 additions & 0 deletions Main/Source/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,9 @@ truth commandsystem::SpawnRoute(character* Char, v2 Pos)
std::set<v2> Illegal;

node* Node = Char->GetLevel()->FindRoute(Char->GetPos(), Pos, Illegal, 0, Char);

if(!Node) return false;

if(Node){
RouteGoOn.clear();
while(Node->Last)
Expand Down
13 changes: 10 additions & 3 deletions Main/Source/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,20 @@ void fluid::imagedata::Animate(blitdata& BlitData, int CurrentFlags) const
Rotate(TrueDripPos, 16, CurrentFlags);
TrueDripPos.Y -= DripTimer;

if(TrueDripPos.Y < 16)
BlitData.Bitmap->AlphaPutPixel(TrueDripPos + BlitData.Dest, DripColor, BlitData.Luminance, DripAlpha);
if(TrueDripPos.Y < 16) {
if(BlitData.CustomData & DO_BLIT3)
igraph::fDrawRainPixel(TrueDripPos, DripColor);
else
BlitData.Bitmap->AlphaPutPixel(TrueDripPos + BlitData.Dest, DripColor, BlitData.Luminance, DripAlpha);
}

if(TrueDripPos.Y < 15)
{
++TrueDripPos.Y;
BlitData.Bitmap->AlphaPutPixel(TrueDripPos + BlitData.Dest, DripColor, BlitData.Luminance, DripAlpha);
if(BlitData.CustomData & DO_BLIT3)
igraph::fDrawRainPixel(TrueDripPos, DripColor);
else
BlitData.Bitmap->AlphaPutPixel(TrueDripPos + BlitData.Dest, DripColor, BlitData.Luminance, DripAlpha);
}
else
DripTimer = Min<long>(RAND() % (500000 / AlphaSum), 25000);
Expand Down
6 changes: 4 additions & 2 deletions Main/Source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3040,10 +3040,11 @@ void game::DrawEverythingNoBlit(truth AnimationDraw)
if(globalwindowhandler::ControllerEnabled())
{
auto Pos1 = Pos + globalwindowhandler::GetControllerDirection();
if(OnScreen(Pos1))
if(OnScreen(Pos1) && GetCurrentArea()->GetSquare(Pos1))
{
v2 ScreenCoord1 = CalculateScreenCoordinates(Pos1);
igraph::DrawCursor(ScreenCoord1, Player->GetCursorData());
GetCurrentArea()->GetSquare(Pos1)->SendStrongNewDrawRequest();
if(!DoZoom())UpdatePosAroundForXBRZ(Pos1);
}
}
Expand All @@ -3064,10 +3065,11 @@ void game::DrawEverythingNoBlit(truth AnimationDraw)
if(globalwindowhandler::ControllerEnabled())
{
auto Pos1 = Pos + globalwindowhandler::GetControllerDirection();
if(OnScreen(Pos1))
if(OnScreen(Pos1) && GetCurrentArea()->GetSquare(Pos1))
{
v2 ScreenCoord1 = CalculateScreenCoordinates(Pos1);
igraph::DrawCursor(ScreenCoord1, Player->GetCursorData()|CURSOR_BIG);
GetCurrentArea()->GetSquare(Pos1)->SendStrongNewDrawRequest();
if(!DoZoom())UpdatePosAroundForXBRZ(Pos1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Main/Source/iconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ truthoption ivanconfig::LookZoom( "LookZoom",
truthoption ivanconfig::AltAdentureInfo( "AltAdentureInfo",
"Enhanced message review mode after death",
"",
false);
true);
truthoption ivanconfig::DescriptiveHP( "DescriptiveHP",
"Use health level descriptions",
"Display description of your relative health rather than numeric value of your hit points.",
Expand Down
46 changes: 24 additions & 22 deletions Main/Source/igraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,9 @@ static inline float cross(fpoint a, fpoint b, int x, int y) {

#include "char.h"

int currEye, cc, currAY;
/* currEye is 0 for non-anaglyph mode, 1 for left (red), 2 for right (cyan) */

int currEyePosition, currEye, currAY;

fpoint::fpoint(fpoint4 i) {

Expand All @@ -808,11 +810,11 @@ fpoint::fpoint(fpoint4 i) {
if(y <= 0) {ok = false; return;}
x = i.x - i.y;
x = igraph::defx * (16+x);
if(cc == 1) x -= 2;
if(cc == 2) x += 2;
if(currEye == 1) x -= 2;
if(currEye == 2) x += 2;
x = sx*8 + sy*2*x/y;
y = sy*8 + sy*32/y;
x += sx * currEye / 10.0;
x += sx * currEyePosition / 10.0;
ok = true;
return;
}
Expand All @@ -832,8 +834,8 @@ fpoint::fpoint(fpoint4 i) {
x = tx * C - ty * S + i.ax;
y = tx * S + ty * C + currAY;

if(cc == 1) x += 2;
if(cc == 2) x -= 2;
if(currEye == 1) x += 2;
if(currEye == 2) x -= 2;

ok = y < -1e-6;
if(!ok) return;
Expand All @@ -847,16 +849,16 @@ fpoint::fpoint(fpoint4 i) {
eyelevel = i.z - eyelevel;

if(PLAYER -> TemporaryStateIsActivated(CONFUSED)) {
float angle = GET_TICK() * M_PI / 64;
float spin_angle = GET_TICK() * M_PI / 64;
tx = x; ty = eyelevel;
S = -sin(angle);
C = cos(angle);
S = -sin(spin_angle);
C = cos(spin_angle);
x = C * tx + S * ty;
eyelevel = -S * tx + C * ty;
}

x = sx * 8 - sy * 8 * x / y - 0.5;
x += sx * currEye / 10.0;
x += sx * currEyePosition / 10.0;
y = sy * 8 + sy * 8 * eyelevel / y - 0.5;
}
else {
Expand All @@ -873,12 +875,12 @@ static inline col16 apply(col16 SrcCol, col16 DestCol, alpha Alpha) {
int Green = (SrcCol & 0x7E0 ) + NewGreenLuminance;
int Blue = (SrcCol & 0x1F ) + NewBlueLuminance;

if(cc == 2)
if(currEye == 2)
{
Green += (Red >> 14) << 5;
Blue += (Red >> 15);
}
if(cc == 1)
if(currEye == 1)
Red += ((Green >> 10) + (Blue >> 5)) << 11;

if(Red >= 0) {if(Red > 0xF800) Red = 0xF800;} else Red = 0;
Expand All @@ -889,11 +891,11 @@ static inline col16 apply(col16 SrcCol, col16 DestCol, alpha Alpha) {
int DestGreen = (DestCol & 0x7E0);
int DestBlue = (DestCol & 0x1F);

if(cc != 2)
if(currEye != 2)
Red = (((Red - DestRed) * Alpha >> 8) + DestRed) & 0xF800;
else
Red = DestRed;
if(cc != 1)
if(currEye != 1)
{
Green = (((Green - DestGreen) * Alpha >> 8) + DestGreen) & 0x7E0;
Blue = ((Blue - DestBlue) * Alpha >> 8) + DestBlue;
Expand Down Expand Up @@ -963,13 +965,13 @@ void fDrawRect(fpoint a, fpoint b, fpoint c, fpoint d, col16 SrcCol, alpha Alpha
void tileRect(const bitmap *b, blitdata &B, int mode,
fpoint4 corner, fpoint4 dx, fpoint4 dy, bool mirror, int non) {

if(ivanconfig::GetAnaglyph() && (currEye == 0))
if(ivanconfig::GetAnaglyph() && (currEyePosition == 0))
{
currEye = ivanconfig::GetAnaglyph(); cc = 1;
currEyePosition = ivanconfig::GetAnaglyph(); currEye = 1;
tileRect(b,B,mode,corner,dx,dy,mirror,non);
currEye = -ivanconfig::GetAnaglyph(); cc = 2;
currEyePosition = -ivanconfig::GetAnaglyph(); currEye = 2;
tileRect(b,B,mode,corner,dx,dy,mirror,non);
currEye = 0; cc = 0;
currEyePosition = 0; currEye = 0;
return;
}
if(igraph::defy != -1) {
Expand All @@ -994,9 +996,9 @@ void tileRect(const bitmap *b, blitdata &B, int mode,
if((!pt[0][0].ok) && (!pt[0][16].ok) && (!pt[16][0].ok) && (!pt[16][16].ok))
return;
if(pt[0][0].ok && pt[0][16].ok && pt[16][0].ok && pt[16][16].ok) {
fpoint p[4];
p[0] = pt[0][0]; p[1] = pt[0][16]; p[2] = pt[16][0]; p[3] = pt[16][16];
boundbox bb(p);
fpoint p1[4];
p1[0] = pt[0][0]; p1[1] = pt[0][16]; p1[2] = pt[16][0]; p1[3] = pt[16][16];
boundbox bb(p1);
for(int x=bb.xmin; x<=bb.xmax; x++) for(int y=bb.ymin; y<=bb.ymax; y++) {
int px, py;
if(mirror) {
Expand Down Expand Up @@ -1222,7 +1224,7 @@ void igraph::Blit3(const bitmap *b, blitdata &B, int mode) {
return;
}

currEye = 0;
currEyePosition = 0;

if(mode & MF_FLOOR) tileFloor (b, B, mode);
if(mode & MF_CEIL) tileCeil (b, B, mode);
Expand Down
57 changes: 44 additions & 13 deletions Main/Source/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,29 @@ void level::Explosion(character* Terrorist, cfestring& DeathMsg, v2 Pos, int Str
}
}

struct explosioncontroller
{
static truth Handler(int x, int y)
{
lsquare* Square = Map[x][y];
Square->GetHitByExplosion(CurrentExplosion);
return Square->IsFlyable();
}
static lsquare*** Map;
static const explosion* CurrentExplosion;
};

truth level::DrawExplosion(const explosion* Explosion) const
{

if(ivanconfig::Mode3FPP() || ivanconfig::Mode3Iso()) {
printf("DrawExplosion called, redirecting to the 3D mode\n");
explosioncontroller::CurrentExplosion = Explosion;
game::DrawEverything();
explosioncontroller::CurrentExplosion = nullptr;
return true;
}

static v2 StrengthPicPos[7] =
{ v2(176, 176), v2(0, 144), v2(256, 32), v2(144, 32), v2(64, 32), v2(16, 32), v2(0, 32) };
v2 BPos = game::CalculateScreenCoordinates(Explosion->Pos) - v2((6 - Explosion->Size) << 4,
Expand Down Expand Up @@ -1157,20 +1178,8 @@ truth level::DrawExplosion(const explosion* Explosion) const
return true;
}

struct explosioncontroller
{
static truth Handler(int x, int y)
{
lsquare* Square = Map[x][y];
Square->GetHitByExplosion(CurrentExplosion);
return Square->IsFlyable();
}
static lsquare*** Map;
static explosion* CurrentExplosion;
};

lsquare*** explosioncontroller::Map;
explosion* explosioncontroller::CurrentExplosion;
const explosion* explosioncontroller::CurrentExplosion;

int level::TriggerExplosions(int MinIndex)
{
Expand Down Expand Up @@ -1238,6 +1247,8 @@ int level::TriggerExplosions(int MinIndex)

if(GetLSquare(Explosion->Pos)->IsFlyable())
GetLSquare(Explosion->Pos)->AddSmoke(gas::Spawn(SMOKE, 1000));

explosioncontroller::CurrentExplosion = nullptr;
}

for(c = MinIndex; c < LastExplosion; ++c)
Expand Down Expand Up @@ -1368,6 +1379,26 @@ void level::Draw3(int x, int y, truth esp, blitdata& BlitData) const {
Square->DrawMemorizedCharacter(BlitData);
}
}

auto Exp = explosioncontroller::CurrentExplosion;
if(Exp && (Exp->Pos - v2(x, y)).GetLengthSquare() <= (6 - Exp->Size) * (6 - Exp->Size))
{
v2 PicPos(0, 32);
v2 SizeVect(16, 16);

blitdata BlitDataEx = { 0,
{ PicPos.X, PicPos.Y },
{ 0, 0 },
{ SizeVect.X, SizeVect.Y },
{ 0 },
TRANSPARENT_COLOR,
0 };

BlitDataEx.Bitmap = DOUBLE_BUFFER;
BlitDataEx.Luminance = ivanconfig::GetContrastLuminance();
BlitDataEx.CustomData = DO_BLIT3;
igraph::Blit3(igraph::GetSymbolGraphic(), BlitDataEx, MF_BLIT_LUMINANCE_MASKED | MF_OBJECT);
}
}

void level::Draw(truth AnimationDraw) const
Expand Down
3 changes: 3 additions & 0 deletions Main/Source/lsquare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,9 @@ void lsquare::AddItem(item* Item)

v2 lsquare::DrawLightning(v2 StartPos, long Color, int Direction, truth DrawHere)
{
/* not yet implemented in 3D */
if(ivanconfig::Mode3FPP() || ivanconfig::Mode3Iso()) return StartPos;

if(!game::PosCurrentlyOnScreen(GetPos()) || !CanBeSeenByPlayer(true))
switch(Direction)
{
Expand Down
Loading