aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2026-01-07 11:21:32 +0000
committernathan <nathansmith@disroot.org>2026-01-07 11:21:32 +0000
commit0180e40326f67ef465e1d865a0aed21162e0f5c5 (patch)
tree2f72f94010920b0d9d9147620ed205f642720e3e
parent0fb94d28d3f64e95ff228edbfd8fc17d420e215f (diff)
downloadFindThings-0180e40326f67ef465e1d865a0aed21162e0f5c5.tar.gz
FindThings-0180e40326f67ef465e1d865a0aed21162e0f5c5.tar.bz2
FindThings-0180e40326f67ef465e1d865a0aed21162e0f5c5.zip
At place thingy
-rw-r--r--design/design.org11
-rw-r--r--src/game.c24
-rw-r--r--src/player.c16
-rw-r--r--src/player.h1
4 files changed, 36 insertions, 16 deletions
diff --git a/design/design.org b/design/design.org
index e38a863..5853867 100644
--- a/design/design.org
+++ b/design/design.org
@@ -143,21 +143,22 @@ creates is possible to beat. A little wack is fine as long as its
beatable. Since most of the world will just be a height map a image will be
generated first than rest of the world will be based around it.
-* TODO World generation check list [6/9]
+* TODO World generation check list [8/9]
+ [X] Basic terrain
+ [X] Ground texture
+ [X] Trees/plants
+ [X] Sky
+ [X] Pond
+ [X] Power lines
-+ [ ] Buildings
-+ [ ] Places
++ [X] Buildings
++ [X] Places
+ [ ] Roads
-* TODO Check list [0/5]
+* TODO Check list [1/7]
+ [ ] World generation completed
+ [ ] Menu and UI
-+ [ ] Interaction system
++ [X] Interaction system
++ [ ] Inventory
+ [ ] All characters added
+ [ ] All items added
+ [ ] All levels added
diff --git a/src/game.c b/src/game.c
index fb5566d..fb7e01d 100644
--- a/src/game.c
+++ b/src/game.c
@@ -212,16 +212,31 @@ void updateGameStatus(Game* game)
float width;
float height;
int fontSize = 20;
- int lineCount = 2;
- int maxColumns = 16;
+ int lineCount = 3;
+ int maxColumns = 24;
float maxWidth = maxColumns * fontSize / 2.0;
- bool topBarStyle = game->screen.destination.x < maxWidth;
+ bool topBarStyle = game->screen.destination.x < maxWidth / 2.0;
const char* spacer = topBarStyle ? ", " : "\n";
+ // Format text.
+ char placeAt[ENTITY_NAME_MAX] = "Back woods";
+ WorldUID place = game->player.place;
+
+ if (place != ENTITY_NONE)
+ {
+ strncpy(placeAt, getEntityName(game->world.entities[place].id),
+ ENTITY_NAME_MAX - 1);
+ }
+
const char* text = TextFormat(
- "Speed %d kps%sPee level: 7", (int)roundf(game->player.speed), spacer);
+ "At: %s%sSpeed %d%sPee level: 7",
+ placeAt,
+ spacer,
+ (int)roundf(game->player.speed),
+ spacer);
+ // Handle bar style.
if (topBarStyle) // Top bar style.
{
x = 110.0;
@@ -237,6 +252,7 @@ void updateGameStatus(Game* game)
height = fontSize * lineCount;
}
+ // Draw text and background.
Color backgroundColor = PINK;
backgroundColor.a = game->settings.statusAndInfoAlpha;
DrawRectangle(x, y, width, height, backgroundColor);
diff --git a/src/player.c b/src/player.c
index df59ffe..fd33524 100644
--- a/src/player.c
+++ b/src/player.c
@@ -26,6 +26,7 @@ Player createPlayer()
.projection = CAMERA_PERSPECTIVE
},
.cameraAngle = Vector2Zero(),
+ .place = ENTITY_NONE,
.selectedEntity = ENTITY_NONE,
.isInteracting = false
};
@@ -59,15 +60,14 @@ void updatePlayerLookingAround(Player* player, Game* game)
player->direction = (Vector3){matrix.m2, matrix.m6, matrix.m10};
}
-WorldUID playerCheckCollisionWithBuildings(Player* player, Game* game)
+WorldUID playerCheckCollisionWithPlace(Player* player, Game* game)
{
for (int index = 0; index < WORLD_PLACE_COUNT; ++index)
{
WorldUID uid = game->world.places[index];
Entity* place = &game->world.entities[uid];
- if (entityIsBuilding(place->id)
- && CheckCollisionBoxes(place->box, player->box))
+ if (CheckCollisionBoxes(place->box, player->box))
{
return uid;
}
@@ -449,12 +449,14 @@ void updatePlayer(Player* player, Game* game)
updatePlayerMovement(player, game);
- // Check collision with buildings.
- WorldUID buildingUID = playerCheckCollisionWithBuildings(player, game);
+ WorldUID placeUID = playerCheckCollisionWithPlace(player, game);
+ player->place = placeUID;
- if (buildingUID != ENTITY_NONE)
+ // Collision with buildings.
+ if (placeUID != ENTITY_NONE &&
+ entityIsBuilding(game->world.entities[placeUID].id))
{
- playerHandleCollisionWithBuilding(player, game, buildingUID);
+ playerHandleCollisionWithBuilding(player, game, placeUID);
}
playerApplyVelocity(player);
diff --git a/src/player.h b/src/player.h
index 3edec59..2a0f8cc 100644
--- a/src/player.h
+++ b/src/player.h
@@ -28,6 +28,7 @@ typedef struct {
Camera camera;
Vector2 cameraAngle;
+ WorldUID place;
WorldUID selectedEntity;
bool isInteracting;
} Player;