Day 32 complete.

This commit is contained in:
igor
2026-04-11 20:47:13 -07:00
parent e13e4f44e6
commit 6164bb5612
+14 -7
View File
@@ -152,7 +152,7 @@ static void CannonicalizeCoord(world *World, S32 TileCount,
*Tile = TileCount + *Tile;
(*TileMap)--;
}
if(*Tile >= World->CountX) {
if(*Tile >= TileCount) {
*Tile = *Tile - TileCount;
(*TileMap)++;
}
@@ -163,9 +163,9 @@ static cannonical_position RecannonicalizePosition(world *World,
{
cannonical_position Result = Pos;
CannonicalizeCoord(World, World->TileMapCountX,
CannonicalizeCoord(World, World->CountX,
&Result.TileMapX, &Result.TileX, &Result.TileRelX);
CannonicalizeCoord(World, World->TileMapCountY,
CannonicalizeCoord(World, World->CountY,
&Result.TileMapY, &Result.TileY, &Result.TileRelY);
return Result;
@@ -312,8 +312,8 @@ void UpdateAndRender(thread_context *Thread, game_memory *Memory,
dPlayerX = 1.0f;
}
dPlayerX *= 10.0f;
dPlayerY *= 10.0f;
dPlayerX *= 5.0f;
dPlayerY *= 5.0f;
NewPlayerP = GameState->PlayerP;
NewPlayerP.TileRelX += Input->dtForFrame*dPlayerX;
@@ -349,6 +349,13 @@ void UpdateAndRender(thread_context *Thread, game_memory *Memory,
if(TileID) {
Gray = 1.0f;
}
if((Column == GameState->PlayerP.TileX) &&
(Row == GameState->PlayerP.TileY))
{
Gray = 0.0f;
}
MinX = World.UpperLeftX +
(F32)(Column) * (F32)World.TileSideInPixels;
MinY =
@@ -366,12 +373,12 @@ void UpdateAndRender(thread_context *Thread, game_memory *Memory,
(F32)World.TileSideInPixels*(F32)GameState->PlayerP.TileX +
(F32)GameState->PlayerP.TileX +
World.MetersToPixels*GameState->PlayerP.TileRelX -
0.5f*PlayerWidth;
0.5f*World.MetersToPixels*PlayerWidth;
PlayerTop = World.UpperLeftY +
(F32)World.TileSideInPixels*(F32)GameState->PlayerP.TileY +
(F32)GameState->PlayerP.TileY +
World.MetersToPixels*GameState->PlayerP.TileRelY -
PlayerHeight;
World.MetersToPixels*PlayerHeight;
DrawRectangle(Buffer,
PlayerLeft, PlayerTop,
PlayerLeft + World.MetersToPixels*PlayerWidth,