aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-12-22 18:42:11 -0700
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-12-22 18:42:11 -0700
commit670ef2efe90f94a950a4465ce029fb07d2a6ae73 (patch)
tree3c949660b0234ac09acf321622dbc5909e5cfc09
parent2fb4b9a9b8f1de6d22a356ad58cd6ebef15126c5 (diff)
Added the easter egg
-rw-r--r--src/entities/antifaShip.h2
-rw-r--r--src/screens/gameScreen.c48
2 files changed, 49 insertions, 1 deletions
diff --git a/src/entities/antifaShip.h b/src/entities/antifaShip.h
index c0e43ee..0adb7a3 100644
--- a/src/entities/antifaShip.h
+++ b/src/entities/antifaShip.h
@@ -15,7 +15,7 @@
#define ANTIFA_TARGETING_SPEED 6.0
// Some keys for debugging.
-#define DEBUG_KEYS
+//#define DEBUG_KEYS
typedef struct AntifaShip {
Vector2 lastMouse;
diff --git a/src/screens/gameScreen.c b/src/screens/gameScreen.c
index 8fe141a..865d9e2 100644
--- a/src/screens/gameScreen.c
+++ b/src/screens/gameScreen.c
@@ -208,13 +208,61 @@ void resetGame(Game * game, GameScreen * gameScreen) {
startLevel(game, &game->levels, 0);
}
+void easterEgg(Game * game) {
+ int i;
+
+ SetRandomSeed(time(NULL));
+ Entity * player = getEntityFromWorld(game->world, 0);
+ Vector3 playerPosition = player->position;
+
+ player->health = 1.0;
+
+ WorldEntry entries[100];
+
+ for (i = 0; i < sizeof(entries) / sizeof(WorldEntry); ++i) {
+ // Get position.
+ Vector3 position = (Vector3){
+ (float)GetRandomValue(-UCHAR_MAX, UCHAR_MAX) / UCHAR_MAX,
+ (float)GetRandomValue(-UCHAR_MAX, UCHAR_MAX) / UCHAR_MAX,
+ (float)GetRandomValue(-UCHAR_MAX, UCHAR_MAX) / UCHAR_MAX
+ };
+
+
+ float distance = GetRandomValue(100, 800);
+ distance = (GetRandomValue(0, 1) == 0) ? distance : -distance;
+
+ position = Vector3Scale(position, distance);
+ position = Vector3Add(position, playerPosition);
+
+ // Get type.
+ EntityType type = GetRandomValue(ENTITY_SOLDATO, ENTITY_GENERALE - 1);
+
+ entries[i] = (WorldEntry){type, position, QuaternionIdentity()};
+ }
+
+ addEntriesToWorld(
+ &game->world,
+ game,
+ entries,
+ sizeof(entries) / sizeof(WorldEntry)
+ );
+
+}
+
void handleGameScreenInput(Game * game, GameScreen * gameScreen) {
+
+ // End game.
if (IsKeyPressed(KEY_E)) {
resetGame(game, gameScreen);
closeGameScreen(game);
game->screenId = SCREEN_MAIN_MENU;
}
+ // Easter egg lol.
+ if (IsKeyDown(KEY_LEFT_SHIFT) && IsKeyDown(KEY_LEFT_CONTROL)
+ && IsMouseButtonDown(MOUSE_MIDDLE_BUTTON) && IsMouseButtonPressed(MOUSE_RIGHT_BUTTON))
+ easterEgg(game);
+
switch(GetKeyPressed()) {
case KEY_ONE:
gameScreen->mainCamera = FIRST_PERSON_CAMERA;