Skip to content

Commit

Permalink
#368 fix DOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed Aug 2, 2021
1 parent a444872 commit 7e70292
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/platform/gba/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct Camera
// TODO clip walls?
}

Location getBestLocation(Item* item, bool clip)
Location getBestLocation(bool clip)
{
int32 distH = targetDist * phd_cos(targetAngleX) >> FIXED_SHIFT;
int32 distV = targetDist * phd_sin(targetAngleX) >> FIXED_SHIFT;
Expand Down Expand Up @@ -206,7 +206,7 @@ struct Camera
targetAngleX = X_CLAMP(targetAngleX + item->angle.x, -CAMERA_ANGLE_MAX, CAMERA_ANGLE_MAX);
targetAngleY += item->angle.y;

Location best = getBestLocation(item, false);
Location best = getBestLocation(false);

move(best, lastFixed ? speed : 12);
}
Expand Down Expand Up @@ -237,7 +237,7 @@ struct Camera

targetDist = CAM_DIST_COMBAT;

Location best = getBestLocation(item, true);
Location best = getBestLocation(true);

move(best, speed);
}
Expand All @@ -250,7 +250,7 @@ struct Camera
targetAngleY = item->extraL->head.angle.y + item->extraL->torso.angle.y + item->angle.y;
targetDist = lookAtItem ? CAM_DIST_FOLLOW : CAM_DIST_LOOK;

Location best = getBestLocation(item, true);
Location best = getBestLocation(true);

move(best, speed);
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/gba/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ void initDivTable()
}
*/

X_INLINE int16 lerpAngle(int16 a, int16 b, uint32 t)
X_INLINE int16 lerpAngle(int16 a, int16 b, int32 t)
{
int32 d = b - a;

Expand Down
4 changes: 2 additions & 2 deletions src/platform/gba/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ struct SpriteSeq {
uint16 type;
uint16 unused;
int16 count;
int16 start;
uint16 start;
};

struct FixedCamera {
Expand Down Expand Up @@ -1679,7 +1679,7 @@ extern Rect viewport;
extern vec3i cameraViewPos;
extern Matrix matrixStack[MAX_MATRICES];
extern int32 matrixStackIndex;
extern uint32 gVerticesCount;
extern int32 gVerticesCount;

extern SaveGame gSaveGame;
extern Settings gSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/gba/deploy_dos.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rm *.obj
wcl386.exe *.cpp -fe=OpenLara.exe -i="C:\WATCOM/h" -w4 -e25 -zq -ox -d2 -6r -bt=dos -fo=.obj -zmf -xd -l=pmodew
wcl386.exe *.cpp -fe=OpenLara.exe -i="C:\WATCOM/h" -wcd726 -w4 -e25 -zq -ox -d2 -6r -bt=dos -fo=.obj -zmf -xd -l=pmodew
C:\Dosbox\dosbox -conf dosbox.conf OpenLara.exe
2 changes: 1 addition & 1 deletion src/platform/gba/enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum AggressionLevel

struct Enemy : Item
{
Enemy(Room* room, int32 _health, int32 _radius, int32 _headOffset, uint32 _aggression) : Item(room)
Enemy(Room* room, int32 _health, int32 _radius, int32 _headOffset, int32 _aggression) : Item(room)
{
flags.shadow = true;

Expand Down
2 changes: 1 addition & 1 deletion src/platform/gba/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct Game
Item* item = items + i;

item->type = info->type;
item->intensity = info->intensity;
item->intensity = uint8(info->intensity);

item->pos.x = info->pos.x + (rooms[info->roomIndex].info->x << 8);
item->pos.y = info->pos.y;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/gba/lara.h
Original file line number Diff line number Diff line change
Expand Up @@ -3650,7 +3650,7 @@ struct Lara : Item

minAimY = angleAim.y;
extraL->armR.target = item;
} while ((item = item->nextActive));
} while ((item = item->nextActive) != NULL);
}

void weaponUpdateTargets()
Expand Down
4 changes: 2 additions & 2 deletions src/platform/gba/level.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ void readLevel(const uint8* data)
if (spriteSeq->type >= TR1_ITEM_MAX) // WTF?
continue;

Model *m = models + spriteSeq->type;
m->count = spriteSeq->count;
Model* m = models + spriteSeq->type;
m->count = int8(spriteSeq->count);
m->start = spriteSeq->start;
}

