[Maintenance] Define `bool` as unsigned

Wait, we can just do that, and nothing breaks?! All this time, we
could have avoided the `unsigned char` workaround???

Part of P0130, funded by Yanga.
This commit is contained in:
nmlgc 2020-12-11 21:40:40 +01:00
parent 6d69ea8152
commit 0bfff60a0a
15 changed files with 36 additions and 36 deletions

View File

@ -8,7 +8,7 @@
// __TURBOC__ is #define'd on both "Borland" and "Turbo" editions, unlike
// __BORLANDC__, which is only #define'd on the former.
#if defined(__TURBOC__) && defined(__MSDOS__)
typedef char bool;
typedef unsigned char bool;
typedef int bool16;
# define false 0
# define true 1

View File

@ -17,7 +17,7 @@ extern "C" {
extern int8_t* grp_buf;
extern int flag_palette_show; // = true
extern int flag_grp_put; // = true
extern unsigned char flag_grp_colorkey; // = false
extern bool flag_grp_colorkey; // = false
int grp_palette_load_show_sane(const char *fn)
{

View File

@ -1,5 +1,5 @@
/// Shared input macros
extern unsigned char input_shot;
extern bool input_shot;
extern bool input_ok;
#define input_func_bool(var) { var = true; } else { var = false; }
@ -11,13 +11,13 @@ extern bool input_ok;
#define INPUT_RIGHT 0x01
#define INPUT_LEFT 0x02
extern unsigned char input_up;
extern unsigned char input_down;
extern unsigned char input_lr;
extern unsigned char input_strike;
extern bool input_up;
extern bool input_down;
extern bool input_lr;
extern bool input_strike;
extern bool input_mem_enter;
extern bool input_mem_leave;
extern unsigned char paused;
extern bool paused;
extern bool done;
extern bool input_bomb;

View File

@ -129,7 +129,7 @@ protected:
}
public:
unsigned char moving;
bool moving;
unsigned char motion_type;
// Automatically calculated every frame for PM_SPIN

View File

@ -59,7 +59,7 @@ static const pixel_t SCORE_AND_CARDCOMBO_W = (CARDCOMBO_RIGHT - SCORE_LEFT);
/// -------
// Forces re-rendering of all full-width numbers on the HUD, even if they
// haven't changed since the last render call.
extern unsigned char fwnum_force_rerender;
extern bool fwnum_force_rerender;
// extern uint8_t *hud_bg;
extern uint8_t hud_bg_rle_run_byte;
@ -87,7 +87,7 @@ inline screen_x_t col_left(screen_x_t first_left, int col) {
#define digit_changed(var, var_prev, divisor) \
((var_prev / divisor) % 10) != ((var / divisor) % 10) || \
(fwnum_force_rerender == 1)
(fwnum_force_rerender == true)
// Copies the (⌊[w]/16⌋*16)×[ROW_H] pixels starting at (⌊left/8⌋*8, top) from
// VRAM page 0 to VRAM page 1.

View File

@ -24,8 +24,8 @@ inline screen_y_t player_anim_forward_top(void) {
void player_move_and_clamp(int delta);
void invincibility_sprites_update_and_render(bool16 invincible);
extern unsigned char player_deflecting;
extern unsigned char player_sliding;
extern bool player_deflecting;
extern bool player_sliding;
extern bool16 player_invincible;
extern int lives;

View File

@ -11,7 +11,7 @@ struct CShots {
int unknown[SHOT_COUNT];
// A shot slot can be considered "alive" if either of these are nonzero.
unsigned char moving[SHOT_COUNT];
bool moving[SHOT_COUNT];
unsigned char decay_frame[SHOT_COUNT];
void add(screen_x_t new_left, screen_y_t new_top);

View File

@ -7,6 +7,6 @@ extern char credit_bombs;
extern char lives_extra;
extern char stage_num;
extern unsigned char first_stage_in_scene;
extern bool first_stage_in_scene;
extern unsigned long score;

View File

@ -64,13 +64,13 @@ char angle[MUSIC_POLYGONS];
char rot_speed[MUSIC_POLYGONS];
unsigned char music_sel;
unsigned char music_page;
page_t music_page;
dots8_t *screen_back_B;
dots8_t *cmt_back[PL_COUNT];
void pascal near draw_track(unsigned char sel, unsigned char color)
{
unsigned char other_page = 1 - music_page;
page_t other_page = (1 - music_page);
graph_accesspage(other_page);
graph_putsa_fx(
16, ((sel + 6) * GLYPH_H), (color | FX_WEIGHT_BOLD), MUSIC_TITLES[sel]
@ -320,7 +320,7 @@ controls:
}
if(key_det & INPUT_SHOT || key_det & INPUT_OK) {
if(music_sel != SEL_QUIT) {
char midi_active = snd_midi_active;
bool midi_active = snd_midi_active;
snd_midi_active = snd_midi_possible;
snd_load(MUSIC_FILES[music_sel], SND_LOAD_SONG);

View File

@ -1,2 +1,2 @@
char snd_active = 0;
bool snd_active = 0;
char snd_unused = 0;

View File

@ -1,7 +1,7 @@
#include "defconv.h"
extern char snd_interrupt_if_midi;
extern char snd_midi_possible;
extern bool snd_midi_possible;
#if GAME <= 3
typedef enum {
SND_BGM_OFF,
@ -9,9 +9,9 @@ extern char snd_midi_possible;
SND_BGM_MIDI
} snd_bgm_mode_t;
extern char snd_active;
extern unsigned char snd_midi_active;
extern char snd_fm_possible;
extern bool snd_active;
extern bool snd_midi_active;
extern bool snd_fm_possible;
#endif
int snd_pmd_resident(void);

View File

@ -100,7 +100,7 @@ typedef struct {
int unused_1;
char unused_2;
unsigned char op_main_retval;
unsigned char perf;
bool perf;
char unused_3;
char shottype;
char demo_num;

View File

@ -8904,7 +8904,7 @@ include th02/formats/pi_load.asm
extern @MRS_LOAD$QINXC:proc
extern @MRS_FREE$QI:proc
extern @MRS_PUT_8$QIUII:proc
extern @MRS_PUT_NOALPHA_8$QIUIIC:proc
extern @MRS_PUT_NOALPHA_8$QIUIIUC:proc
extern @MRS_HFLIP$QI:proc
SPRITE16_SPRITES_COMMIT procdesc pascal far
SPRITE16_PUT procdesc pascal far \
@ -18944,7 +18944,7 @@ loc_14967:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
mov al, [bp+@@frame]
mov ah, 0
mov bx, 8
@ -20079,7 +20079,7 @@ loc_152D7:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
jmp short loc_15323
; ---------------------------------------------------------------------------
@ -21159,7 +21159,7 @@ loc_15C32:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
jmp short loc_15CB0
; ---------------------------------------------------------------------------
@ -23892,7 +23892,7 @@ loc_172FF:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
jmp short loc_1737D
; ---------------------------------------------------------------------------
@ -26162,7 +26162,7 @@ loc_18526:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
jmp short loc_185A3
; ---------------------------------------------------------------------------
@ -26551,7 +26551,7 @@ loc_188B2:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
mov al, [bp+@@frame]
mov ah, 0
mov bx, 4
@ -26797,7 +26797,7 @@ loc_18B3D:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
call egc_on
jmp short @@ret
; ---------------------------------------------------------------------------
@ -27017,7 +27017,7 @@ loc_18D42:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
jmp short loc_18DBF
; ---------------------------------------------------------------------------
@ -27154,7 +27154,7 @@ loc_18E7C:
mov al, _pid_current
mov ah, 0
push ax ; altered_colors
call @mrs_put_noalpha_8$qiuiic
call @mrs_put_noalpha_8$qiuiiuc
call grcg_setcolor pascal, (GC_RMW shl 16) + 15
mov ax, 900h
sub ax, word_220EC

View File

@ -51,7 +51,7 @@ typedef struct {
unsigned long slow_frames;
unsigned long frames; // (including bosses, see th04/frames.h)
bool zunsoft_shown;
unsigned char turbo_mode;
bool turbo_mode;
int8_t unused_5[182];
} resident_t;

View File

@ -13,7 +13,7 @@ typedef struct {
unsigned char stage;
unsigned char playchar;
unsigned char se_mode;
unsigned char turbo_mode;
bool turbo_mode;
bool debug;
unsigned char debug_stage;
unsigned char debug_power;