Browse Source

add acknowledgements

Thomas B 2 weeks ago
parent
commit
3055e37a73
8 changed files with 123 additions and 16 deletions
  1. BIN
      data/romek.png
  2. 68
    14
      src/main.c
  3. 13
    2
      src/sprite_data.c
  4. 1
    0
      src/sprites.h
  5. 16
    0
      src/strings.c
  6. 8
    0
      src/strings.h
  7. 16
    0
      src/window.c
  8. 1
    0
      src/window.h

BIN
data/romek.png View File


+ 68
- 14
src/main.c View File

@@ -90,6 +90,30 @@ enum HW_TYPE get_hw(void) BANKED {
90 90
     return hw_type;
91 91
 }
92 92
 
93
+static void init_rng(void) NONBANKED {
94
+#ifdef CONSTANT_SEED
95
+    uint16_t seed = CONSTANT_SEED;
96
+#else
97
+    uint16_t seed = DIV_REG;
98
+    waitpadup();
99
+    seed |= ((uint16_t)DIV_REG) << 8;
100
+#endif
101
+
102
+    // store in an SRAM variable, so the
103
+    // value goes over the cartridge bus.
104
+    // gives gb-interceptor a chance to see it.
105
+    prng_seed = seed;
106
+    initarand(prng_seed);
107
+}
108
+
109
+static int16_t rand_px(void) NONBANKED {
110
+    int16_t val = arand() & 0x30;
111
+    if (arand() & 0x01) {
112
+        val = -val;
113
+    }
114
+    return val;
115
+}
116
+
93 117
 static void list_scores(uint8_t is_black) {
94 118
     for (uint8_t i = 0; i < SCORE_NUM; i++) {
95 119
         struct scores score;
@@ -139,6 +163,46 @@ static void highscore(uint8_t is_black) {
139 163
     }
140 164
 }
141 165
 
166
+static void acknowledgements_screen(void) {
167
+    HIDE_WIN;
168
+
169
+    move_win(MINWNDPOSX, MINWNDPOSY);
170
+    hide_sprites_range(SPR_NUM_START, MAX_HARDWARE_SPRITES);
171
+    win_acknowledgements();
172
+
173
+    SHOW_WIN;
174
+
175
+    init_rng();
176
+
177
+    int16_t pos_x = rand_px(), pos_y = rand_px();
178
+    int8_t spd_x = 1, spd_y = 1;
179
+
180
+    while (1) {
181
+        key_read();
182
+
183
+        if (key_pressed(J_A) || key_pressed(J_B) || key_pressed(J_SELECT) || key_pressed(J_START)) {
184
+            break;
185
+        }
186
+
187
+        uint8_t hiwater = SPR_NUM_START;
188
+        spr_draw(SPR_ROMEK, FLIP_NONE, pos_x, pos_y, 0, &hiwater);
189
+        hide_sprites_range(hiwater, MAX_HARDWARE_SPRITES);
190
+
191
+        pos_x += spd_x;
192
+        if ((pos_x > (DEVICE_SCREEN_PX_WIDTH / 2 - 16))
193
+                || (pos_x < -(DEVICE_SCREEN_PX_WIDTH / 2 - 16))) {
194
+            spd_x = -spd_x;
195
+        }
196
+        pos_y += spd_y;
197
+        if ((pos_y > (DEVICE_SCREEN_PX_HEIGHT / 2 - 16))
198
+                || (pos_y < -(DEVICE_SCREEN_PX_HEIGHT / 2 - 16))) {
199
+            spd_y = -spd_y;
200
+        }
201
+
202
+        vsync();
203
+    }
204
+}
205
+
142 206
 static void about_screen(void) {
143 207
     HIDE_WIN;
144 208
 
@@ -159,6 +223,9 @@ static void about_screen(void) {
159 223
 
160 224
         if (key_pressed(J_A) || key_pressed(J_B) || key_pressed(J_SELECT)) {
161 225
             break;
226
+        } else if (key_pressed(J_START)) {
227
+            acknowledgements_screen();
228
+            break;
162 229
         }
163 230
 
164 231
         vsync();
@@ -660,20 +727,7 @@ void main(void) NONBANKED {
660 727
     snd_init();
661 728
 
662 729
     splash();
663
-
664
-#ifdef CONSTANT_SEED
665
-    uint16_t seed = CONSTANT_SEED;
666
-#else
667
-    uint16_t seed = DIV_REG;
668
-    waitpadup();
669
-    seed |= ((uint16_t)DIV_REG) << 8;
670
-#endif
671
-
672
-    // store in an SRAM variable, so the
673
-    // value goes over the cartridge bus.
674
-    // gives gb-interceptor a chance to see it.
675
-    prng_seed = seed;
676
-    initarand(prng_seed);
730
+    init_rng();
677 731
 
678 732
     while (1) {
679 733
         if (conf_state()->in_progress && ask_continue()) {

+ 13
- 2
src/sprite_data.c View File

@@ -31,6 +31,7 @@
31 31
 #include "pause.h"
32 32
 #include "debug_marker.h"
33 33
 #include "debug_marker_spr32.h"
34
+#include "romek.h"
34 35
 
35 36
 BANKREF(sprite_data)
36 37
 
@@ -42,9 +43,8 @@ BANKREF(sprite_data)
42 43
  * OCP4: Shot
43 44
  * OCP5: Health
44 45
  * OCP6: Power
45
- * OCP7: Pause
46
+ * OCP7: Dynamically loaded sprites
46 47
  *
47
- * Explosion uses OCP0 to OCP3 at end of game.
48 48
  * Pause is flipped in-place for animating the pause screen colors.
49 49
  */
50 50
 
@@ -186,4 +186,15 @@ struct sprites metasprites[SPRITE_COUNT] = {
186 186
         .off = TILE_NUM_START,
187 187
         .bank = BANK(debug_marker_spr32),
188 188
     },
189
+    { // SPR_ROMEK
190
+        .ms = romek_metasprites,
191
+        .ms_n = ARR_LEN(romek_metasprites),
192
+        .ti = romek_tiles,
193
+        .pa = romek_palettes,
194
+        .pa_n = romek_PALETTE_COUNT,
195
+        .pa_i = OAMF_CGB_PAL7 | PALETTE_DYNAMIC_LOAD_IP,
196
+        .cnt = romek_TILE_COUNT,
197
+        .off = TILE_NUM_START,
198
+        .bank = BANK(romek),
199
+    },
189 200
 };

+ 1
- 0
src/sprites.h View File

@@ -38,6 +38,7 @@ enum SPRITES {
38 38
     SPR_PAUSE,
39 39
     SPR_DEBUG,
40 40
     SPR_DEBUG_LARGE,
41
+    SPR_ROMEK,
41 42
 
42 43
     SPRITE_COUNT
43 44
 };

+ 16
- 0
src/strings.c View File

@@ -59,6 +59,14 @@ static const char        string_game_in[] = "Game in";
59 59
 static const char       string_progress[] = "Progress";
60 60
 static const char     string_a_continue[] = "A Continue";
61 61
 static const char     string_b_new_game[] = "B New Game";
62
+static const char       string_joshimuz[] = "Joshimuz";
63
+static const char         string_caffie[] = "Caffie";
64
+static const char         string_thanks[] = "Thanks to";
65
+static const char   string_thanks_gbc_1[] = " Special thanks for";
66
+static const char   string_thanks_gbc_2[] = " the inspiration go";
67
+static const char   string_thanks_gbc_3[] = "       out to";
68
+static const char   string_thanks_gbc_4[] = "Joshimuz and Caffie_";
69
+static const char   string_thanks_gbc_5[] = "Visit Joshimuz.com \x01";
62 70
 
63 71
 static const char * const strings[COUNT_STRINGS] = {
64 72
     string_top,            // STR_TOP
@@ -96,6 +104,14 @@ static const char * const strings[COUNT_STRINGS] = {
96 104
     string_progress,       // STR_PROGRESS
97 105
     string_a_continue,     // STR_A_CONTINUE
98 106
     string_b_new_game,     // STR_B_NEW_GAME
107
+    string_joshimuz,       // STR_JOSHIMUZ
108
+    string_caffie,         // STR_CAFFIE
109
+    string_thanks,         // STR_THANKS
110
+    string_thanks_gbc_1,   // STR_THANKS_GBC_1
111
+    string_thanks_gbc_2,   // STR_THANKS_GBC_2
112
+    string_thanks_gbc_3,   // STR_THANKS_GBC_3
113
+    string_thanks_gbc_4,   // STR_THANKS_GBC_4
114
+    string_thanks_gbc_5,   // STR_THANKS_GBC_5
99 115
 };
100 116
 
101 117
 #define MAX_STR_LEN 32

+ 8
- 0
src/strings.h View File

@@ -58,6 +58,14 @@ enum STRINGS {
58 58
     STR_PROGRESS,
59 59
     STR_A_CONTINUE,
60 60
     STR_B_NEW_GAME,
61
+    STR_JOSHIMUZ,
62
+    STR_CAFFIE,
63
+    STR_THANKS,
64
+    STR_THANKS_GBC_1,
65
+    STR_THANKS_GBC_2,
66
+    STR_THANKS_GBC_3,
67
+    STR_THANKS_GBC_4,
68
+    STR_THANKS_GBC_5,
61 69
 
62 70
     COUNT_STRINGS
63 71
 };

+ 16
- 0
src/window.c View File

@@ -123,6 +123,22 @@ void win_score_print(enum PRN_STATUS status) BANKED {
123 123
     }
124 124
 }
125 125
 
126
+void win_acknowledgements(void) BANKED {
127
+    map_fill(MAP_TITLE, 0);
128
+
129
+    if (_cpu == CGB_TYPE) {
130
+        str_ascii(get_string(STR_THANKS_GBC_1), 0, 3, 0);
131
+        str_ascii(get_string(STR_THANKS_GBC_2), 0, 4, 0);
132
+        str_ascii(get_string(STR_THANKS_GBC_3), 0, 5, 0);
133
+        str_ascii(get_string(STR_THANKS_GBC_4), 0, 12, 0);
134
+        str_ascii(get_string(STR_THANKS_GBC_5), 0, 13, 0);
135
+    } else {
136
+        str_center(get_string(STR_THANKS), 4, 0);
137
+        str_center(get_string(STR_JOSHIMUZ), 12, 0);
138
+        str_center(get_string(STR_CAFFIE), 14, 0);
139
+    }
140
+}
141
+
126 142
 static void get_git(char *line_buff) NONBANKED {
127 143
     START_ROM_BANK(BANK(git)) {
128 144
         strncpy(line_buff, git_version, 2 * TEXT_LINE_WIDTH);

+ 1
- 0
src/window.h View File

@@ -31,6 +31,7 @@ void win_splash_mp(void) BANKED;
31 31
 void win_score_clear(uint8_t is_black, uint8_t no_bg) BANKED;
32 32
 void win_score_draw(struct scores score, uint8_t off, uint8_t is_black) BANKED;
33 33
 void win_score_print(enum PRN_STATUS status) BANKED;
34
+void win_acknowledgements(void) BANKED;
34 35
 void win_about(void) BANKED;
35 36
 void win_about_mp(void) BANKED;
36 37
 void win_conf(void) BANKED;

Loading…
Cancel
Save