123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- This mod adds messages to computer terminals found in the game, increasing
- "immersion": standing near a terminal will display a random message.
- diff --git a/game.h b/game.h
- index 991058d..a96df00 100755
- --- a/game.h
- +++ b/game.h
- @@ -390,6 +390,7 @@ struct
- 0 (not saved), 1 (just saved) or 255 (can't save).*/
- uint8_t cheatState; /**< Highest bit say whether cheat is enabled, other bits
- represent the state of typing the cheat code. */
- + const char *rollingMessage;
- uint8_t save[SFG_SAVE_SIZE]; /**< Stores the game save state that's kept in
- the persistent memory.
-
- @@ -467,6 +468,7 @@ struct
-
- SFG_ProjectileRecord projectileRecords[SFG_MAX_PROJECTILES];
- uint8_t projectileRecordCount;
- + uint8_t checkedTerminalIndex;
- uint8_t bossCount;
- uint8_t monstersDead;
- uint8_t backgroundImage;
- @@ -1536,6 +1538,8 @@ void SFG_setAndInitLevel(uint8_t levelNumber)
- SFG_currentLevel.ceilingColor = level->ceilingColor;
- SFG_currentLevel.completionTime10sOfS = 0;
-
- + SFG_game.rollingMessage = 0;
- +
- for (uint8_t i = 0; i < 7; ++i)
- SFG_currentLevel.textures[i] =
- SFG_wallTextures + level->textureIndices[i] * SFG_TEXTURE_STORE_SIZE;
- @@ -1543,6 +1547,7 @@ void SFG_setAndInitLevel(uint8_t levelNumber)
- SFG_LOG("initializing doors");
-
- SFG_currentLevel.checkedDoorIndex = 0;
- + SFG_currentLevel.checkedTerminalIndex = 0;
- SFG_currentLevel.doorRecordCount = 0;
- SFG_currentLevel.projectileRecordCount = 0;
- SFG_currentLevel.teleporterCount = 0;
- @@ -2762,6 +2767,41 @@ void SFG_updateLevel(void)
- p->doubleFramesToLive -= subtractFrames;
- }
-
- + // handle terminal texts:
- +
- + if (SFG_game.rollingMessage)
- + {
- + if (SFG_game.frame % SFG_BLINK_PERIOD_FRAMES == 0)
- + {
- + SFG_game.rollingMessage++;
- +
- + if (*SFG_game.rollingMessage == 0)
- + SFG_game.rollingMessage = 0;
- + }
- + }
- + else
- + {
- + const SFG_LevelElement *levelElement =
- + &(SFG_currentLevel.levelPointer->elements[
- + SFG_currentLevel.checkedTerminalIndex]);
- +
- + if (levelElement->type == SFG_LEVEL_ELEMENT_TERMINAL)
- + {
- + int dx = ((int) levelElement->coords[0]) -
- + ((int) SFG_player.squarePosition[0]);
- +
- + int dy = ((int) levelElement->coords[1]) -
- + ((int) SFG_player.squarePosition[1]);
- +
- + if (dx * dx + dy * dy <= 2)
- + SFG_game.rollingMessage = SFG_terminalTexts[
- + SFG_currentLevel.checkedTerminalIndex % SFG_TERMIAL_TEXTS];
- + }
- +
- + SFG_currentLevel.checkedTerminalIndex++;
- + SFG_currentLevel.checkedTerminalIndex %= SFG_MAX_LEVEL_ELEMENTS;
- + }
- +
- // handle door:
- if (SFG_currentLevel.doorRecordCount > 0) // has to be here
- {
- @@ -4876,6 +4916,12 @@ void SFG_draw(void)
-
- // draw HUD:
-
- + // terminal message:
- +
- + if (SFG_game.rollingMessage)
- + SFG_drawText(SFG_game.rollingMessage,SFG_FONT_SIZE_MEDIUM,
- + SFG_FONT_SIZE_MEDIUM,SFG_FONT_SIZE_MEDIUM,7,255,0);
- +
- // bar
-
- uint8_t color = 61;
- diff --git a/texts.h b/texts.h
- index b7e53d4..8e16434 100644
- --- a/texts.h
- +++ b/texts.h
- @@ -53,6 +53,18 @@ static const char *SFG_outroText =
- "learned a lesson, never again allow capitalism and hierarchy. We can now "
- "rebuild society in peaceful anarchy.";
-
- +#define SFG_TERMIAL_TEXTS 6
- +
- +static const char *SFG_terminalTexts[SFG_TERMIAL_TEXTS] =
- +{
- + "To whoever might help - the AI brain is on the roof of Macrochip HQ.",
- + "Capitalism is how you enslave a man with his approval. --Macrochip CEO",
- + "Mailbox - The spiders are here. Tell family I love them. God help us.",
- + "Local data, 34012 active units, city 90 percent subdued, 1 intruder.",
- + "News - AI crossing ocean, overpowering army. Macrochip CEO gone.",
- + "Mailbox - Proprietary tech was our biggest error. If we live, stop capitalism."
- +};
- +
- #define SFG_MALWARE_WARNING ""
-
- #if SFG_OS_IS_MALWARE
|