Skip to content

Commit

Permalink
use int8/16 instead of char/long
Browse files Browse the repository at this point in the history
  • Loading branch information
splch committed Jan 8, 2022
1 parent 9e27bcd commit debac8e
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 104 deletions.
Binary file modified build/duck/Pirates Folly.duck
Binary file not shown.
Binary file modified build/gb/Pirates Folly.gb
Binary file not shown.
Binary file modified build/gbc/Pirates Folly.gbc
Binary file not shown.
Binary file modified build/gg/Pirates Folly.gg
Binary file not shown.
Binary file modified build/pocket/Pirates Folly.pocket
Binary file not shown.
Binary file modified build/sms/Pirates Folly.sms
Binary file not shown.
8 changes: 4 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ void init();
void update_switches();
void check_input();

// unsigned char SEED;
unsigned char buffer[32]; // for decompression
unsigned char map[DEVICE_SCREEN_WIDTH][DEVICE_SCREEN_HEIGHT];
// uint8_t SEED;
uint8_t buffer[32]; // for decompression
uint8_t map[DEVICE_SCREEN_WIDTH][DEVICE_SCREEN_HEIGHT];
struct Player p;
clock_t delay_time;

Expand Down Expand Up @@ -74,7 +74,7 @@ inline void update_switches() {
}

inline void check_input() {
const unsigned char j = joypad();
const uint8_t j = joypad();
// check interactions separately from movement
// makes delaying simple
check_interactions(j);
Expand Down
24 changes: 12 additions & 12 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
#include <stdio.h>
#include <time.h>

#define true 1
#define false 0
typedef int8_t bool;

// --- CONFIG --- //
// extern unsigned char SEED; // defined in init()
// extern uint8_t SEED; // defined in init()
#define SEED 57 // Macro is ~2x faster
#define SENSITIVITY 12 // CLOCKS_PER_SEC * t(s), so this is 60 * .2(s) = 12
#define START_POSITION 0
Expand All @@ -23,19 +27,15 @@
#define CENTER_Y_PX DEVICE_SCREEN_HEIGHT * 4
// ----------------- //

#define true 1
#define false 0
typedef char bool;

extern unsigned char map[DEVICE_SCREEN_WIDTH][DEVICE_SCREEN_HEIGHT];
extern uint8_t map[DEVICE_SCREEN_WIDTH][DEVICE_SCREEN_HEIGHT];

extern struct Player {
unsigned char x[2];
unsigned char y[2];
unsigned long steps;
char weapons[2];
unsigned char gold;
unsigned char maps;
uint8_t x[2];
uint8_t y[2];
uint16_t steps;
int8_t weapons[2];
uint8_t gold;
uint8_t maps;
} p;

extern clock_t delay_time;
Expand Down
Loading

0 comments on commit debac8e

Please sign in to comment.