From 676ee004fe43502db25ec598b346fd7185644c73 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 13 May 2019 15:18:33 +0100 Subject: [PATCH] Removed the dependency on stdint.h This doesn't exist in MSVC2003, and nothing in the Linux port's debug symbols indicate Pixel used it. --- src/Boss.cpp | 1 - src/BulHit.cpp | 2 +- src/Bullet.h | 8 +++----- src/Config.cpp | 1 - src/Config.h | 14 ++++++------- src/Draw.cpp | 13 ++++++------ src/Draw.h | 10 ++++----- src/Ending.cpp | 5 ++--- src/Ending.h | 2 -- src/Frame.cpp | 6 +++--- src/Generic.cpp | 3 +-- src/Generic.h | 4 +--- src/Input.cpp | 5 ++--- src/Main.cpp | 1 - src/Map.cpp | 7 +++---- src/Map.h | 14 ++++++------- src/MapName.cpp | 1 - src/MiniMap.cpp | 3 +-- src/MiniMap.h | 2 -- src/MyChar.cpp | 1 - src/MyChar.h | 2 -- src/MycHit.cpp | 2 -- src/MycParam.h | 6 ++---- src/NpChar.cpp | 8 +++----- src/NpChar.h | 20 ++++++++---------- src/NpcTbl.h | 26 +++++++++++------------- src/Organya.cpp | 53 ++++++++++++++++++++++++------------------------ src/Organya.h | 24 ++++++++++------------ src/Profile.cpp | 1 - src/Profile.h | 12 +++++------ src/Sound.cpp | 23 ++++++++++----------- src/Sound.h | 19 ++++++++--------- src/Stage.cpp | 1 - src/TextScr.cpp | 9 ++++---- src/TextScr.h | 6 ++---- src/Triangle.cpp | 15 +++++++------- src/Triangle.h | 8 +++----- 37 files changed, 143 insertions(+), 195 deletions(-) diff --git a/src/Boss.cpp b/src/Boss.cpp index 3e5d8c66..86b17aec 100644 --- a/src/Boss.cpp +++ b/src/Boss.cpp @@ -1,6 +1,5 @@ #include "Boss.h" -#include #include #include "WindowsWrapper.h" diff --git a/src/BulHit.cpp b/src/BulHit.cpp index 0997b69d..df8330a2 100644 --- a/src/BulHit.cpp +++ b/src/BulHit.cpp @@ -45,7 +45,7 @@ int JudgeHitBulletBlock(int x, int y, BULLET *bul) return hit; } -int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul) +int JudgeHitBulletBlock2(int x, int y, unsigned char *atrb, BULLET *bul) { int i; int workX; diff --git a/src/Bullet.h b/src/Bullet.h index 8b31da37..5e08a593 100644 --- a/src/Bullet.h +++ b/src/Bullet.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" struct BULLET @@ -20,7 +18,7 @@ struct BULLET int act_wait; int ani_wait; int ani_no; - uint8_t direct; + unsigned char direct; RECT rect; int count1; int count2; @@ -36,8 +34,8 @@ struct BULLET struct BULLET_TABLE { - int8_t damage; - int8_t life; + signed char damage; + signed char life; int life_count; int bbits; int enemyXL; diff --git a/src/Config.cpp b/src/Config.cpp index d28ec25e..909948e3 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/src/Config.h b/src/Config.h index c61e1947..fda14622 100644 --- a/src/Config.h +++ b/src/Config.h @@ -1,19 +1,17 @@ #pragma once -#include - #include "WindowsWrapper.h" struct CONFIG { char proof[0x20]; char font_name[0x40]; - int32_t move_button_mode; - int32_t attack_button_mode; - int32_t ok_button_mode; - int32_t display_mode; - int32_t bJoystick; - int32_t joystick_button[8]; + long move_button_mode; + long attack_button_mode; + long ok_button_mode; + long display_mode; + long bJoystick; + long joystick_button[8]; }; BOOL LoadConfigData(CONFIG *conf); diff --git a/src/Draw.cpp b/src/Draw.cpp index d5fe7024..d7d46c35 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -57,8 +56,8 @@ BOOL Flip_SystemTask() return FALSE; // Framerate limiter - static uint32_t timePrev; - const uint32_t timeNow = SDL_GetTicks(); + static Uint32 timePrev; + const Uint32 timeNow = SDL_GetTicks(); if (timeNow >= timePrev + FRAMERATE) { @@ -485,7 +484,7 @@ unsigned long GetCortBoxColor(unsigned long col) return col; } -void CortBox(RECT *rect, uint32_t col) +void CortBox(RECT *rect, unsigned long col) { // Get rect SDL_Rect destRect = RectToSDLRectScaled(rect); @@ -498,7 +497,7 @@ void CortBox(RECT *rect, uint32_t col) SDL_RenderFillRect(gRenderer, &destRect); } -void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no) +void CortBox2(RECT *rect, unsigned long col, Surface_Ids surf_no) { // Get rect SDL_Rect destRect = RectToSDLRectScaled(rect); @@ -610,7 +609,7 @@ void InitTextObject(const char *font_name) gFont = LoadFontFromData(res_data, data_size, fontWidth, fontHeight); } -void PutText(int x, int y, const char *text, uint32_t color) +void PutText(int x, int y, const char *text, unsigned long color) { int surface_width, surface_height; SDL_GetRendererOutputSize(gRenderer, &surface_width, &surface_height); @@ -626,7 +625,7 @@ void PutText(int x, int y, const char *text, uint32_t color) SDL_DestroyTexture(screen_texture); } -void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no) +void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no) { DrawText(gFont, (unsigned char*)surf[surf_no].surface->pixels, surf[surf_no].surface->pitch, surf[surf_no].surface->w, surf[surf_no].surface->h, x * magnification, y * magnification, color, text, strlen(text)); surf[surf_no].needs_updating = true; diff --git a/src/Draw.h b/src/Draw.h index 2cc30aeb..9ba82618 100644 --- a/src/Draw.h +++ b/src/Draw.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" #ifndef RGB @@ -68,9 +66,9 @@ void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no); void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no); void Surface2Surface(int x, int y, RECT *rect, int to, int from); unsigned long GetCortBoxColor(unsigned long col); -void CortBox(RECT *rect, uint32_t col); -void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no); +void CortBox(RECT *rect, unsigned long col); +void CortBox2(RECT *rect, unsigned long col, Surface_Ids surf_no); void InitTextObject(const char *font_name); -void PutText(int x, int y, const char *text, uint32_t color); -void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no); +void PutText(int x, int y, const char *text, unsigned long color); +void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no); void EndTextObject(); diff --git a/src/Ending.cpp b/src/Ending.cpp index df7751be..55949d9d 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -1,6 +1,5 @@ #include "Ending.h" -#include #include #include #include @@ -184,7 +183,7 @@ bool StartCreditScript() // Read data fread(Credit.pData, 1, Credit.size, fp); - EncryptionBinaryData2((uint8_t*)Credit.pData, Credit.size); + EncryptionBinaryData2((unsigned char*)Credit.pData, Credit.size); #ifdef FIX_BUGS // The original game forgot to close the file @@ -229,7 +228,7 @@ void ActionCredit_Read() while (Credit.offset < Credit.size) { // Get character - uint8_t character = Credit.pData[Credit.offset]; + unsigned char character = Credit.pData[Credit.offset]; int a, b, len; switch (character) diff --git a/src/Ending.h b/src/Ending.h index a490e027..3c38ae2b 100644 --- a/src/Ending.h +++ b/src/Ending.h @@ -1,7 +1,5 @@ #pragma once -#include - struct CREDIT { int size; diff --git a/src/Frame.cpp b/src/Frame.cpp index 2a148902..d5b3589a 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -13,7 +13,7 @@ FRAME gFrame; void MoveFrame3() { - int16_t map_w, map_l; + short map_w, map_l; GetMapData(0, &map_w, &map_l); #if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // TODO - Really need to make this a compiler flag @@ -119,7 +119,7 @@ void SetFramePosition(int fx, int fy) gFrame.quake2 = 0; //Move frame position - int16_t map_w, map_l; + short map_w, map_l; GetMapData(0, &map_w, &map_l); gFrame.x = fx; @@ -143,7 +143,7 @@ void SetFrameMyChar() int mc_x, mc_y; GetMyCharPosition(&mc_x, &mc_y); - int16_t map_w, map_l; + short map_w, map_l; GetMapData(0, &map_w, &map_l); gFrame.x = mc_x - (WINDOW_WIDTH << 8); diff --git a/src/Generic.cpp b/src/Generic.cpp index 8df62660..b996ade8 100644 --- a/src/Generic.cpp +++ b/src/Generic.cpp @@ -1,6 +1,5 @@ #include "Generic.h" -#include #include #include "CommonDefines.h" @@ -45,7 +44,7 @@ bool CheckFileExists(const char *name) return false; } -bool IsShiftJIS(uint8_t c) +bool IsShiftJIS(unsigned char c) { if (c > 0x80 && c < 0xA0) return true; diff --git a/src/Generic.h b/src/Generic.h index e8074046..175df9a4 100644 --- a/src/Generic.h +++ b/src/Generic.h @@ -1,8 +1,6 @@ #pragma once -#include - bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4); long GetFileSizeLong(const char *path); bool CheckFileExists(const char *name); -bool IsShiftJIS(uint8_t c); +bool IsShiftJIS(unsigned char c); diff --git a/src/Input.cpp b/src/Input.cpp index ceda59b4..0c6e936a 100644 --- a/src/Input.cpp +++ b/src/Input.cpp @@ -1,7 +1,6 @@ #include "Input.h" #include -#include #include #include @@ -51,8 +50,8 @@ bool GetJoystickStatus(JOYSTICK_STATUS *pStatus) if (joystick) { - int32_t x = SDL_JoystickGetAxis(joystick, 0); - int32_t y = SDL_JoystickGetAxis(joystick, 1); + Sint16 x = SDL_JoystickGetAxis(joystick, 0); + Sint16 y = SDL_JoystickGetAxis(joystick, 1); pStatus->bLeft = x <= -JOYSTICK_DEADZONE; pStatus->bRight = x >= JOYSTICK_DEADZONE; pStatus->bUp = y <= -JOYSTICK_DEADZONE; diff --git a/src/Main.cpp b/src/Main.cpp index 87d32b45..bc136be2 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1,7 +1,6 @@ #include "Main.h" #include -#include #include #include diff --git a/src/Map.cpp b/src/Map.cpp index 7d804764..94bec202 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -1,7 +1,6 @@ #include "Map.h" #include -#include #include #include @@ -21,7 +20,7 @@ static const char *code_pxma = "PXM"; BOOL InitMapData2() { - gMap.data = (uint8_t*)malloc(PXM_BUFFER_SIZE); + gMap.data = (unsigned char*)malloc(PXM_BUFFER_SIZE); return TRUE; } @@ -103,7 +102,7 @@ void ReleasePartsImage() ReleaseSurface(SURFACE_ID_LEVEL_TILESET); } -void GetMapData(uint8_t **data, int16_t *mw, int16_t *ml) +void GetMapData(unsigned char **data, short *mw, short *ml) { if (data) *data = gMap.data; @@ -132,7 +131,7 @@ void ShiftMapParts(int x, int y) *(gMap.data + x + gMap.width * y) -= 1; } -BOOL ChangeMapParts(int x, int y, uint8_t no) +BOOL ChangeMapParts(int x, int y, unsigned char no) { if (*(gMap.data + x + gMap.width * y) == no) return FALSE; diff --git a/src/Map.h b/src/Map.h index 858fa998..d5a72f40 100644 --- a/src/Map.h +++ b/src/Map.h @@ -1,15 +1,13 @@ #pragma once -#include - #include "WindowsWrapper.h" struct MAP_DATA { - uint8_t *data; - uint8_t atrb[0x101]; //Why is this 257 bytes? - int16_t width; - int16_t length; + unsigned char *data; + unsigned char atrb[0x101]; //Why is this 257 bytes? + short width; + short length; }; extern MAP_DATA gMap; @@ -19,11 +17,11 @@ BOOL LoadMapData2(const char *path_map); BOOL LoadAttributeData(const char *path_atrb); void EndMapData(); void ReleasePartsImage(); -void GetMapData(uint8_t **data, int16_t *mw, int16_t *ml); +void GetMapData(unsigned char **data, short *mw, short *ml); unsigned char GetAttribute(int x, int y); void DeleteMapParts(int x, int y); void ShiftMapParts(int x, int y); -BOOL ChangeMapParts(int x, int y, uint8_t no); +BOOL ChangeMapParts(int x, int y, unsigned char no); void PutStage_Back(int fx, int fy); void PutStage_Front(int fx, int fy); void PutMapDataVector(int fx, int fy); diff --git a/src/MapName.cpp b/src/MapName.cpp index 4bcd80bc..0a40ab79 100644 --- a/src/MapName.cpp +++ b/src/MapName.cpp @@ -1,6 +1,5 @@ #include "MapName.h" -#include #include #include "CommonDefines.h" diff --git a/src/MiniMap.cpp b/src/MiniMap.cpp index 70c0e4b8..9d3800f6 100644 --- a/src/MiniMap.cpp +++ b/src/MiniMap.cpp @@ -1,6 +1,5 @@ #include "MiniMap.h" -#include #include #include "WindowsWrapper.h" @@ -127,7 +126,7 @@ int MiniMapLoop() CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP); int line = 0; - uint8_t my_wait = 0; + unsigned char my_wait = 0; while (true) { GetTrg(); diff --git a/src/MiniMap.h b/src/MiniMap.h index 0b0b0c3f..1391b27d 100644 --- a/src/MiniMap.h +++ b/src/MiniMap.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" extern char gMapping[0x80]; diff --git a/src/MyChar.cpp b/src/MyChar.cpp index 25f2ebc7..fb8b2dda 100644 --- a/src/MyChar.cpp +++ b/src/MyChar.cpp @@ -1,6 +1,5 @@ #include "MyChar.h" -#include #include #include "WindowsWrapper.h" diff --git a/src/MyChar.h b/src/MyChar.h index 252fcf68..797a6e92 100644 --- a/src/MyChar.h +++ b/src/MyChar.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" struct MYCHAR diff --git a/src/MycHit.cpp b/src/MycHit.cpp index 1b5a0ab5..3e52aa7a 100644 --- a/src/MycHit.cpp +++ b/src/MycHit.cpp @@ -1,7 +1,5 @@ #include "MycHit.h" -#include - #include "WindowsWrapper.h" #include "Back.h" diff --git a/src/MycParam.h b/src/MycParam.h index 901baf84..dba718e9 100644 --- a/src/MycParam.h +++ b/src/MycParam.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" struct ARMS_LEVEL @@ -11,8 +9,8 @@ struct ARMS_LEVEL struct REC { - int32_t counter[4]; - uint8_t random[4]; + long counter[4]; + unsigned char random[4]; }; extern ARMS_LEVEL gArmsLevelTable[14]; diff --git a/src/NpChar.cpp b/src/NpChar.cpp index 8b12248f..7afd2dcb 100644 --- a/src/NpChar.cpp +++ b/src/NpChar.cpp @@ -1,7 +1,6 @@ #include "NpChar.h" #include -#include #include #include @@ -239,12 +238,11 @@ void SetExpObjects(int x, int y, int exp) BOOL SetBulletObject(int x, int y, int val) { - int t; + int t = 0; + int bullet_no; int tamakazu_ari[10]; int n; - int bullet_no; - t = 0; memset(tamakazu_ari, 0, sizeof(tamakazu_ari)); for (n = 0; n < 8; ++n) { @@ -297,7 +295,7 @@ BOOL SetLifeObject(int x, int y, int val) return FALSE; memset(&gNPC[n], 0, sizeof(NPCHAR)); - gNPC[n].cond |= 0x80u; + gNPC[n].cond |= 0x80; gNPC[n].direct = 0; gNPC[n].code_char = 87; gNPC[n].x = x; diff --git a/src/NpChar.h b/src/NpChar.h index abf0dcbd..b60eed51 100644 --- a/src/NpChar.h +++ b/src/NpChar.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" #include "Draw.h" @@ -29,7 +27,7 @@ enum NPC_flags struct NPCHAR { - uint8_t cond; + unsigned char cond; int flag; int x; int y; @@ -49,7 +47,7 @@ struct NPCHAR int exp; int size; int direct; - uint16_t bits; + unsigned short bits; RECT rect; int ani_wait; int ani_no; @@ -59,7 +57,7 @@ struct NPCHAR int act_wait; RECT hit; RECT view; - uint8_t shock; + unsigned char shock; int damage_view; int damage; NPCHAR *pNpc; @@ -67,12 +65,12 @@ struct NPCHAR struct EVENT { - int16_t x; - int16_t y; - int16_t code_flag; - int16_t code_event; - int16_t code_char; - uint16_t bits; + short x; + short y; + short code_flag; + short code_event; + short code_char; + unsigned short bits; }; extern NPCHAR gNPC[NPC_MAX]; diff --git a/src/NpcTbl.h b/src/NpcTbl.h index 981df470..121cc711 100644 --- a/src/NpcTbl.h +++ b/src/NpcTbl.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" #include "Draw.h" @@ -9,22 +7,22 @@ struct NPC_TBL_RECT { - uint8_t front; - uint8_t top; - uint8_t back; - uint8_t bottom; + unsigned char front; + unsigned char top; + unsigned char back; + unsigned char bottom; }; struct NPC_TABLE { - uint16_t bits; - uint16_t life; - uint8_t surf; - uint8_t hit_voice; - uint8_t destroy_voice; - uint8_t size; - int32_t exp; - int32_t damage; + unsigned short bits; + unsigned short life; + unsigned char surf; + unsigned char hit_voice; + unsigned char destroy_voice; + unsigned char size; + long exp; + long damage; NPC_TBL_RECT hit; NPC_TBL_RECT view; }; diff --git a/src/Organya.cpp b/src/Organya.cpp index fa74131f..a57aa12e 100644 --- a/src/Organya.cpp +++ b/src/Organya.cpp @@ -1,7 +1,6 @@ #include "Organya.h" #include -#include #include #include @@ -33,7 +32,7 @@ int gTrackVol[MAXTRACK]; int gOrgVolume = 100; bool bFadeout = false; -bool OrganyaNoteAlloc(uint16_t alloc) +bool OrganyaNoteAlloc(unsigned short alloc) { for(int j = 0; j < MAXTRACK; j++) { @@ -110,7 +109,7 @@ OCTWAVE oct_wave[8] = { { 8,128, 32 }, //7 Oct }; -bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi) +bool MakeSoundObject8(signed char *wavep, signed char track, signed char pipi) { for (int j = 0; j < 8; j++) { @@ -123,13 +122,13 @@ bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi) lpORGANBUFFER[track][j][k] = new SOUNDBUFFER(data_size); //Get wave data - uint8_t *wp = new uint8_t[data_size]; - uint8_t *wp_sub = wp; + unsigned char *wp = new unsigned char[data_size]; + unsigned char *wp_sub = wp; size_t wav_tp = 0; for (size_t i = 0; i < data_size; i++) { - uint8_t work = *(wavep+wav_tp); + unsigned char work = *(wavep+wav_tp); work += 0x80; *wp_sub = work; @@ -142,7 +141,7 @@ bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi) } //Copy wave data to sound buffer - uint8_t *buf; + unsigned char *buf; lpORGANBUFFER[track][j][k]->Lock(&buf, NULL); memcpy(buf, wp, data_size); lpORGANBUFFER[track][j][k]->Unlock(); @@ -157,7 +156,7 @@ bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi) //Playing melody tracks short freq_tbl[12] = { 262,277,294,311,330,349,370,392,415,440,466,494 }; -void ChangeOrganFrequency(uint8_t key, int8_t track, int32_t a) +void ChangeOrganFrequency(unsigned char key, signed char track, long a) { for (int j = 0; j < 8; j++) { for (int i = 0; i < 2; i++) { @@ -166,24 +165,24 @@ void ChangeOrganFrequency(uint8_t key, int8_t track, int32_t a) } } -int16_t pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512}; -uint8_t old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; -uint8_t key_on[MAXTRACK] = {0}; -uint8_t key_twin[MAXTRACK] = {0}; +short pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512}; +unsigned char old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +unsigned char key_on[MAXTRACK] = {0}; +unsigned char key_twin[MAXTRACK] = {0}; -void ChangeOrganPan(uint8_t key, uint8_t pan, int8_t track) +void ChangeOrganPan(unsigned char key, unsigned char pan, signed char track) { if(old_key[track] != PANDUMMY) lpORGANBUFFER[track][old_key[track]/12][key_twin[track]]->SetPan((pan_tbl[pan] - 0x100) * 10); } -void ChangeOrganVolume(int no, int32_t volume, int8_t track) +void ChangeOrganVolume(int no, long volume, signed char track) { if(old_key[track] != VOLDUMMY) lpORGANBUFFER[track][old_key[track]/12][key_twin[track]]->SetVolume((volume - 0xFF) * 8); } -void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq) +void PlayOrganObject(unsigned char key, int mode, signed char track, long freq) { if (lpORGANBUFFER[track][key/12][key_twin[track]] != NULL) { @@ -240,7 +239,7 @@ void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq) } //Release tracks -void ReleaseOrganyaObject(int8_t track) +void ReleaseOrganyaObject(signed char track) { for(int i = 0; i < 8; i++) { @@ -258,7 +257,7 @@ void ReleaseOrganyaObject(int8_t track) } //Handling WAVE100 -int8_t wave_data[100][0x100]; +signed char wave_data[100][0x100]; BOOL InitWaveData100() { @@ -273,7 +272,7 @@ BOOL InitWaveData100() } //Create org wave -bool MakeOrganyaWave(int8_t track, int8_t wave_no, int8_t pipi) +bool MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi) { if(wave_no > 99) { @@ -287,17 +286,17 @@ bool MakeOrganyaWave(int8_t track, int8_t wave_no, int8_t pipi) } //Dram -void ChangeDramFrequency(uint8_t key, int8_t track) +void ChangeDramFrequency(unsigned char key, signed char track) { lpDRAMBUFFER[track]->SetFrequency(key * 800 + 100); } -void ChangeDramPan(uint8_t pan, int8_t track) +void ChangeDramPan(unsigned char pan, signed char track) { lpDRAMBUFFER[track]->SetPan((pan_tbl[pan] - 0x100) * 10); } -void ChangeDramVolume(int32_t volume, int8_t track) +void ChangeDramVolume(long volume, signed char track) { lpDRAMBUFFER[track]->SetVolume((volume - 0xFF) * 8); } @@ -324,9 +323,9 @@ void PlayDramObject(unsigned char key, int mode, signed char track) } //Play data -int32_t play_p; +long play_p; NOTELIST *play_np[MAXTRACK]; -int32_t now_leng[MAXMELODY] = {0}; +long now_leng[MAXMELODY] = {0}; void OrganyaPlayData() { @@ -393,7 +392,7 @@ void OrganyaPlayData() } } -void SetPlayPointer(int32_t x) +void SetPlayPointer(long x) { for (int i = 0; i < MAXTRACK; i++) { @@ -428,7 +427,7 @@ void LoadOrganya(const char *name) const unsigned char *p = FindResource(name, "ORG", NULL); //Version Check - uint8_t ver = 0; + unsigned char ver = 0; char pass_check[6]; memcpy(pass_check, p, 6); @@ -454,7 +453,7 @@ void LoadOrganya(const char *name) for (int i = 0; i < 16; i++) { info.tdata[i].freq = READ_LE16(p); info.tdata[i].wave_no = *p++; - const int8_t pipi = *p++; + const signed char pipi = *p++; info.tdata[i].pipi = ver == 1 ? 0 : pipi; info.tdata[i].note_num = READ_LE16(p); } @@ -586,7 +585,7 @@ int OrganyaPlayTimer(void *ptr) SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); //Set time for next step to play - uint32_t NextTick = SDL_GetTicks() + info.wait; + Uint32 NextTick = SDL_GetTicks() + info.wait; while (bEndTimer == false) { diff --git a/src/Organya.h b/src/Organya.h index dbf43c5d..75b53d3a 100644 --- a/src/Organya.h +++ b/src/Organya.h @@ -1,13 +1,11 @@ #pragma once -#include - //Below are Organya song data structures struct NOTELIST { NOTELIST *from; //Previous address NOTELIST *to; //Next address - int32_t x; //Position + long x; //Position unsigned char length; //Sound length unsigned char y; //Sound height unsigned char volume; //Volume @@ -16,10 +14,10 @@ struct NOTELIST { //Track data * 8 struct TRACKDATA { - uint16_t freq; //Frequency (1000 is default) - uint8_t wave_no; //Waveform No. - int8_t pipi; - uint16_t note_num; //Number of notes + unsigned short freq; //Frequency (1000 is default) + unsigned char wave_no; //Waveform No. + signed char pipi; + unsigned short note_num; //Number of notes NOTELIST *note_p; NOTELIST *note_list; @@ -27,20 +25,20 @@ struct TRACKDATA { //Unique information held in songs struct MUSICINFO { - uint16_t wait; + unsigned short wait; bool loaded; bool playing; unsigned char line; //Number of lines in one measure unsigned char dot; //Number of dots per line - uint16_t alloc_note; //Number of allocated notes - int32_t repeat_x; //Repeat - int32_t end_x; //End of song (Return to repeat) + unsigned short alloc_note; //Number of allocated notes + long repeat_x; //Repeat + long end_x; //End of song (Return to repeat) TRACKDATA tdata[16]; }; -bool MakeOrganyaWave(int8_t track, int8_t wave_no, int8_t pipi); +bool MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi); void OrganyaPlayData(); -void SetPlayPointer(int32_t x); +void SetPlayPointer(long x); void LoadOrganya(const char *name); void SetOrganyaPosition(unsigned int x); unsigned int GetOrganyaPosition(); diff --git a/src/Profile.cpp b/src/Profile.cpp index 91fa8611..56d63925 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -1,7 +1,6 @@ #include "Profile.h" #include -#include #include #include diff --git a/src/Profile.h b/src/Profile.h index 957cae11..8c4a1947 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" #include "ArmsItem.h" @@ -15,10 +13,10 @@ struct PROFILE int x; int y; int direct; - int16_t max_life; - int16_t star; - int16_t life; - int16_t a; + short max_life; + short star; + short life; + short a; int select_arms; int select_item; int equip; @@ -29,7 +27,7 @@ struct PROFILE PERMIT_STAGE permitstage[8]; signed char permit_mapping[0x80]; char FLAG[4]; - uint8_t flags[1000]; + unsigned char flags[1000]; }; BOOL IsProfile(); diff --git a/src/Sound.cpp b/src/Sound.cpp index 037f91b0..9d2e6526 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -48,7 +47,7 @@ SOUNDBUFFER::SOUNDBUFFER(size_t bufSize) samplePosition = 0.0; //Create waveform buffer - data = new uint8_t[bufSize]; + data = new unsigned char[bufSize]; memset(data, 0x80, bufSize); //Add to buffer list @@ -88,7 +87,7 @@ void SOUNDBUFFER::Release() delete this; } -void SOUNDBUFFER::Lock(uint8_t **outBuffer, size_t *outSize) +void SOUNDBUFFER::Lock(unsigned char **outBuffer, size_t *outSize) { SDL_LockAudioDevice(audioDevice); @@ -104,35 +103,35 @@ void SOUNDBUFFER::Unlock() SDL_UnlockAudioDevice(audioDevice); } -void SOUNDBUFFER::SetCurrentPosition(uint32_t dwNewPosition) +void SOUNDBUFFER::SetCurrentPosition(unsigned long dwNewPosition) { SDL_LockAudioDevice(audioDevice); samplePosition = dwNewPosition; SDL_UnlockAudioDevice(audioDevice); } -void SOUNDBUFFER::SetFrequency(uint32_t dwFrequency) +void SOUNDBUFFER::SetFrequency(unsigned long dwFrequency) { SDL_LockAudioDevice(audioDevice); frequency = (double)dwFrequency; SDL_UnlockAudioDevice(audioDevice); } -float MillibelToVolume(int32_t lVolume) +float MillibelToVolume(long lVolume) { //Volume is in hundredths of decibels, from 0 to -10000 - lVolume = clamp(lVolume, (int32_t)-10000, (int32_t)0); + lVolume = clamp(lVolume, (long)-10000, (long)0); return (float)pow(10.0, lVolume / 2000.0); } -void SOUNDBUFFER::SetVolume(int32_t lVolume) +void SOUNDBUFFER::SetVolume(long lVolume) { SDL_LockAudioDevice(audioDevice); volume = MillibelToVolume(lVolume); SDL_UnlockAudioDevice(audioDevice); } -void SOUNDBUFFER::SetPan(int32_t lPan) +void SOUNDBUFFER::SetPan(long lPan) { SDL_LockAudioDevice(audioDevice); volume_l = MillibelToVolume(-lPan); @@ -288,19 +287,19 @@ void PlaySoundObject(int no, int mode) } } -void ChangeSoundFrequency(int no, uint32_t rate) +void ChangeSoundFrequency(int no, unsigned long rate) { if (lpSECONDARYBUFFER[no]) lpSECONDARYBUFFER[no]->SetFrequency(10 * rate + 100); } -void ChangeSoundVolume(int no, int32_t volume) +void ChangeSoundVolume(int no, long volume) { if (lpSECONDARYBUFFER[no]) lpSECONDARYBUFFER[no]->SetVolume(8 * volume - 2400); } -void ChangeSoundPan(int no, int32_t pan) +void ChangeSoundPan(int no, long pan) { if (lpSECONDARYBUFFER[no]) lpSECONDARYBUFFER[no]->SetPan(10 * (pan - 256)); diff --git a/src/Sound.h b/src/Sound.h index d432059a..3eeb732d 100644 --- a/src/Sound.h +++ b/src/Sound.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include "PixTone.h" @@ -13,13 +12,13 @@ class SOUNDBUFFER void Release(); - void Lock(uint8_t **buffer, size_t *size); + void Lock(unsigned char **buffer, size_t *size); void Unlock(); - void SetCurrentPosition(uint32_t dwNewPosition); - void SetFrequency(uint32_t dwFrequency); - void SetVolume(int32_t lVolume); - void SetPan(int32_t lPan); + void SetCurrentPosition(unsigned long dwNewPosition); + void SetFrequency(unsigned long dwFrequency); + void SetVolume(long lVolume); + void SetPan(long lPan); void Play(bool bLooping); void Stop(); @@ -28,7 +27,7 @@ class SOUNDBUFFER SOUNDBUFFER *next; private: - uint8_t *data; + unsigned char *data; size_t size; bool playing; @@ -95,7 +94,7 @@ extern SOUNDBUFFER* lpSECONDARYBUFFER[SOUND_NO]; bool InitDirectSound(); void EndDirectSound(); void PlaySoundObject(int no, int mode); -void ChangeSoundFrequency(int no, uint32_t rate); -void ChangeSoundVolume(int no, int32_t volume); -void ChangeSoundPan(int no, int32_t pan); +void ChangeSoundFrequency(int no, unsigned long rate); +void ChangeSoundVolume(int no, long volume); +void ChangeSoundPan(int no, long pan); int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no); diff --git a/src/Stage.cpp b/src/Stage.cpp index 54bdbadb..c8424bb6 100644 --- a/src/Stage.cpp +++ b/src/Stage.cpp @@ -1,6 +1,5 @@ #include "Stage.h" -#include #include #include diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 0b6ae794..ab8dc9a8 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -1,6 +1,5 @@ #include "TextScr.h" -#include #include #include #include @@ -91,7 +90,7 @@ void EndTextScript() } //Decrypt .tsc -void EncryptionBinaryData2(uint8_t *pData, int size) +void EncryptionBinaryData2(unsigned char *pData, int size) { int val1; @@ -136,7 +135,7 @@ BOOL LoadTextScript2(const char *name) strcpy(gTS.path, name); //Decrypt data - EncryptionBinaryData2((uint8_t*)gTS.data, gTS.size); + EncryptionBinaryData2((unsigned char*)gTS.data, gTS.size); return TRUE; } @@ -157,7 +156,7 @@ BOOL LoadTextScript_Stage(const char *name) //Read Head.tsc fread(gTS.data, 1, head_size, fp); - EncryptionBinaryData2((uint8_t*)gTS.data, head_size); + EncryptionBinaryData2((unsigned char*)gTS.data, head_size); gTS.data[head_size] = 0; fclose(fp); @@ -174,7 +173,7 @@ BOOL LoadTextScript_Stage(const char *name) //Read stage's tsc fread(&gTS.data[head_size], 1, body_size, fp); - EncryptionBinaryData2((uint8_t*)&gTS.data[head_size], body_size); + EncryptionBinaryData2((unsigned char*)&gTS.data[head_size], body_size); gTS.data[head_size + body_size] = 0; fclose(fp); diff --git a/src/TextScr.h b/src/TextScr.h index 0e7d11e3..1c87e1df 100644 --- a/src/TextScr.h +++ b/src/TextScr.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "WindowsWrapper.h" #include "CommonDefines.h" @@ -54,12 +52,12 @@ struct TEXT_SCRIPT int offsetY; //NOD cursor blink - uint8_t wait_beam; + unsigned char wait_beam; }; BOOL InitTextScript2(); void EndTextScript(); -void EncryptionBinaryData2(uint8_t *pData, int size); +void EncryptionBinaryData2(unsigned char *pData, int size); BOOL LoadTextScript2(const char *name); BOOL LoadTextScript_Stage(const char *name); void GetTextScriptPath(char *path); diff --git a/src/Triangle.cpp b/src/Triangle.cpp index 3c51f3ad..e5290d9d 100644 --- a/src/Triangle.cpp +++ b/src/Triangle.cpp @@ -1,10 +1,9 @@ #include "Triangle.h" -#include #include int gSin[0x100]; -int16_t gTan[0x21]; +short gTan[0x21]; void InitTriangleTable() { @@ -23,27 +22,27 @@ void InitTriangleTable() { a = (float)(i * 6.2831855f / 256.0f); b = sinf(a) / cosf(a); - gTan[i] = (int16_t)(b * 8192.0f); + gTan[i] = (short)(b * 8192.0f); } } -int GetSin(uint8_t deg) +int GetSin(unsigned char deg) { return gSin[deg]; } -int GetCos(uint8_t deg) +int GetCos(unsigned char deg) { deg += 0x40; return gSin[deg]; } -uint8_t GetArktan(int x, int y) +unsigned char GetArktan(int x, int y) { x *= -1; y *= -1; - uint8_t a = 0; - int16_t k; + unsigned char a = 0; + short k; if (x > 0) { diff --git a/src/Triangle.h b/src/Triangle.h index 400761a5..92f76c7e 100644 --- a/src/Triangle.h +++ b/src/Triangle.h @@ -1,8 +1,6 @@ #pragma once -#include - void InitTriangleTable(); -int GetSin(uint8_t deg); -int GetCos(uint8_t deg); -uint8_t GetArktan(int x, int y); +int GetSin(unsigned char deg); +int GetCos(unsigned char deg); +unsigned char GetArktan(int x, int y);