Skip to content

Commit 32a923b

Browse files
committed
Make Phantoms compile again
1 parent d98280e commit 32a923b

File tree

10 files changed

+110
-116
lines changed

10 files changed

+110
-116
lines changed

README.md

+2-55
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ This project uses the following third-party code:
126126

127127
---
128128

129-
## Phantom Slayer 1.0.2
129+
## Phantom Slayer 1.0.3
130130

131131
A retro-style 3D arcade game written in C. For more details, [see this page](https://smittytone.net/pico-phantoms/).
132132

@@ -261,57 +261,4 @@ Pico project set up script for Z Shell. Requires Pico C SDK pre-installed.
261261

262262
---
263263

264-
## Updates
265-
266-
- *Unreleased*
267-
- Add the Pico SDK as an optional submodule.
268-
- *1 March 2022*
269-
- Improve *Cellular IoT Demo* commenting.
270-
- Add `tmpcon` and `rssi` commands to *Cellular IoT Demo*.
271-
- *3 September 2021*
272-
- Complete *Cellular IoT Demo* — add `POST` ops and various improvements.
273-
- *20 August 2021*
274-
- Add *Cellular IoT Demo*.
275-
- *13 August 2021*
276-
- *makepico* now generates `main.c/cpp` and `main.h` not project-specific files.
277-
- *makepico*’s `CMakeLists.txt` now uses CMake 3.14.
278-
- *makepico*’s `main.c` now calls `stdio_init_all()`.
279-
- *23 July 2021*
280-
- Spring clean *makepico* and bump to 2.0.0.
281-
- *30 April 2021*
282-
- Update *makepico* to support C++ projects:
283-
- Add `-c` switch to create a C++ project.
284-
- Add a `-n` option so you can add your name for code comments.
285-
- *6 April 2021*
286-
- Bump Phantom Slayer to 1.0.2
287-
- Move some common routines into `utils.h`/`utils.c`.
288-
- Update *inkey()* to return the key pressed.
289-
- Add another map.
290-
- *31 March 2021*
291-
- Bump Phantom Slayer to 1.0.1
292-
- Graphics tweaks.
293-
- Improve Phantom movement logic.
294-
- Fix laser post-fire delay.
295-
- Bump Hunt the Wumpus to 1.0.2
296-
- Use TinyMT for random number generation.
297-
- Bump makepico to 1.2.0.
298-
- *26 March 2021*
299-
- Add Phantom Slayer 1.0.0
300-
- *25 February 2021*
301-
- Bump Wumpus to 1.0.1
302-
- Tweak sprites.
303-
- Improve trophy presentation.
304-
- Improve in-game code flow.
305-
- *20 February 2021*
306-
- Add *wumpus* example.
307-
- Update *makepico* script:
308-
- Add VSCode config creation.
309-
- Add `-d`/`--debug` switch to add VSCode SWD debugging support.
310-
- *5 February 2021*
311-
- Add *sensor* example.
312-
- *4 February 2021*
313-
- Add debugger-friendly VSCode `launch.json`.
314-
- *2 February 2021*
315-
- Initial release.
316-
317-
All source code released under the MIT Licence. Copyright © 2022, Tony Smith (@smittytone).
264+
All source code released under the MIT Licence. Copyright © 2022, Tony Smith (@smittytone).

phantoms/gfx.c

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
1010
#include "main.h"
1111

12+
extern uint8_t oled_height;
13+
extern uint8_t oled_width;
14+
extern uint8_t oled_i2c_addr;
15+
extern bool oled_inverted;
16+
extern Rect rects[7];
17+
extern Game game;
18+
extern uint8_t oled_buffer[1024];
19+
extern uint8_t temp_buffer[1024];
20+
extern uint8_t side_buffer[1024];
21+
extern uint8_t i2c_tx_buffer[1025];
22+
extern uint16_t oled_buffer_size;
23+
extern uint16_t i2c_tx_buffer_size;
24+
extern uint8_t *draw_buffer;
25+
extern uint8_t player_x;
26+
extern uint8_t player_y;
27+
extern uint8_t player_direction;
28+
1229

1330
/*
1431
* Wall perspective triangles

phantoms/gfx.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/

phantoms/main.c

+41-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,54 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
1010
#include "main.h"
1111

1212

13+
/*
14+
* GLOBALS
15+
*/
16+
uint8_t oled_height;
17+
uint8_t oled_width;
18+
uint8_t oled_i2c_addr;
19+
bool oled_inverted;
20+
21+
// Graphics buffer
22+
uint8_t oled_buffer[1024];
23+
uint8_t temp_buffer[1024];
24+
uint8_t side_buffer[1024];
25+
uint8_t i2c_tx_buffer[1025];
26+
uint16_t oled_buffer_size;
27+
uint16_t i2c_tx_buffer_size;
28+
29+
uint8_t *draw_buffer;
30+
31+
// Player
32+
uint8_t player_x;
33+
uint8_t player_y;
34+
uint8_t player_direction;
35+
36+
// Graphics structures
37+
Rect rects[7];
38+
39+
// Game data
40+
Phantom phantoms[3];
41+
Game game;
42+
43+
uint32_t last_draw;
44+
uint32_t last_phantom_move;
45+
bool chase_mode;
46+
bool map_mode;
47+
uint16_t high_score;
48+
49+
tinymt32_t tinymt_store;
50+
51+
1352
/*
1453
* Initialisation Functions
1554
*/

phantoms/main.h

-38
Original file line numberDiff line numberDiff line change
@@ -159,43 +159,5 @@ void show_scores();
159159
#define PHANTOM_WEST 8
160160

161161

162-
/*
163-
* GLOBALS
164-
*/
165-
uint8_t oled_height;
166-
uint8_t oled_width;
167-
uint8_t oled_i2c_addr;
168-
bool oled_inverted;
169-
170-
// Graphics buffer
171-
uint8_t oled_buffer[1024];
172-
uint8_t temp_buffer[1024];
173-
uint8_t side_buffer[1024];
174-
uint8_t i2c_tx_buffer[1025];
175-
uint16_t oled_buffer_size;
176-
uint16_t i2c_tx_buffer_size;
177-
178-
uint8_t *draw_buffer;
179-
180-
// Player
181-
uint8_t player_x;
182-
uint8_t player_y;
183-
uint8_t player_direction;
184-
185-
// Graphics structures
186-
Rect rects[7];
187-
188-
// Game data
189-
Phantom phantoms[3];
190-
Game game;
191-
192-
uint32_t last_draw;
193-
uint32_t last_phantom_move;
194-
bool chase_mode;
195-
bool map_mode;
196-
uint16_t high_score;
197-
198-
tinymt32_t tinymt_store;
199-
200162
// _PHANTOMS_MAIN_HEADER_
201163
#endif

phantoms/map.c

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
1010
#include "main.h"
1111

1212

13+
/*
14+
* GLOBALS
15+
*/
16+
// The current map data
17+
char *current_map[20];
18+
19+
20+
extern Game game;
21+
extern Phantom phantoms[3];
22+
extern uint8_t player_x;
23+
extern uint8_t player_y;
24+
extern uint8_t player_direction;
25+
26+
1327
/*
1428
* Define some basic maps for testing
1529
*/

phantoms/map.h

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
@@ -21,13 +21,6 @@ uint8_t get_square_contents(uint8_t x, uint8_t y);
2121
uint8_t get_view_distance(int8_t x, int8_t y, uint8_t direction);
2222

2323

24-
/*
25-
* GLOBALS
26-
*/
27-
// The current map data
28-
char *current_map[20];
29-
30-
3124
/*
3225
* CONSTANTS
3326
*/

phantoms/phantoms.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
1010
#include "main.h"
1111

12+
extern Game game;
13+
extern Phantom phantoms[3];
14+
extern uint8_t player_x;
15+
extern uint8_t player_y;
16+
extern uint8_t player_direction;
17+
1218

1319
/*
1420
* Basic Level Data

phantoms/ssd1306.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33
*
44
* @version 1.0.1
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
1010
#include "main.h"
1111

1212

13+
extern uint8_t oled_height;
14+
extern uint8_t oled_width;
15+
extern uint8_t oled_i2c_addr;
16+
extern bool oled_inverted;
17+
extern uint8_t oled_buffer[1024];
18+
extern uint8_t temp_buffer[1024];
19+
extern uint8_t side_buffer[1024];
20+
extern uint8_t i2c_tx_buffer[1025];
21+
extern uint16_t oled_buffer_size;
22+
extern uint16_t i2c_tx_buffer_size;
23+
extern uint8_t *draw_buffer;
24+
1325
/*
1426
* Ascii Text Character Set
1527
*/

phantoms/utils.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
/*
22
* Phantom Slayer
33
*
4-
* @version 1.0.2
4+
* @version 1.0.3
55
* @author smittytone
6-
* @copyright 2021, Tony Smith
6+
* @copyright 2024, Tony Smith
77
* @licence MIT
88
*
99
*/
1010
#include "main.h"
1111

1212

13+
extern Game game;
14+
extern tinymt32_t tinymt_store;
15+
16+
1317
int irandom(int start, int max) {
1418
// Randomise using TinyMT
1519
// https://github.com/MersenneTwister-Lab/TinyMT
@@ -85,4 +89,4 @@ void tone(unsigned int frequency_hz, unsigned long duration_ms, unsigned long po
8589

8690
// Apply a post-tone delay
8791
if (post_play_delay_ms > 0) sleep_ms(post_play_delay_ms);
88-
}
92+
}

0 commit comments

Comments
 (0)