Skip to content

Commit

Permalink
#368 fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed Dec 23, 2021
1 parent e23029a commit 3e9babf
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 76 deletions.
5 changes: 3 additions & 2 deletions src/fixed/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,8 @@ void drawRooms(Camera* camera)
setViewport(camera->view.room->clip);
}


//#define DEBUG_PRIMS
#ifdef DEBUG_PRIMS
#define MESH_FACE(flags, i0, i1, i2, i3) { flags, (i0 | (i1 << 8) | (i2 << 16) | (i3 << 24)) }

const MeshQuad gBoxFaces[6] = {
Expand Down Expand Up @@ -971,6 +972,6 @@ void drawBox(const AABBi &box)
transformMesh(boxVertices, 8, NULL, NULL);
faceAddMesh(NULL, gBoxFaces, NULL, NULL, 0, 6, 0, 0);
}

#endif

#endif
2 changes: 0 additions & 2 deletions src/fixed/enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,7 @@ struct Wolf : Enemy

Wolf(Room* room) : Enemy(room, 6, 341, 375, AGGRESSION_LVL_2)
{
#ifndef PROFILING
frameIndex = level.anims[animIndex].frameEnd - 1;
#endif
}

virtual void hit(int32 damage, const vec3i &point, int32 soundId)
Expand Down
2 changes: 0 additions & 2 deletions src/fixed/lara.h
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,6 @@ struct Lara : ItemObj
setWeaponState(WEAPON_STATE_FREE);
meshSwap(ITEM_LARA, 0xFFFFFFFF);

//#ifndef PROFILING
extern int32 gLevelID;
bool isHome = gLevelID == 0;

Expand All @@ -2710,7 +2709,6 @@ struct Lara : ItemObj
}

animSet(ANIM_STAND, true, 0);
//#endif

health = LARA_MAX_HEALTH;
oxygen = LARA_MAX_OXYGEN;
Expand Down
30 changes: 30 additions & 0 deletions src/platform/gba/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,29 @@ int32 fpsCounter = 0;
void osJoyVibrate(int32 index, int32 L, int32 R) {}
#endif

void osSetGamma(int32 value)
{
if (value == 0) {
osSetPalette(level.palette);
return;
}

uint16 pal[256];
for (int32 i = 0; i < 256; i++)
{
int32 r = 31 & (level.palette[i]);
int32 g = 31 & (level.palette[i] >> 5);
int32 b = 31 & (level.palette[i] >> 10);

r = X_MIN(31, r + (((r * r >> 2) - r) * value >> 8));
g = X_MIN(31, g + (((g * g >> 2) - g) * value >> 8));
b = X_MIN(31, b + (((b * b >> 2) - b) * value >> 8));

pal[i] = r | (g << 5) | (b << 10);
}
osSetPalette(pal);
}

EWRAM_DATA ALIGN16 uint8 soundBuffer[2 * SND_SAMPLES + 32]; // 32 bytes of silence for DMA overrun while interrupt

uint32 curSoundBuffer = 0;
Expand Down Expand Up @@ -454,6 +477,13 @@ static const char* gLevelNames[] = {
// "LEVEL10C"
};

int32 reqNextLevel = -1;

void nextLevel()
{
reqNextLevel = (gLevelID + 1) % (sizeof(gLevelNames) / sizeof(gLevelNames[0]));
}

void* osLoadLevel(const char* name)
{
sndStop();
Expand Down
16 changes: 8 additions & 8 deletions src/platform/gba/packer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ struct LevelPC

roomVerticesCount = 0;

info.quads = f.getPos();
info.quads = f.align4();
for (int32 i = 0; i < room->qCount; i++)
{
Quad q = room->quads[i];
Expand All @@ -2577,7 +2577,7 @@ struct LevelPC
q.write(f);
}

info.triangles = f.getPos();
info.triangles = f.align4();
for (int32 i = 0; i < room->tCount; i++)
{
Triangle t = room->triangles[i];
Expand All @@ -2587,14 +2587,14 @@ struct LevelPC
t.write(f);
}

info.vertices = f.getPos();
info.vertices = f.align4();
info.verticesCount = roomVerticesCount;
for (int32 i = 0; i < roomVerticesCount; i++)
{
roomVertices[i].write(f);
}

info.sprites = f.getPos();
info.sprites = f.align4();
for (int32 i = 0; i < room->sCount; i++)
{
const Room::Sprite* sprite = room->sprites + i;
Expand All @@ -2612,13 +2612,13 @@ struct LevelPC
comp.write(f);
}

info.portals = f.getPos();
info.portals = f.align4();
f.writeObj(room->portals, room->pCount);

info.sectors = f.getPos();
info.sectors = f.align4();
f.writeObj(room->sectors, room->zSectors * room->xSectors);

info.lights = f.getPos();
info.lights = f.align4();
for (int32 i = 0; i < room->lCount; i++)
{
const Room::Light* light = room->lights + i;
Expand All @@ -2633,7 +2633,7 @@ struct LevelPC
comp.write(f);
}

info.meshes = f.getPos();
info.meshes = f.align4();
for (int32 i = 0; i < room->mCount; i++)
{
const Room::Mesh* mesh = room->meshes + i;
Expand Down
Loading

0 comments on commit 3e9babf

Please sign in to comment.