Skip to content

Commit

Permalink
fix regression in DrawLara
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Feb 21, 2021
1 parent f4f990e commit 94a8957
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
18 changes: 10 additions & 8 deletions src/game/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,10 @@ void __cdecl DrawLara(ITEM_INFO* item)
int16_t* frmptr[2];
PHD_MATRIX saved_matrix;

int top = PhdTop;
int left = PhdLeft;
int bottom = PhdBottom;
int right = PhdRight;
int32_t top = PhdTop;
int32_t left = PhdLeft;
int32_t bottom = PhdBottom;
int32_t right = PhdRight;
PhdBottom = PhdWinMaxY;
PhdTop = 0;
PhdLeft = 0;
Expand All @@ -495,6 +495,7 @@ void __cdecl DrawLara(ITEM_INFO* item)
object = &Objects[item->object_number];
if (Lara.hit_direction >= 0) {
switch (Lara.hit_direction) {
default:
case DIR_NORTH:
frame = Anims[AA_SPAZ_FORWARD].frame_ptr;
break;
Expand Down Expand Up @@ -583,7 +584,7 @@ void __cdecl DrawLara(ITEM_INFO* item)

phd_PopMatrix();

int fire_arms = 0;
int32_t fire_arms = 0;
if (Lara.gun_status == LGS_READY || Lara.gun_status == LGS_DRAW
|| Lara.gun_status == LGS_UNDRAW) {
fire_arms = Lara.gun_type;
Expand Down Expand Up @@ -830,7 +831,8 @@ void __cdecl CalculateObjectLighting(ITEM_INFO* item, int16_t* frame)
}

void __cdecl DrawLaraInt(
ITEM_INFO* item, int16_t* frame1, int16_t* frame2, int frac, int rate)
ITEM_INFO* item, int16_t* frame1, int16_t* frame2, int32_t frac,
int32_t rate)
{
PHD_MATRIX saved_matrix;

Expand Down Expand Up @@ -913,7 +915,7 @@ void __cdecl DrawLaraInt(

phd_PopMatrix_I();

int fire_arms = 0;
int32_t fire_arms = 0;
if (Lara.gun_status == LGS_READY || Lara.gun_status == LGS_DRAW
|| Lara.gun_status == LGS_UNDRAW) {
fire_arms = Lara.gun_type;
Expand Down Expand Up @@ -1185,7 +1187,7 @@ void __cdecl phd_RotYXZpack_I(int32_t r1, int32_t r2)
PhdMatrixPtr = old_matrix;
}

void __cdecl phd_PutPolygons_I(int16_t* ptr, int clip)
void __cdecl phd_PutPolygons_I(int16_t* ptr, int32_t clip)
{
phd_PushMatrix();
InterpolateMatrix();
Expand Down
5 changes: 3 additions & 2 deletions src/game/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ void __cdecl DrawLara(ITEM_INFO* item);
void __cdecl DrawGunFlash(int32_t weapon_type, int32_t clip);
void __cdecl CalculateObjectLighting(ITEM_INFO* item, int16_t* frame);
void __cdecl DrawLaraInt(
ITEM_INFO* item, int16_t* frame1, int16_t* frame2, int frac, int rate);
ITEM_INFO* item, int16_t* frame1, int16_t* frame2, int32_t frac,
int32_t rate);
void __cdecl InitInterpolate(int32_t frac, int32_t rate);

void __cdecl phd_PushMatrix_I();
Expand All @@ -36,7 +37,7 @@ void __cdecl phd_RotX_I(int16_t ang);
void __cdecl phd_RotZ_I(int16_t ang);
void __cdecl phd_RotYXZ_I(int16_t y, int16_t x, int16_t z);
void __cdecl phd_RotYXZpack_I(int32_t r1, int32_t r2);
void __cdecl phd_PutPolygons_I(int16_t* ptr, int clip);
void __cdecl phd_PutPolygons_I(int16_t* ptr, int32_t clip);

void __cdecl InterpolateMatrix();
void __cdecl InterpolateArmMatrix();
Expand Down
2 changes: 1 addition & 1 deletion src/game/lara.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "util.h"

// clang-format off
#define UpdateLaraRoom ((void __cdecl(*)(ITEM_INFO* item, int height))0x004126A0)
#define UpdateLaraRoom ((void __cdecl(*)(ITEM_INFO* item, int32_t height))0x004126A0)
#define ShiftItem ((void __cdecl(*)(ITEM_INFO* item, COLL_INFO *coll))0x00412660)
#define InitialiseEvilLara ((void __cdecl(*)(int16_t item_num))0x00428420)
#define ControlEvilLara ((void __cdecl(*)(int16_t item_num))0x00428450)
Expand Down

0 comments on commit 94a8957

Please sign in to comment.