Expand Down
9 changes: 7 additions & 2 deletions src/platform/gba/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int32 fpsCounter = 0;
return *timerCLK / 33;
}

void paletteSet(uint16* palette)
void paletteSet(const uint16* palette)
{
memcpy((uint16*)0xC0000200, palette, 256 * 2);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ int32 fpsCounter = 0;
"mov ax,03h" \
"int 10h";

void paletteSet(uint16* palette)
void paletteSet(const uint16* palette)
{
outp(0x03C8, 0);
for (int32 i = 0; i < 256; i++)
Expand Down Expand Up @@ -257,6 +257,11 @@ int32 fpsCounter = 0;
if (keyState[KB_ENTER]) keys |= IK_START;
if (keyState[KB_TAB]) keys |= IK_SELECT;
}

int32 osGetSystemTimeMS()
{
return 0;
}
#endif

EWRAM_DATA ALIGN16 uint8 soundBufferA[2 * SND_SAMPLES + 32]; // 32 bytes of silence for DMA overrun while interrupt
Expand Down
6 changes: 3 additions & 3 deletions src/platform/gba/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ struct Door : Object
nextPos.x = pos.x + (nextPos.x << 10);
nextPos.z = pos.z + (nextPos.z << 10);

activate(close, false, room, nextPos.x, nextPos.z); // use the sector behind the door
setDoorState(close, false, room, nextPos.x, nextPos.z); // use the sector behind the door

// TODO flip rooms
}

void activate(bool close, bool behind, Room* room, int32 x, int32 z)
void setDoorState(bool close, bool behind, Room* room, int32 x, int32 z)
{
room->modify(); // make room->sectors dynamic (non ROM)

Expand All @@ -297,7 +297,7 @@ struct Door : Object
// TODO modify level.boxes

if (!behind && nextRoom) {
activate(close, true, nextRoom, pos.x, pos.z); // use sector from item pos
setDoorState(close, true, nextRoom, pos.x, pos.z); // use sector from item pos
}
}
};
Expand Down
6 changes: 6 additions & 0 deletions src/platform/gba/rasterizer_mode13.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern const uint8* tile;
#define rasterizeGT rasterizeGT_mode13_c
#define rasterizeFTA rasterizeFTA_mode13_c
#define rasterizeGTA rasterizeGTA_mode13_c
#define rasterizeSprite rasterizeSprite_mode13_c

void rasterizeS_mode13_c(uint16* pixel, const VertexUV* L, const VertexUV* R)
{
Expand Down Expand Up @@ -770,4 +771,9 @@ void rasterizeGTA_mode13_c(uint16* pixel, const VertexUV* L, const VertexUV* R)
rasterizeGT(pixel, L, R);
}

void rasterizeSprite_mode13_c(uint16* pixel, const VertexUV* L, const VertexUV* R)
{
// TODO
}

#endif
6 changes: 3 additions & 3 deletions src/platform/gba/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extern int32 causticsFrame;
const uint8* tile;
const Sprite* sprite;

uint32 gVerticesCount = 0;
int32 gVerticesCount = 0;
int32 gFacesCount = 0; // 1 is reserved as OT terminator

EWRAM_DATA Vertex gVertices[MAX_VERTICES]; // EWRAM 16k
Expand Down Expand Up @@ -260,7 +260,8 @@ void transformMesh(const vec3s* vertices, int32 vCount, const uint16* vIntensity
}
}

VertexUV* clipPoly(VertexUV* poly, VertexUV* tmp, int32 &pCount) {
VertexUV* clipPoly(VertexUV* poly, VertexUV* tmp, int32 &pCount)
{
#define LERP(a,b,t) (b + ((a - b) * t >> 12))
#define LERP2(a,b,ta,tb) (b + (((a - b) * ta / tb) >> 12) )

Expand Down Expand Up @@ -615,7 +616,6 @@ void faceAddTriangle(uint32 flags, const Index* indices, int32 startVertex)
return;

int32 clip = (v1->clip | v2->clip | v3->clip);

if (clip & 32)
return;

Expand Down

0 comments on commit 7e70292

Please sign in to comment.