diff options
author | Mathieu Schroeter <mathieu@schroetersa.ch> | 2017-02-12 00:51:38 +0100 |
---|---|---|
committer | Mathieu Schroeter <mathieu@schroetersa.ch> | 2017-02-12 00:51:38 +0100 |
commit | 59698849e1b274a0d829bbf622ca275103c12dd9 (patch) | |
tree | 66ee55fe65b6614e5ddf219fe5d7131b7328b8f7 | |
parent | 0e338b45db42b40e41f82056d9e1363f3595c9a6 (diff) |
Use type with explicit length especially for long
The long type on win64 is 32 bits, and 64 bits on linux 64.
-rw-r--r-- | src/action.cpp | 38 | ||||
-rw-r--r-- | src/action.h | 14 | ||||
-rw-r--r-- | src/arrange.cpp | 48 | ||||
-rw-r--r-- | src/blupi.cpp | 24 | ||||
-rw-r--r-- | src/blupi.h | 22 | ||||
-rw-r--r-- | src/button.cpp | 32 | ||||
-rw-r--r-- | src/button.h | 30 | ||||
-rw-r--r-- | src/chemin.cpp | 44 | ||||
-rw-r--r-- | src/decblupi.cpp | 232 | ||||
-rw-r--r-- | src/decgoal.cpp | 204 | ||||
-rw-r--r-- | src/decgoal.h | 6 | ||||
-rw-r--r-- | src/decio.cpp | 114 | ||||
-rw-r--r-- | src/decmap.cpp | 4 | ||||
-rw-r--r-- | src/decmove.cpp | 104 | ||||
-rw-r--r-- | src/decmove.h | 4 | ||||
-rw-r--r-- | src/decor.cpp | 116 | ||||
-rw-r--r-- | src/decor.h | 548 | ||||
-rw-r--r-- | src/decstat.cpp | 34 | ||||
-rw-r--r-- | src/def.h | 24 | ||||
-rw-r--r-- | src/event.cpp | 192 | ||||
-rw-r--r-- | src/event.h | 148 | ||||
-rw-r--r-- | src/fifo.cpp | 25 | ||||
-rw-r--r-- | src/fifo.h | 16 | ||||
-rw-r--r-- | src/fog.cpp | 10 | ||||
-rw-r--r-- | src/jauge.cpp | 8 | ||||
-rw-r--r-- | src/jauge.h | 10 | ||||
-rw-r--r-- | src/menu.cpp | 28 | ||||
-rw-r--r-- | src/menu.h | 30 | ||||
-rw-r--r-- | src/misc.cpp | 8 | ||||
-rw-r--r-- | src/misc.h | 2 | ||||
-rw-r--r-- | src/movie.cpp | 4 | ||||
-rw-r--r-- | src/movie.h | 2 | ||||
-rw-r--r-- | src/obstacle.cpp | 244 | ||||
-rw-r--r-- | src/pixmap.cpp | 74 | ||||
-rw-r--r-- | src/pixmap.h | 38 | ||||
-rw-r--r-- | src/sound.cpp | 28 | ||||
-rw-r--r-- | src/sound.h | 28 | ||||
-rw-r--r-- | src/text.cpp | 50 | ||||
-rw-r--r-- | src/text.h | 16 |
39 files changed, 1304 insertions, 1299 deletions
diff --git a/src/action.cpp b/src/action.cpp index 23e1509..2ba32ed 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -15,11 +15,11 @@ typedef struct { - short action; - short channel; - short icons[8][MAXICON]; // nb, icones, - short moves[8][MAXMOVE]; // nb, nb, x,y, - short sounds[MAXSOUND]; // nb, sons, + Sint16 action; + Sint16 channel; + Sint16 icons[8][MAXICON]; // nb, icones, + Sint16 moves[8][MAXMOVE]; // nb, nb, x,y, + Sint16 sounds[MAXSOUND]; // nb, sons, } DescAction; @@ -2570,13 +2570,13 @@ static DescAction action_table[] = // Calcule l'action suivante. // Retourne false lorsque l'action est terminée. -bool Action(short action, short direct, - short &phase, short &step, - short &channel, short &icon, POINT &pos, short &posZ, - short &sound) +bool Action(Sint16 action, Sint16 direct, + Sint16 &phase, Sint16 &step, + Sint16 &channel, Sint16 &icon, POINT &pos, Sint16 &posZ, + Sint16 &sound) { DescAction* pTable = action_table; - short nbIcon, nbPhase, nbMove, nbSound, i; + Sint16 nbIcon, nbPhase, nbMove, nbSound, i; pos.x = 0; pos.y = 0; @@ -2631,7 +2631,7 @@ bool Action(short action, short direct, -static short rotate_table[] = +static Sint16 rotate_table[] = { 0, 6,12,18,24,30,36,42, 1, 7,13,19,25,31,37,43, @@ -2658,11 +2658,11 @@ static short rotate_table[] = // Tourne une icône dans une direction donnée. -bool Rotate(short &icon, short direct) +bool Rotate(Sint16 &icon, Sint16 direct) { - short* pTable = rotate_table; - short i; - short offset = 0; + Sint16* pTable = rotate_table; + Sint16 i; + Sint16 offset = 0; if ( icon >= 200 && icon <= 215 ) // tracks ? { @@ -2719,10 +2719,10 @@ bool Rotate(short &icon, short direct) // Retourne la direction d'une icône. -int GetIconDirect(short icon) +Sint32 GetIconDirect(Sint16 icon) { - short* pTable = rotate_table; - short i; + Sint16* pTable = rotate_table; + Sint16 i; if ( icon >= 169 && icon <= 192 ) // blupi malade ? { @@ -2764,7 +2764,7 @@ int GetIconDirect(short icon) // Retourne l'amplitude d'une action, en nombre // de cellules. -int GetAmplitude(short action) +Sint32 GetAmplitude(Sint16 action) { if ( action == ACTION_SAUTE2 ) return 2; if ( action == ACTION_SAUTE3 ) return 3; diff --git a/src/action.h b/src/action.h index 476e950..6f4bec3 100644 --- a/src/action.h +++ b/src/action.h @@ -6,17 +6,17 @@ #include "blupi.h" extern -bool Action(short action, short direct, - short &phase, short &step, - short &channel, short &icon, POINT &pos, short &posZ, - short &sound); +bool Action(Sint16 action, Sint16 direct, + Sint16 &phase, Sint16 &step, + Sint16 &channel, Sint16 &icon, POINT &pos, Sint16 &posZ, + Sint16 &sound); extern -bool Rotate(short &icon, short direct); +bool Rotate(Sint16 &icon, Sint16 direct); extern -int GetIconDirect(short icon); +Sint32 GetIconDirect(Sint16 icon); extern -int GetAmplitude(short action); +Sint32 GetAmplitude(Sint16 action); diff --git a/src/arrange.cpp b/src/arrange.cpp index 13b4dbd..9cfc0b1 100644 --- a/src/arrange.cpp +++ b/src/arrange.cpp @@ -49,9 +49,9 @@ static char tableDark[13*4] = // Retourne les bits contenant de l'eau. -bool CDecor::GetSeeBits(POINT cel, char *pBits, int index) +bool CDecor::GetSeeBits(POINT cel, char *pBits, Sint32 index) { - int icon; + Sint32 icon; pBits[0] = 0; pBits[1] = 0; @@ -117,7 +117,7 @@ bool CDecor::GetSeeBits(POINT cel, char *pBits, int index) void CopyBits(char *pDst, char *pSrc) { - for ( int i=0 ; i<4 ; i++ ) + for ( Sint32 i=0 ; i<4 ; i++ ) { *pDst++ = *pSrc++; } @@ -125,7 +125,7 @@ void CopyBits(char *pDst, char *pSrc) bool ChangeBits(char *pDst, char *pSrc) { - for ( int i=0 ; i<4 ; i++ ) + for ( Sint32 i=0 ; i<4 ; i++ ) { if ( *pDst++ != *pSrc++ ) return true; } @@ -134,9 +134,9 @@ bool ChangeBits(char *pDst, char *pSrc) // Retourne l'icône correspondant aux bits d'eaux. -int CDecor::GetSeeIcon(char *pBits, int index) +Sint32 CDecor::GetSeeIcon(char *pBits, Sint32 index) { - int i; + Sint32 i; if ( index == 0 ) // eau ? { @@ -184,7 +184,7 @@ int CDecor::GetSeeIcon(char *pBits, int index) void CDecor::ArrangeFloor(POINT cel) { POINT test; - int max, index, icon; + Sint32 max, index, icon; char here[4], bits[4], init[4]; bool bModif = false; @@ -400,7 +400,7 @@ static char tableMur[5*15] = 21, 0,0,0,1, }; -static short tableMurDir[4*2] = +static Sint16 tableMurDir[4*2] = { +2, 0, // est 0,+2, // sur @@ -414,11 +414,11 @@ static short tableMurDir[4*2] = // index=1 si palissade (65..71) // index=2 si barrière (106..112) -void CDecor::ArrangeMur(POINT cel, int &icon, int index) +void CDecor::ArrangeMur(POINT cel, Sint32 &icon, Sint32 index) { - int i, x, y, channel; - int first, last, matiere; - int icons[4]; + Sint32 i, x, y, channel; + Sint32 first, last, matiere; + Sint32 icons[4]; char murs[4]; if ( index == 0 ) @@ -494,11 +494,11 @@ void CDecor::ArrangeMur(POINT cel, int &icon, int index) // Arrange les objets avant une construction. -void CDecor::ArrangeBuild(POINT cel, int &channel, int &icon) +void CDecor::ArrangeBuild(POINT cel, Sint32 &channel, Sint32 &icon) { - int index, i, x, y; - int first, last, matiere; - int oldChannel, oldIcon; + Sint32 index, i, x, y; + Sint32 first, last, matiere; + Sint32 oldChannel, oldIcon; for ( index=0 ; index<3 ; index++ ) { @@ -571,9 +571,9 @@ void CDecor::ArrangeBuild(POINT cel, int &channel, int &icon) void CDecor::ArrangeObject(POINT cel) { - int channel, icon; - int first, last; - int index, i, j, k, x, y; + Sint32 channel, icon; + Sint32 first, last; + Sint32 index, i, j, k, x, y; POINT vector, test, pos; bool bTour; @@ -710,7 +710,7 @@ void CDecor::ArrangeObject(POINT cel) bool CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2) { POINT cel; - int icon1, icon2; + Sint32 icon1, icon2; icon1 = m_fillSearchIcon; icon2 = m_fillSearchIcon; @@ -805,7 +805,7 @@ bool CDecor::ArrangeFillTest(POINT pos) // Modifie le décor lors d'un remplissage. -void CDecor::ArrangeFillPut(POINT pos, int channel, int icon) +void CDecor::ArrangeFillPut(POINT pos, Sint32 channel, Sint32 icon) { if ( m_bFillFloor ) { @@ -835,7 +835,7 @@ void CDecor::ArrangeFillPut(POINT pos, int channel, int icon) void CDecor::ArrangeFillSearch(POINT pos) { - int startX, endX; + Sint32 startX, endX; // Cherche la borne gauche. startX = pos.x; @@ -916,7 +916,7 @@ void CDecor::ArrangeFillSearch(POINT pos) // Rempli un sol à partir d'une position donnée. -void CDecor::ArrangeFill(POINT pos, int channel, int icon, bool bFloor) +void CDecor::ArrangeFill(POINT pos, Sint32 channel, Sint32 icon, bool bFloor) { m_bFillFloor = bFloor; @@ -961,7 +961,7 @@ void CDecor::ArrangeFill(POINT pos, int channel, int icon, bool bFloor) void CDecor::ArrangeBlupi() { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { diff --git a/src/blupi.cpp b/src/blupi.cpp index 6f69db8..cf23adc 100644 --- a/src/blupi.cpp +++ b/src/blupi.cpp @@ -33,22 +33,22 @@ CSound* g_pSound = nullptr; // sound principal CMovie* g_pMovie = nullptr; // movie principal CDecor* g_pDecor = nullptr; bool g_bFullScreen = false; // false si mode de test -int g_speedRate = 1; -int g_timerInterval = 50; // inverval = 50ms -int g_mouseType = MOUSETYPEGRA; +Sint32 g_speedRate = 1; +Sint32 g_timerInterval = 50; // inverval = 50ms +Sint32 g_mouseType = MOUSETYPEGRA; bool g_bActive = true; // is application active ? bool g_bTermInit = false; // initialisation en cours -unsigned int g_lastPhase = 999; +Uint32 g_lastPhase = 999; // Lit un num�ro d�cimal. -int GetNum(char *p) +Sint32 GetNum(char *p) { - int n = 0; + Sint32 n = 0; while ( *p >= '0' && *p <= '9' ) { @@ -61,7 +61,7 @@ int GetNum(char *p) // Lit le fichier de configuration. -bool ReadConfig(int argc, char *argv[]) +bool ReadConfig(Sint32 argc, char *argv[]) { FILE* file = nullptr; char buffer[200]; @@ -116,9 +116,9 @@ bool ReadConfig(int argc, char *argv[]) void UpdateFrame(void) { RECT clip, rcRect; - unsigned int phase; + Uint32 phase; POINT posMouse; - int i, term, speed; + Sint32 i, term, speed; posMouse = g_pEvent->GetLastMousePos(); @@ -215,7 +215,7 @@ void UpdateFrame(void) void Benchmark() { - int i; + Sint32 i; POINT pos = { 0, 0 }; g_pPixmap->DrawIcon(-1, 2, 10, pos, 0); @@ -406,7 +406,7 @@ static bool InitFail(const char *msg, bool bDirectX) // Initialisation de l'application. -static bool DoInit(int argc, char *argv[]) +static bool DoInit(Sint32 argc, char *argv[]) { POINT totalDim, iconDim; RECT rcRect; @@ -610,7 +610,7 @@ static bool DoInit(int argc, char *argv[]) // Programme principal. -int main (int argc, char *argv[]) +Sint32 main (Sint32 argc, char *argv[]) { if (!DoInit(argc, argv)) return -1; diff --git a/src/blupi.h b/src/blupi.h index d8626d7..615f2fc 100644 --- a/src/blupi.h +++ b/src/blupi.h @@ -8,30 +8,30 @@ extern SDL_Renderer *g_renderer; struct POINT { - long x; - long y; + Sint32 x; + Sint32 y; }; struct RECT { - long left; - long top; - long right; - long bottom; + Sint32 left; + Sint32 top; + Sint32 right; + Sint32 bottom; }; -typedef unsigned long COLORREF; +typedef Uint32 COLORREF; #if defined(_WIN64) typedef unsigned __int64 WPARAM; typedef __int64 LPARAM; #else -typedef unsigned int WPARAM; -typedef long LPARAM; +typedef Uint32 WPARAM; +typedef Sint32 LPARAM; #endif -#define LOWORD(l) ((unsigned short)(((unsigned long)(l)) & 0xffff)) -#define HIWORD(l) ((unsigned short)((((unsigned long)(l)) >> 16) & 0xffff)) +#define LOWORD(l) ((Uint16)(((Uint32)(l)) & 0xffff)) +#define HIWORD(l) ((Uint16)((((Uint32)(l)) >> 16) & 0xffff)) #define MAX_PATH 260 diff --git a/src/button.cpp b/src/button.cpp index d6e319b..ccd983c 100644 --- a/src/button.cpp +++ b/src/button.cpp @@ -30,7 +30,7 @@ CButton::CButton() m_bMouseDown = false; m_bMinimizeRedraw = false; m_bRedraw = false; - m_message = static_cast<unsigned int> (-1); + m_message = static_cast<Uint32> (-1); } // Destructeur. @@ -43,15 +43,15 @@ CButton::~CButton() // Crée un nouveau bouton. bool CButton::Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, bool bMinimizeRedraw, - int *pMenu, int nbMenu, + POINT pos, Sint32 type, bool bMinimizeRedraw, + Sint32 *pMenu, Sint32 nbMenu, const char **pToolTips, - int region, unsigned int message) + Sint32 region, Uint32 message) { POINT iconDim; - int i, icon; + Sint32 i, icon; - static int ttypes[] = + static Sint32 ttypes[] = { DIMBUTTONX,DIMBUTTONY, // button00.bmp }; @@ -122,7 +122,7 @@ bool CButton::Create(CPixmap *pPixmap, CSound *pSound, void CButton::Draw() { - int i; + Sint32 i; POINT pos; RECT rect; @@ -174,12 +174,12 @@ void CButton::Redraw() m_bRedraw = true; } -int CButton::GetState() +Sint32 CButton::GetState() { return m_state; } -void CButton::SetState(int state) +void CButton::SetState(Sint32 state) { if ( m_state != state || m_mouseState != state ) @@ -191,12 +191,12 @@ void CButton::SetState(int state) m_mouseState = state; } -int CButton::GetMenu() +Sint32 CButton::GetMenu() { return m_selMenu; } -void CButton::SetMenu(int menu) +void CButton::SetMenu(Sint32 menu) { if ( m_selMenu != menu ) { @@ -297,8 +297,8 @@ bool CButton::MouseOnButton(POINT pos) const char *CButton::GetToolTips(POINT pos) { - int width = m_dim.x; - int rank; + Sint32 width = m_dim.x; + Sint32 rank; if (m_bHide || !m_bEnable) return nullptr; @@ -339,7 +339,7 @@ const char *CButton::GetToolTips(POINT pos) bool CButton::Detect(POINT pos) { - int width = m_dim.x; + Sint32 width = m_dim.x; if ( m_bHide || !m_bEnable ) return false; @@ -376,7 +376,7 @@ bool CButton::MouseDown(POINT pos) bool CButton::MouseMove(POINT pos) { bool bDetect; - int iState, iMenu; + Sint32 iState, iMenu; iState = m_mouseState; iMenu = m_selMenu; @@ -429,7 +429,7 @@ bool CButton::MouseUp(POINT pos) if ( !bDetect ) return false; - if ( m_message != static_cast<unsigned int> (-1) ) + if ( m_message != static_cast<Uint32> (-1) ) { CEvent::PushUserEvent (m_message); } diff --git a/src/button.h b/src/button.h index 71f4ec9..a7476bf 100644 --- a/src/button.h +++ b/src/button.h @@ -13,18 +13,18 @@ public: ~CButton(); bool Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, bool bMinimizeRedraw, - int *pMenu, int nbMenu, + POINT pos, Sint32 type, bool bMinimizeRedraw, + Sint32 *pMenu, Sint32 nbMenu, const char **pToolTips, - int region, unsigned int message); + Sint32 region, Uint32 message); void Draw(); void Redraw(); - int GetState(); - void SetState(int state); + Sint32 GetState(); + void SetState(Sint32 state); - int GetMenu(); - void SetMenu(int menu); + Sint32 GetMenu(); + void SetMenu(Sint32 menu); bool GetEnable(); void SetEnable(bool bEnable); @@ -47,19 +47,19 @@ protected: CPixmap* m_pPixmap; CDecor* m_pDecor; CSound* m_pSound; - int m_type; // type de bouton + Sint32 m_type; // type de bouton bool m_bEnable; // true si bouton actif bool m_bHide; // true si bouton caché - unsigned int m_message; // message envoyé si bouton actionné + Uint32 m_message; // message envoyé si bouton actionné POINT m_pos; // coin sup/gauche POINT m_dim; // dimensions - int m_state; // 0=relâché, 1=pressé, +2=survollé - int m_mouseState; // 0=relâché, 1=pressé, +2=survollé - int m_iconMenu[20]; // icônes du sous-menu + Sint32 m_state; // 0=relâché, 1=pressé, +2=survollé + Sint32 m_mouseState; // 0=relâché, 1=pressé, +2=survollé + Sint32 m_iconMenu[20]; // icônes du sous-menu const char **m_toolTips; // info-bulles - int m_nbMenu; // nb de case du sous-menu - int m_nbToolTips; // nb d'info-bulles - int m_selMenu; // sous-menu sélectionné + Sint32 m_nbMenu; // nb de case du sous-menu + Sint32 m_nbToolTips; // nb d'info-bulles + Sint32 m_selMenu; // sous-menu sélectionné bool m_bMouseDown; // true -> bouton souris pressé bool m_bMinimizeRedraw; bool m_bRedraw; // true -> doit être redessiné diff --git a/src/chemin.cpp b/src/chemin.cpp index 580e61b..ae0111a 100644 --- a/src/chemin.cpp +++ b/src/chemin.cpp @@ -8,9 +8,9 @@ // Mémorise toutes les positions des blupi. -void CDecor::CheminMemPos(int exRank) +void CDecor::CheminMemPos(Sint32 exRank) { - int rank, index; + Sint32 rank, index; m_cheminNbPos = 0; index = 0; @@ -39,9 +39,9 @@ void CDecor::CheminMemPos(int exRank) // Teste si une positiion est occupée par un blupi. -bool CDecor::CheminTestPos(POINT pos, int &rank) +bool CDecor::CheminTestPos(POINT pos, Sint32 &rank) { - int i; + Sint32 i; for ( i=0 ; i<m_cheminNbPos ; i++ ) { @@ -61,9 +61,9 @@ bool CDecor::CheminTestPos(POINT pos, int &rank) // à la recherche du chemin le plus court // retourne la direction à prendre -int CDecor::CheminARebours(int rank) +Sint32 CDecor::CheminARebours(Sint32 rank) { - int pos, rebours, last, dir, set; + Sint32 pos, rebours, last, dir, set; POINT v; pos = m_blupi[rank].goalCel.y*MAXCELX + m_blupi[rank].goalCel.x; @@ -103,12 +103,12 @@ int CDecor::CheminARebours(int rank) // semblable à la précédente, // mais les points à explorer sont classés selon leur distance à la cible -void CDecor::CheminFillTerrain(int rank) +void CDecor::CheminFillTerrain(Sint32 rank) { - long pos, last, dest, dist; - int step, dir, cout, action, max, next, ampli; - int dx, dy; - int but = 1000; + Sint32 pos, last, dest, dist; + Sint32 step, dir, cout, action, max, next, ampli; + Sint32 dx, dy; + Sint32 but = 1000; if ( m_blupi[rank].cel.x == m_blupi[rank].goalCel.x && m_blupi[rank].cel.y == m_blupi[rank].goalCel.y ) return; @@ -154,7 +154,7 @@ void CDecor::CheminFillTerrain(int rank) m_cheminWork[last] > step+cout ) { // marque les cases sautées - for (int i=1; i<ampli;i++) + for (Sint32 i=1; i<ampli;i++) { m_cheminWork[pos+i*next] = step+cout-ampli+i; } @@ -166,7 +166,7 @@ void CDecor::CheminFillTerrain(int rank) dx = m_blupi[rank].goalCel.x - last%MAXCELX; dy = m_blupi[rank].goalCel.y - last/MAXCELX; //? dist = dy*dy + dx*dx; - dist = (long)(dy*dy) + (long)(dx*dx); + dist = (Sint32)(dy*dy) + (Sint32)(dx*dx); fifo.put(last, dist); } } @@ -180,13 +180,13 @@ void CDecor::CheminFillTerrain(int rank) // et le "prix à payer" pour aller dans cette direction // coût doit être déterminé en sortie -bool CDecor::CheminTestDirection(int rank, int pos, int dir, - int &next, int &li, - int &cout, int &action) +bool CDecor::CheminTestDirection(Sint32 rank, Sint32 pos, Sint32 dir, + Sint32 &next, Sint32 &li, + Sint32 &cout, Sint32 &action) { POINT cel, vector, newCel; bool bFree; - int tryDirect, workBlupi, rankHere; + Sint32 tryDirect, workBlupi, rankHere; cel.x = pos%MAXCELX; cel.y = pos/MAXCELX; @@ -268,10 +268,10 @@ bool CDecor::CheminTestDirection(int rank, int pos, int dir, // Retourne true si on a assigné une nouvelle direction à blupi. -bool CDecor::CheminCherche(int rank, int &action) +bool CDecor::CheminCherche(Sint32 rank, Sint32 &action) { - int cout; // prix pour aller dans une direction - int pos, dir, next, ampli; + Sint32 cout; // prix pour aller dans une direction + Sint32 pos, dir, next, ampli; // Déjà à destination ? if ( m_blupi[rank].cel.x == m_blupi[rank].goalCel.x && @@ -312,9 +312,9 @@ bool CDecor::CheminCherche(int rank, int &action) // Teste s'il est possible de se rendre à un endroit donné. -bool CDecor::IsCheminFree(int rank, POINT dest, int button) +bool CDecor::IsCheminFree(Sint32 rank, POINT dest, Sint32 button) { - int action, sDirect; + Sint32 action, sDirect; POINT goalCel, passCel, limit; bool bOK; diff --git a/src/decblupi.cpp b/src/decblupi.cpp index c0847eb..0ae430c 100644 --- a/src/decblupi.cpp +++ b/src/decblupi.cpp @@ -12,7 +12,7 @@ // Cette table donne l'action à effectuer pour un bouton // enfoncé. -short table_actions[] = +Sint16 table_actions[] = { WM_ACTION_GO, WM_ACTION_STOP, @@ -59,7 +59,7 @@ short table_actions[] = void CDecor::BlupiFlush() { - int i; + Sint32 i; memset(m_blupi, 0, sizeof(Blupi)*MAXBLUPI); @@ -71,10 +71,10 @@ void CDecor::BlupiFlush() // Crée un nouveau blupi, et retourne son rang. -int CDecor::BlupiCreate(POINT cel, int action, int direct, - int perso, int energy) +Sint32 CDecor::BlupiCreate(POINT cel, Sint32 action, Sint32 direct, + Sint32 perso, Sint32 energy) { - int rank; + Sint32 rank; if ( perso == 0 && action == ACTION_STOP && // blupi ? energy <= MAXENERGY/4 ) @@ -189,9 +189,9 @@ int CDecor::BlupiCreate(POINT cel, int action, int direct, // Si perso == -1, supprime n'importe quel personnage ici. // Si perso >= 0, supprime seulement ce personnage. -bool CDecor::BlupiDelete(POINT cel, int perso) +bool CDecor::BlupiDelete(POINT cel, Sint32 perso) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -224,7 +224,7 @@ bool CDecor::BlupiDelete(POINT cel, int perso) // Supprime un blupi existant. -void CDecor::BlupiDelete(int rank) +void CDecor::BlupiDelete(Sint32 rank) { m_blupi[rank].bExist = false; @@ -241,9 +241,9 @@ void CDecor::BlupiDelete(int rank) // type=0 -> explosion // type=1 -> électro -void CDecor::BlupiKill(int exRank, POINT cel, int type) +void CDecor::BlupiKill(Sint32 exRank, POINT cel, Sint32 type) { - int rank, action, x, y, icon; + Sint32 rank, action, x, y, icon; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -316,7 +316,7 @@ void CDecor::BlupiKill(int exRank, POINT cel, int type) // Test si un blupi existe. -bool CDecor::BlupiIfExist(int rank) +bool CDecor::BlupiIfExist(Sint32 rank) { return !!m_blupi[rank].bExist; } @@ -326,9 +326,9 @@ bool CDecor::BlupiIfExist(int rank) // #1 -> (POWER) redonne l'énergie maximale // #2 -> (LONESOME) tue toutes les araignées/virus/etc. -void CDecor::BlupiCheat(int cheat) +void CDecor::BlupiCheat(Sint32 cheat) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -357,9 +357,9 @@ void CDecor::BlupiCheat(int cheat) // Actualise un blupi pour pouvoir le dessiner dans son état. -void CDecor::BlupiActualise(int rank) +void CDecor::BlupiActualise(Sint32 rank) { - short sound; + Sint16 sound; Action(m_blupi[rank].action, m_blupi[rank].aDirect, @@ -381,9 +381,9 @@ void CDecor::BlupiActualise(int rank) // Adapte une icône. -void CDecor::BlupiAdaptIcon(int rank) +void CDecor::BlupiAdaptIcon(Sint32 rank) { - int direct; + Sint32 direct; if ( m_blupi[rank].icon == -1 ) return; @@ -486,9 +486,9 @@ void CDecor::BlupiAdaptIcon(int rank) // Si bStop=true, on stoppe le son précédent associé // à ce blupi (rank), si nécessaire. -void CDecor::BlupiSound(int rank, int sound, POINT pos, bool bStop) +void CDecor::BlupiSound(Sint32 rank, Sint32 sound, POINT pos, bool bStop) { - int newSound; + Sint32 newSound; if ( rank == -1 ) { @@ -567,7 +567,7 @@ void CDecor::BlupiSound(int rank, int sound, POINT pos, bool bStop) // Sons associés à des actions. -static short tableSound[] = +static Sint16 tableSound[] = { ACTION_BRULE, SOUND_BRULE, ACTION_TCHAO, SOUND_TCHAO, @@ -580,11 +580,11 @@ static short tableSound[] = // Effectue quelques initialisations pour une nouvelle action. -void CDecor::BlupiInitAction(int rank, int action, int direct) +void CDecor::BlupiInitAction(Sint32 rank, Sint32 action, Sint32 direct) { - short* pTable = tableSound; + Sint16* pTable = tableSound; POINT pos; - int rand; + Sint32 rand; while ( *pTable != -1 ) { @@ -921,7 +921,7 @@ void CDecor::BlupiInitAction(int rank, int action, int direct) // Change l'action de blupi. -void CDecor::BlupiChangeAction(int rank, int action, int direct) +void CDecor::BlupiChangeAction(Sint32 rank, Sint32 action, Sint32 direct) { if ( rank < 0 ) return; BlupiInitAction(rank, action, direct); @@ -936,9 +936,9 @@ void CDecor::BlupiChangeAction(int rank, int action, int direct) // Vide la liste des actions. -void CDecor::ListFlush(int rank) +void CDecor::ListFlush(Sint32 rank) { - int i; + Sint32 i; for ( i=0 ; i<MAXLIST ; i++ ) { @@ -950,9 +950,9 @@ void CDecor::ListFlush(int rank) // Retourne le paramètre associé à une action. -int CDecor::ListGetParam(int rank, int button, POINT cel) +Sint32 CDecor::ListGetParam(Sint32 rank, Sint32 button, POINT cel) { - int icon; + Sint32 icon; if ( button == BUTTON_CARRY || button == BUTTON_FLEUR ) @@ -981,9 +981,9 @@ int CDecor::ListGetParam(int rank, int button, POINT cel) // Ajoute une action dans la liste. -bool CDecor::ListPut(int rank, int button, POINT cel, POINT cMem) +bool CDecor::ListPut(Sint32 rank, Sint32 button, POINT cel, POINT cMem) { - int i, last; + Sint32 i, last; if ( button == BUTTON_REPEAT || button == BUTTON_GO ) return true; @@ -1022,9 +1022,9 @@ bool CDecor::ListPut(int rank, int button, POINT cel, POINT cMem) // Enlève la dernière action ajoutée dans la liste. -void CDecor::ListRemove(int rank) +void CDecor::ListRemove(Sint32 rank) { - int i; + Sint32 i; if ( m_blupi[rank].listButton[0] == BUTTON_CULTIVE ) return; @@ -1042,10 +1042,10 @@ void CDecor::ListRemove(int rank) // Retourne la profondeur de la répétition. // Retourne -1 si aucune répétiton n'est possible. -int CDecor::ListSearch(int rank, int button, POINT cel, +Sint32 CDecor::ListSearch(Sint32 rank, Sint32 button, POINT cel, const char *&textForButton) { - int i, j, param, nb; + Sint32 i, j, param, nb; static const char *errors[] = { /* 0 */ translate ("1: Grow tomatoes\n2: Eat"), @@ -1062,7 +1062,7 @@ int CDecor::ListSearch(int rank, int button, POINT cel, /* 11 */ translate ("1: Take\n2: Make a boat"), }; - static int table_series[] = + static Sint32 table_series[] = { 0, // errors 2, BUTTON_CULTIVE, BUTTON_MANGE, @@ -1152,13 +1152,13 @@ int CDecor::ListSearch(int rank, int button, POINT cel, // Ajuste une action à répéter. -bool CDecor::RepeatAdjust(int rank, int button, - POINT &cel, POINT &cMem, int param, int list) +bool CDecor::RepeatAdjust(Sint32 rank, Sint32 button, + POINT &cel, POINT &cMem, Sint32 param, Sint32 list) { - int i, channel, icon, icon1, icon2, flags; + Sint32 i, channel, icon, icon1, icon2, flags; POINT test; - static int table_object[] = + static Sint32 table_object[] = { BUTTON_ABAT, CHOBJECT, 6, 11, BUTTON_ROC, CHOBJECT, 37, 43, @@ -1171,7 +1171,7 @@ bool CDecor::RepeatAdjust(int rank, int button, 0, }; - static int table_mur[] = + static Sint32 table_mur[] = { +2, 0, // 1<<0 0,+2, // 1<<1 @@ -1312,7 +1312,7 @@ bool CDecor::RepeatAdjust(int rank, int button, // Démarre une action. -void CDecor::GoalStart(int rank, int action, POINT cel) +void CDecor::GoalStart(Sint32 rank, Sint32 action, POINT cel) { m_blupi[rank].goalHili = cel; m_blupi[rank].goalAction = action; @@ -1327,10 +1327,10 @@ void CDecor::GoalStart(int rank, int action, POINT cel) // Effectue la méta opération suivante. // Retourne false lorsque c'est fini ! -bool CDecor::GoalNextPhase(int rank) +bool CDecor::GoalNextPhase(Sint32 rank) { - short* pTable; - int i, nb; + Sint16* pTable; + Sint32 i, nb; if ( m_blupi[rank].goalAction == 0 ) return false; @@ -1367,10 +1367,10 @@ bool CDecor::GoalNextPhase(int rank) // Initialise la jauge pour une méta opération. -void CDecor::GoalInitJauge(int rank) +void CDecor::GoalInitJauge(Sint32 rank) { - short* pTable; - int max=0, op; + Sint16* pTable; + Sint32 max=0, op; m_blupi[rank].jaugePhase = -1; m_blupi[rank].jaugeMax = -1; @@ -1407,10 +1407,10 @@ void CDecor::GoalInitJauge(int rank) // Permet de passer à travers certains arbres. -void CDecor::GoalInitPassCel(int rank) +void CDecor::GoalInitPassCel(Sint32 rank) { POINT cel; - int channel, icon; + Sint32 channel, icon; cel.x = (m_blupi[rank].goalCel.x/2)*2; cel.y = (m_blupi[rank].goalCel.y/2)*2; @@ -1439,7 +1439,7 @@ void CDecor::GoalInitPassCel(int rank) // Ajuste une coordonnée de cellule. -void CDecor::GoalAdjustCel(int rank, int &x, int &y) +void CDecor::GoalAdjustCel(Sint32 rank, Sint32 &x, Sint32 &y) { if ( x == -10 && y == -10 ) { @@ -1475,7 +1475,7 @@ void CDecor::GoalAdjustCel(int rank, int &x, int &y) // Liste des buts multiples. -int table_multi_goal[16*2] = +Sint32 table_multi_goal[16*2] = { 0, 0, +1, 0, @@ -1497,12 +1497,12 @@ int table_multi_goal[16*2] = // Effectue une méta opération. -bool CDecor::GoalNextOp(int rank, short *pTable) +bool CDecor::GoalNextOp(Sint32 rank, Sint16 *pTable) { - int op, x, y; - int action, direct, channel, icon, mchannel, micon; - int total, step, delai, first, last, first2, last2, flag, i; - int button, param; + Sint32 op, x, y; + Sint32 action, direct, channel, icon, mchannel, micon; + Sint32 total, step, delai, first, last, first2, last2, flag, i; + Sint32 button, param; POINT pos, cel, cMem, destCel; bool bOK, bError=true; @@ -2304,9 +2304,9 @@ bool CDecor::GoalNextOp(int rank, short *pTable) // Supprime le blocage de la cellule dans laquelle // blupi travaille. -void CDecor::GoalUnwork(int rank) +void CDecor::GoalUnwork(Sint32 rank) { - int x, y; + Sint32 x, y; for ( x=0 ; x<MAXCELX/2 ; x++ ) { @@ -2322,11 +2322,11 @@ void CDecor::GoalUnwork(int rank) // Stoppe complètement une action. -void CDecor::GoalStop(int rank, bool bError, bool bSound) +void CDecor::GoalStop(Sint32 rank, bool bError, bool bSound) { POINT pos; - static int table_sound_term[6] = + static Sint32 table_sound_term[6] = { SOUND_TERM1, SOUND_TERM2, @@ -2336,7 +2336,7 @@ void CDecor::GoalStop(int rank, bool bError, bool bSound) SOUND_TERM6, }; - static int table_sound_boing[3] = + static Sint32 table_sound_boing[3] = { SOUND_BOING1, SOUND_BOING2, @@ -2396,7 +2396,7 @@ void CDecor::GoalStop(int rank, bool bError, bool bSound) bool CDecor::BlupiIsGoalUsed(POINT cel) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -2411,9 +2411,9 @@ bool CDecor::BlupiIsGoalUsed(POINT cel) // Démarre ou stoppe un rayon entre deux tours. -void CDecor::BlupiStartStopRayon(int rank, POINT startCel, POINT endCel) +void CDecor::BlupiStartStopRayon(Sint32 rank, POINT startCel, POINT endCel) { - int i, icon, icon2; + Sint32 i, icon, icon2; POINT cel, cel2, vector, pos; if ( m_blupi[rank].perso == 1 || // araignée ? @@ -2491,9 +2491,9 @@ void CDecor::BlupiStartStopRayon(int rank, POINT startCel, POINT endCel) // Tourne un blupi, si nécessaire. // Retourne false si ce n'est pas nécessaire. -bool CDecor::BlupiRotate(int rank) +bool CDecor::BlupiRotate(Sint32 rank) { - int aDirect, sDirect, ip, in, sens; + Sint32 aDirect, sDirect, ip, in, sens; bool bOK; POINT pos; @@ -2586,12 +2586,12 @@ bool CDecor::BlupiRotate(int rank) // Avance un blupi existant. -bool CDecor::BlupiNextAction(int rank) +bool CDecor::BlupiNextAction(Sint32 rank) { bool bOK; POINT pos, iCel; - int a, min; - short sound; + Sint32 a, min; + Sint16 sound; if ( !m_blupi[rank].bExist ) return false; @@ -2796,9 +2796,9 @@ bool CDecor::BlupiNextAction(int rank) // Action suivante pour un blupi existant. -void CDecor::BlupiNextGoal(int rank) +void CDecor::BlupiNextGoal(Sint32 rank) { - int direct, action, channel, icon, min, lg, fRank, i; + Sint32 direct, action, channel, icon, min, lg, fRank, i; POINT pos, cel, vector; if ( !m_blupi[rank].bExist ) return; @@ -3297,9 +3297,9 @@ void CDecor::BlupiNextGoal(int rank) // Calcule la cellule de destination. -void CDecor::BlupiDestCel(int rank) +void CDecor::BlupiDestCel(Sint32 rank) { - int a; + Sint32 a; POINT vector; m_blupi[rank].destCel = m_blupi[rank].cel; @@ -3337,7 +3337,7 @@ void CDecor::BlupiDestCel(int rank) void CDecor::BlupiStep(bool bFirst) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -3366,7 +3366,7 @@ void CDecor::BlupiStep(bool bFirst) // Retourne le rectangle occupé par un blupi, // pour les sélections (pas exact). -void CDecor::BlupiGetRect(int rank, RECT &rect) +void CDecor::BlupiGetRect(Sint32 rank, RECT &rect) { POINT pos; @@ -3382,10 +3382,10 @@ void CDecor::BlupiGetRect(int rank, RECT &rect) // Retourne le blupi visé par la souris. -int CDecor::GetTargetBlupi(POINT pos) +Sint32 CDecor::GetTargetBlupi(POINT pos) { #if 1 - int rank, found, prof; + Sint32 rank, found, prof; POINT test, rel, cel; cel = ConvPosToCel(pos); @@ -3429,7 +3429,7 @@ int CDecor::GetTargetBlupi(POINT pos) return found; #else - int rank, found, prof; + Sint32 rank, found, prof; RECT rect; POINT cel; @@ -3484,7 +3484,7 @@ int CDecor::GetTargetBlupi(POINT pos) void CDecor::BlupiDeselect() { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -3498,7 +3498,7 @@ void CDecor::BlupiDeselect() // Déslectionne un blupi. -void CDecor::BlupiDeselect(int rank) +void CDecor::BlupiDeselect(Sint32 rank) { m_blupi[rank].bHili = false; m_blupi[rank].bArrow = false; @@ -3513,7 +3513,7 @@ void CDecor::BlupiDeselect(int rank) // Met ou enlève une flèche au blupi sélectionné blupi. -void CDecor::BlupiSetArrow(int rank, bool bArrow) +void CDecor::BlupiSetArrow(Sint32 rank, bool bArrow) { m_celArrow.x = -1; @@ -3584,11 +3584,11 @@ void CDecor::BlupiHiliMove(POINT pos, bool bAdd) void CDecor::BlupiHiliUp(POINT pos, bool bAdd) { - int rank, r, nb, sound; + Sint32 rank, r, nb, sound; bool bEnerve = false; POINT c1, c2; - static int table_sound_ok[6] = + static Sint32 table_sound_ok[6] = { SOUND_OK1, SOUND_OK2, @@ -3598,14 +3598,14 @@ void CDecor::BlupiHiliUp(POINT pos, bool bAdd) SOUND_OK6, }; - static int table_sound_okf[3] = // si fatigué + static Sint32 table_sound_okf[3] = // si fatigué { SOUND_OK1f, SOUND_OK2f, SOUND_OK3f, }; - static int table_sound_oke[3] = // si énervé + static Sint32 table_sound_oke[3] = // si énervé { SOUND_OK1e, SOUND_OK2e, @@ -3736,7 +3736,7 @@ void CDecor::BlupiDrawHili() POINT p1, p2, p3, p4; POINT start, pos; RECT rect; - int shift; + Sint32 shift; if ( !m_bHiliRect ) return; @@ -3890,9 +3890,9 @@ void CDecor::BlupiDrawHili() // Est utilisé pour trouver que faire lors d'un clic // avec le bouton de droite. -int CDecor::GetDefButton(POINT cel) +Sint32 CDecor::GetDefButton(POINT cel) { - int button, rank, channel, icon; + Sint32 button, rank, channel, icon; POINT iCel; iCel = cel; @@ -3976,12 +3976,12 @@ int CDecor::GetDefButton(POINT cel) return button; } -// Indique un but visé à long terme, pour un blupi donné. +// Indique un but visé à Sint32 terme, pour un blupi donné. -bool CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) +bool CDecor::BlupiGoal(Sint32 rank, Sint32 button, POINT cel, POINT cMem) { POINT goalHili, goalHili2, goal, test; - int i, action, channel, icon, error, direct, step; + Sint32 i, action, channel, icon, error, direct, step; bool bRepeat = false; // Si plusieurs blupi sont sélectionnés, ils ne vont pas @@ -4168,7 +4168,7 @@ bool CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) test = goalHili2; if ( IsBuildPont(test, icon) != 0 ) return false; - m_blupi[rank].nLoop = static_cast<short> (abs((test.x-cel.x)+(test.y-cel.y))/2); + m_blupi[rank].nLoop = static_cast<Sint16> (abs((test.x-cel.x)+(test.y-cel.y))/2); m_blupi[rank].cLoop = 0; m_blupi[rank].vIcon = icon; m_blupi[rank].fix = cel; @@ -4263,15 +4263,15 @@ bool CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) return true; } -// Indique un but visé à long terme, pour tous les blupi +// Indique un but visé à Sint32 terme, pour tous les blupi // sélectionnés. -void CDecor::BlupiGoal(POINT cel, int button) +void CDecor::BlupiGoal(POINT cel, Sint32 button) { POINT bPos, avg; - int rank, nb, nbHili; + Sint32 rank, nb, nbHili; - static int table_sound_go[6] = + static Sint32 table_sound_go[6] = { SOUND_GO1, SOUND_GO2, @@ -4281,14 +4281,14 @@ void CDecor::BlupiGoal(POINT cel, int button) SOUND_GO6, }; - static int table_sound_gom[3] = + static Sint32 table_sound_gom[3] = { SOUND_GO4, SOUND_GO5, SOUND_GO6, }; - static int table_sound_boing[3] = + static Sint32 table_sound_boing[3] = { SOUND_BOING1, SOUND_BOING2, @@ -4367,7 +4367,7 @@ void CDecor::BlupiGoal(POINT cel, int button) bool CDecor::IsTracksHere(POINT cel, bool bSkipInMove) { - int rank; + Sint32 rank; if ( !IsValid(cel) ) return false; @@ -4403,9 +4403,9 @@ bool CDecor::IsTracksHere(POINT cel, bool bSkipInMove) // Indique si une cellule est occupée par un blupi. // Le blupi donné dans exRank est ignoré ! -bool CDecor::IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, bool bSkipInMove) +bool CDecor::IsBlupiHereEx(POINT cel1, POINT cel2, Sint32 exRank, bool bSkipInMove) { - int rank; + Sint32 rank; if ( !IsValid(cel1) ) return false; if ( !IsValid(cel2) ) return false; @@ -4444,9 +4444,9 @@ bool CDecor::IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, bool bSkipInMove) // Indique si une cellule est occupée par un blupi. // Le blupi donné dans exRank est ignoré ! -bool CDecor::IsBlupiHereEx(POINT cel, int exRank, bool bSkipInMove) +bool CDecor::IsBlupiHereEx(POINT cel, Sint32 exRank, bool bSkipInMove) { - int rank; + Sint32 rank; if ( !IsValid(cel) ) return false; @@ -4487,7 +4487,7 @@ bool CDecor::IsBlupiHere(POINT cel, bool bSkipInMove) // Indique si une cellule future (dans une direction donnée) // est déjà occupée par un blupi. -bool CDecor::IsBlupiHere(POINT cel, int direct, bool bSkipInMove) +bool CDecor::IsBlupiHere(POINT cel, Sint32 direct, bool bSkipInMove) { POINT vector; @@ -4502,9 +4502,9 @@ bool CDecor::IsBlupiHere(POINT cel, int direct, bool bSkipInMove) // Retourne les niveaux des jauges. -void CDecor::GetLevelJauge(int *pLevels, int *pTypes) +void CDecor::GetLevelJauge(Sint32 *pLevels, Sint32 *pTypes) { - int rank; + Sint32 rank; pLevels[0] = -1; pLevels[1] = -1; @@ -4536,7 +4536,7 @@ void CDecor::GetLevelJauge(int *pLevels, int *pTypes) // effectue une action prioritaire. Dans ce cas, il faut tout // de suite mettre le menu "stoppe" s'il est cliqué. -bool CDecor::IsWorkBlupi(int rank) +bool CDecor::IsWorkBlupi(Sint32 rank) { if ( m_blupi[rank].bHili && m_blupi[m_rankBlupiHili].goalAction != 0 && @@ -4549,19 +4549,19 @@ bool CDecor::IsWorkBlupi(int rank) // Retourne les boutons possibles à un endroit donné, // pour le blupi sélectionné. -void CDecor::BlupiGetButtons(POINT pos, int &nb, - int *pButtons, int *pErrors, - std::unordered_map<int, const char *> &texts, int &perso) +void CDecor::BlupiGetButtons(POINT pos, Sint32 &nb, + Sint32 *pButtons, Sint32 *pErrors, + std::unordered_map<Sint32, const char *> &texts, Sint32 &perso) { - int* pB = pButtons; - int* pE = pErrors; + Sint32* pB = pButtons; + Sint32* pE = pErrors; POINT cel, cel2; - int i, rank, button, error, channel, icon; + Sint32 i, rank, button, error, channel, icon; bool bBuild = false; bool bPut; const char *textForButton; - static int table_buttons[] = + static Sint32 table_buttons[] = { BUTTON_GO, 0, BUTTON_DJEEP, 0, @@ -4762,9 +4762,9 @@ void CDecor::TerminatedInit() // Retourne 1 si la partie est perdue. // Retourne 2 si la partie est gagnée. -int CDecor::IsTerminated() +Sint32 CDecor::IsTerminated() { - int nb, count, out; + Sint32 nb, count, out; POINT pos; pos.x = LXIMAGE/2; diff --git a/src/decgoal.cpp b/src/decgoal.cpp index 51fed1a..ade053e 100644 --- a/src/decgoal.cpp +++ b/src/decgoal.cpp @@ -4,7 +4,7 @@ #include "def.h" #include "decor.h" -short table_goal_nbop[] = +Sint16 table_goal_nbop[] = { 0, // term 3, // gohili @@ -59,7 +59,7 @@ short table_goal_nbop[] = }; // Va, mon petit. -static short table_goal_go[] = +static Sint16 table_goal_go[] = { WM_ACTION_GO, GOAL_GOHILI, 0,0, false, @@ -68,7 +68,7 @@ static short table_goal_go[] = }; // Blupi va dans sa maison. -static short table_goal_maison[] = +static Sint16 table_goal_maison[] = { WM_ACTION_MAISON, GOAL_GOHILI2, +1,+1, false, @@ -79,7 +79,7 @@ static short table_goal_maison[] = }; // Blupi bucheron. -static short table_goal_abat1[] = +static Sint16 table_goal_abat1[] = { WM_ACTION_ABAT1, GOAL_ENERGY, MAXENERGY/4, @@ -115,7 +115,7 @@ static short table_goal_abat1[] = 0 }; -static short table_goal_abat2[] = +static Sint16 table_goal_abat2[] = { WM_ACTION_ABAT2, GOAL_ENERGY, MAXENERGY/4, @@ -151,7 +151,7 @@ static short table_goal_abat2[] = 0 }; -static short table_goal_abat3[] = +static Sint16 table_goal_abat3[] = { WM_ACTION_ABAT3, GOAL_ENERGY, MAXENERGY/4, @@ -187,7 +187,7 @@ static short table_goal_abat3[] = 0 }; -static short table_goal_abat4[] = +static Sint16 table_goal_abat4[] = { WM_ACTION_ABAT4, GOAL_ENERGY, MAXENERGY/4, @@ -222,7 +222,7 @@ static short table_goal_abat4[] = 0 }; -static short table_goal_abat5[] = +static Sint16 table_goal_abat5[] = { WM_ACTION_ABAT5, GOAL_ENERGY, MAXENERGY/4, @@ -257,7 +257,7 @@ static short table_goal_abat5[] = 0 }; -static short table_goal_abat6[] = +static Sint16 table_goal_abat6[] = { WM_ACTION_ABAT6, GOAL_ENERGY, MAXENERGY/4, @@ -293,7 +293,7 @@ static short table_goal_abat6[] = }; // Blupi tailleur de pierre. -static short table_goal_roc1[] = +static Sint16 table_goal_roc1[] = { WM_ACTION_ROC1, GOAL_ENERGY, MAXENERGY/4, @@ -357,7 +357,7 @@ static short table_goal_roc1[] = 0 }; -static short table_goal_roc2[] = +static Sint16 table_goal_roc2[] = { WM_ACTION_ROC2, GOAL_ENERGY, MAXENERGY/4, @@ -414,7 +414,7 @@ static short table_goal_roc2[] = 0 }; -static short table_goal_roc3[] = +static Sint16 table_goal_roc3[] = { WM_ACTION_ROC3, GOAL_ENERGY, MAXENERGY/4, @@ -464,7 +464,7 @@ static short table_goal_roc3[] = 0 }; -static short table_goal_roc4[] = +static Sint16 table_goal_roc4[] = { WM_ACTION_ROC4, GOAL_ENERGY, MAXENERGY/4, @@ -507,7 +507,7 @@ static short table_goal_roc4[] = 0 }; -static short table_goal_roc5[] = +static Sint16 table_goal_roc5[] = { WM_ACTION_ROC5, GOAL_ENERGY, MAXENERGY/4, @@ -543,7 +543,7 @@ static short table_goal_roc5[] = 0 }; -static short table_goal_roc6[] = +static Sint16 table_goal_roc6[] = { WM_ACTION_ROC6, GOAL_ENERGY, MAXENERGY/4, @@ -572,7 +572,7 @@ static short table_goal_roc6[] = 0 }; -static short table_goal_roc7[] = +static Sint16 table_goal_roc7[] = { WM_ACTION_ROC7, GOAL_ENERGY, MAXENERGY/4, @@ -595,7 +595,7 @@ static short table_goal_roc7[] = }; // Construction d'une cabane. -static short table_goal_build1[] = +static Sint16 table_goal_build1[] = { WM_ACTION_BUILD1, GOAL_ENERGY, MAXENERGY/4, @@ -645,7 +645,7 @@ static short table_goal_build1[] = }; // Construction d'une nurserie. -static short table_goal_build2[] = +static Sint16 table_goal_build2[] = { WM_ACTION_BUILD2, GOAL_ENERGY, MAXENERGY/4, @@ -679,7 +679,7 @@ static short table_goal_build2[] = }; // Construction d'un laboratoire. -static short table_goal_build3[] = +static Sint16 table_goal_build3[] = { WM_ACTION_BUILD3, GOAL_ENERGY, MAXENERGY/4, @@ -717,7 +717,7 @@ static short table_goal_build3[] = }; // Construction d'une mine. -static short table_goal_build4[] = +static Sint16 table_goal_build4[] = { WM_ACTION_BUILD4, GOAL_ENERGY, MAXENERGY/4, @@ -757,7 +757,7 @@ static short table_goal_build4[] = }; // Construction d'une usine. -static short table_goal_build5[] = +static Sint16 table_goal_build5[] = { WM_ACTION_BUILD5, GOAL_ENERGY, MAXENERGY/4, @@ -795,7 +795,7 @@ static short table_goal_build5[] = }; // Construction d'un téléporteur. -static short table_goal_build6[] = +static Sint16 table_goal_build6[] = { WM_ACTION_BUILD6, GOAL_ENERGY, MAXENERGY/4, @@ -831,7 +831,7 @@ static short table_goal_build6[] = }; // Construction d'un mur. -static short table_goal_mur[] = +static Sint16 table_goal_mur[] = { WM_ACTION_MUR, GOAL_ENERGY, MAXENERGY/4, @@ -875,7 +875,7 @@ static short table_goal_mur[] = }; // Construction d'une tour. -static short table_goal_tour[] = +static Sint16 table_goal_tour[] = { WM_ACTION_TOUR, GOAL_ENERGY, MAXENERGY/4, @@ -911,7 +911,7 @@ static short table_goal_tour[] = }; // Construction d'une palissade. -static short table_goal_palis[] = +static Sint16 table_goal_palis[] = { WM_ACTION_PALIS, GOAL_ENERGY, MAXENERGY/4, @@ -936,7 +936,7 @@ static short table_goal_palis[] = }; // Transporte (est). -static short table_goal_carry[] = +static Sint16 table_goal_carry[] = { WM_ACTION_CARRY, GOAL_ENERGY, MAXENERGY/4, @@ -955,7 +955,7 @@ static short table_goal_carry[] = }; // Transporte (sud). -static short table_goal_carry2[] = +static Sint16 table_goal_carry2[] = { WM_ACTION_CARRY2, GOAL_ENERGY, MAXENERGY/4, @@ -974,7 +974,7 @@ static short table_goal_carry2[] = }; // Repose (est). -static short table_goal_depose[] = +static Sint16 table_goal_depose[] = { WM_ACTION_DEPOSE, GOAL_GOHILI2, 0,+1, false, @@ -994,7 +994,7 @@ static short table_goal_depose[] = }; // Repose (sud). -static short table_goal_depose2[] = +static Sint16 table_goal_depose2[] = { WM_ACTION_DEPOSE2, GOAL_GOHILI2, +1,0, false, @@ -1014,7 +1014,7 @@ static short table_goal_depose2[] = }; // Repose des oeufs sur la nurserie. -static short table_goal_newblupi[] = +static Sint16 table_goal_newblupi[] = { WM_ACTION_NEWBLUPI, GOAL_GOHILI2, 0,+1, false, @@ -1051,7 +1051,7 @@ static short table_goal_newblupi[] = }; // Cultive des tomates. -static short table_goal_cultive[] = +static Sint16 table_goal_cultive[] = { WM_ACTION_CULTIVE, GOAL_ENERGY, MAXENERGY/4, @@ -1065,7 +1065,7 @@ static short table_goal_cultive[] = 0 }; -static short table_goal_cultive2[] = +static Sint16 table_goal_cultive2[] = { WM_ACTION_CULTIVE2, GOAL_ENERGY, MAXENERGY/4, @@ -1114,7 +1114,7 @@ static short table_goal_cultive2[] = }; // Bouffe des tomates (est). -static short table_goal_mange[] = +static Sint16 table_goal_mange[] = { WM_ACTION_MANGE, GOAL_GOHILI2, 0,+1, false, @@ -1137,7 +1137,7 @@ static short table_goal_mange[] = }; // Bouffe des tomates (sud). -static short table_goal_mange2[] = +static Sint16 table_goal_mange2[] = { WM_ACTION_MANGE2, GOAL_GOHILI2, +1,0, false, @@ -1160,7 +1160,7 @@ static short table_goal_mange2[] = }; // Boit à la bouteille (est). -static short table_goal_boit[] = +static Sint16 table_goal_boit[] = { WM_ACTION_BOIT, GOAL_GOHILI2, 0,+1, false, @@ -1179,7 +1179,7 @@ static short table_goal_boit[] = }; // Boit à la bouteille (sud). -static short table_goal_boit2[] = +static Sint16 table_goal_boit2[] = { WM_ACTION_BOIT2, GOAL_GOHILI2, +1,0, false, @@ -1198,7 +1198,7 @@ static short table_goal_boit2[] = }; // Cueille des fleurs. -static short table_goal_fleur1[] = +static Sint16 table_goal_fleur1[] = { WM_ACTION_FLEUR1, GOAL_ENERGY, MAXENERGY/4, @@ -1226,7 +1226,7 @@ static short table_goal_fleur1[] = }; // Cueille des fleurs. -static short table_goal_fleur2[] = +static Sint16 table_goal_fleur2[] = { WM_ACTION_FLEUR2, GOAL_ENERGY, MAXENERGY/4, @@ -1254,7 +1254,7 @@ static short table_goal_fleur2[] = }; // Cueille des fleurs. -static short table_goal_fleur3[] = +static Sint16 table_goal_fleur3[] = { WM_ACTION_FLEUR3, GOAL_ENERGY, MAXENERGY/4, @@ -1282,7 +1282,7 @@ static short table_goal_fleur3[] = }; // Transforme des fleurs. -static short table_goal_labo[] = +static Sint16 table_goal_labo[] = { WM_ACTION_LABO, GOAL_ENERGY, MAXENERGY/4, @@ -1324,7 +1324,7 @@ static short table_goal_labo[] = }; // Blupi fait péter la dynamite. -static short table_goal_dynamite[] = +static Sint16 table_goal_dynamite[] = { WM_ACTION_DYNAMITE, //? GOAL_ENERGY, MAXENERGY/4, @@ -1374,7 +1374,7 @@ static short table_goal_dynamite[] = }; // Blupi fait péter la dynamite très fort. -static short table_goal_dynamite2[] = +static Sint16 table_goal_dynamite2[] = { WM_ACTION_DYNAMITE2, //? GOAL_ENERGY, MAXENERGY/4, @@ -1487,7 +1487,7 @@ static short table_goal_dynamite2[] = }; // Tracks fait péter la dynamite. -static short table_goal_t_dynamite[] = +static Sint16 table_goal_t_dynamite[] = { WM_ACTION_T_DYNAMITE, GOAL_GOHILI2, +1,+1, false, @@ -1530,7 +1530,7 @@ static short table_goal_t_dynamite[] = }; // Blupi amorce une mine. -static short table_goal_mine[] = +static Sint16 table_goal_mine[] = { WM_ACTION_MINE, GOAL_ENERGY, MAXENERGY/4, @@ -1549,7 +1549,7 @@ static short table_goal_mine[] = }; // Détonnateur de mine créé par GOAL_AMORCE (blupi invisible). -static short table_goal_mine2[] = +static Sint16 table_goal_mine2[] = { WM_ACTION_MINE2, GOAL_PUTOBJECT, -1,-1, CHOBJECT,127, @@ -1692,7 +1692,7 @@ static short table_goal_mine2[] = }; // Construit un pont en direction de l'est. -static short table_goal_ponte[] = +static Sint16 table_goal_ponte[] = { WM_ACTION_PONTE, GOAL_ENERGY, MAXENERGY/4, @@ -1713,7 +1713,7 @@ static short table_goal_ponte[] = 0 }; -static short table_goal_pontel[] = +static Sint16 table_goal_pontel[] = { WM_ACTION_PONTEL, GOAL_GROUP, 3, @@ -1739,7 +1739,7 @@ static short table_goal_pontel[] = }; // Construit un pont en direction de l'ouest. -static short table_goal_ponto[] = +static Sint16 table_goal_ponto[] = { WM_ACTION_PONTO, GOAL_ENERGY, MAXENERGY/4, @@ -1759,7 +1759,7 @@ static short table_goal_ponto[] = 0 }; -static short table_goal_pontol[] = +static Sint16 table_goal_pontol[] = { WM_ACTION_PONTOL, GOAL_GROUP, 3, @@ -1785,7 +1785,7 @@ static short table_goal_pontol[] = }; // Construit un pont en direction du sud. -static short table_goal_ponts[] = +static Sint16 table_goal_ponts[] = { WM_ACTION_PONTS, GOAL_ENERGY, MAXENERGY/4, @@ -1805,7 +1805,7 @@ static short table_goal_ponts[] = 0 }; -static short table_goal_pontsl[] = +static Sint16 table_goal_pontsl[] = { WM_ACTION_PONTSL, GOAL_GROUP, 3, @@ -1831,7 +1831,7 @@ static short table_goal_pontsl[] = }; // Construit un pont en direction du nord. -static short table_goal_pontn[] = +static Sint16 table_goal_pontn[] = { WM_ACTION_PONTN, GOAL_ENERGY, MAXENERGY/4, @@ -1850,7 +1850,7 @@ static short table_goal_pontn[] = 0 }; -static short table_goal_pontnl[] = +static Sint16 table_goal_pontnl[] = { WM_ACTION_PONTNL, GOAL_GROUP, 3, @@ -1876,7 +1876,7 @@ static short table_goal_pontnl[] = }; // Construit un bateau. -static short table_goal_bateaue[] = +static Sint16 table_goal_bateaue[] = { WM_ACTION_BATEAUE, GOAL_ENERGY, MAXENERGY/4, @@ -1909,7 +1909,7 @@ static short table_goal_bateaue[] = 0 }; -static short table_goal_bateaus[] = +static Sint16 table_goal_bateaus[] = { WM_ACTION_BATEAUS, GOAL_ENERGY, MAXENERGY/4, @@ -1941,7 +1941,7 @@ static short table_goal_bateaus[] = 0 }; -static short table_goal_bateauo[] = +static Sint16 table_goal_bateauo[] = { WM_ACTION_BATEAUO, GOAL_ENERGY, MAXENERGY/4, @@ -1974,7 +1974,7 @@ static short table_goal_bateauo[] = 0 }; -static short table_goal_bateaun[] = +static Sint16 table_goal_bateaun[] = { WM_ACTION_BATEAUN, GOAL_ENERGY, MAXENERGY/4, @@ -2007,7 +2007,7 @@ static short table_goal_bateaun[] = }; // Départ en bateau. -static short table_goal_bateaude[] = +static Sint16 table_goal_bateaude[] = { WM_ACTION_BATEAUDE, GOAL_ISNOMALADE, @@ -2031,7 +2031,7 @@ static short table_goal_bateaude[] = 0 }; -static short table_goal_bateauds[] = +static Sint16 table_goal_bateauds[] = { WM_ACTION_BATEAUDS, GOAL_ISNOMALADE, @@ -2054,7 +2054,7 @@ static short table_goal_bateauds[] = 0 }; -static short table_goal_bateaudo[] = +static Sint16 table_goal_bateaudo[] = { WM_ACTION_BATEAUDO, GOAL_ISNOMALADE, @@ -2077,7 +2077,7 @@ static short table_goal_bateaudo[] = 0 }; -static short table_goal_bateaudn[] = +static Sint16 table_goal_bateaudn[] = { WM_ACTION_BATEAUDN, GOAL_ISNOMALADE, @@ -2101,7 +2101,7 @@ static short table_goal_bateaudn[] = }; // Arrivée en bateau. -static short table_goal_bateauae[] = +static Sint16 table_goal_bateauae[] = { WM_ACTION_BATEAUAE, GOAL_GOHILI2, 0,+1, false, @@ -2128,7 +2128,7 @@ static short table_goal_bateauae[] = 0 }; -static short table_goal_bateauas[] = +static Sint16 table_goal_bateauas[] = { WM_ACTION_BATEAUAS, GOAL_GOHILI2, +1,0, false, @@ -2147,7 +2147,7 @@ static short table_goal_bateauas[] = 0 }; -static short table_goal_bateauao[] = +static Sint16 table_goal_bateauao[] = { WM_ACTION_BATEAUAO, GOAL_GOHILI2, 0,+1, false, @@ -2166,7 +2166,7 @@ static short table_goal_bateauao[] = 0 }; -static short table_goal_bateauan[] = +static Sint16 table_goal_bateauan[] = { WM_ACTION_BATEAUAN, GOAL_GOHILI2, +1,0, false, @@ -2186,7 +2186,7 @@ static short table_goal_bateauan[] = }; // Le robot construit une station de recharge. -static short table_goal_r_build1[] = +static Sint16 table_goal_r_build1[] = { WM_ACTION_R_BUILD1, GOAL_GOHILI2, +1,+1, false, @@ -2224,7 +2224,7 @@ static short table_goal_r_build1[] = }; // Le robot construit une usine à araignées. -static short table_goal_r_build2[] = +static Sint16 table_goal_r_build2[] = { WM_ACTION_R_BUILD2, GOAL_GOHILI2, +1,+1, false, @@ -2262,7 +2262,7 @@ static short table_goal_r_build2[] = }; // Le robot construit une usine à virus. -static short table_goal_r_build3[] = +static Sint16 table_goal_r_build3[] = { WM_ACTION_R_BUILD3, GOAL_GOHILI2, +1,+1, false, @@ -2300,7 +2300,7 @@ static short table_goal_r_build3[] = }; // Le robot construit une usine à tracks. -static short table_goal_r_build4[] = +static Sint16 table_goal_r_build4[] = { WM_ACTION_R_BUILD4, GOAL_GOHILI2, +1,+1, false, @@ -2338,7 +2338,7 @@ static short table_goal_r_build4[] = }; // Le robot construit une usine à bombe. -static short table_goal_r_build5[] = +static Sint16 table_goal_r_build5[] = { WM_ACTION_R_BUILD5, GOAL_GOHILI2, +1,+1, false, @@ -2376,7 +2376,7 @@ static short table_goal_r_build5[] = }; // Le robot construit une usine à électro. -static short table_goal_r_build6[] = +static Sint16 table_goal_r_build6[] = { WM_ACTION_R_BUILD6, GOAL_GOHILI2, +1,+1, false, @@ -2414,7 +2414,7 @@ static short table_goal_r_build6[] = }; // Le robot se recharge. -static short table_goal_r_make1[] = +static Sint16 table_goal_r_make1[] = { WM_ACTION_R_MAKE1, GOAL_GOHILI2, +1,+1, false, @@ -2437,7 +2437,7 @@ static short table_goal_r_make1[] = }; // Le robot construit une araignée. -static short table_goal_r_make2[] = +static Sint16 table_goal_r_make2[] = { WM_ACTION_R_MAKE2, GOAL_GOHILI2, +2,+1, false, @@ -2502,7 +2502,7 @@ static short table_goal_r_make2[] = }; // Le robot construit un virus. -static short table_goal_r_make3[] = +static Sint16 table_goal_r_make3[] = { WM_ACTION_R_MAKE3, GOAL_GOHILI2, +2,+1, false, @@ -2566,7 +2566,7 @@ static short table_goal_r_make3[] = }; // Le robot construit un tracks. -static short table_goal_r_make4[] = +static Sint16 table_goal_r_make4[] = { WM_ACTION_R_MAKE4, GOAL_GOHILI2, +2,+1, false, @@ -2630,7 +2630,7 @@ static short table_goal_r_make4[] = }; // Le robot construit une bombe. -static short table_goal_r_make5[] = +static Sint16 table_goal_r_make5[] = { WM_ACTION_R_MAKE5, GOAL_GOHILI2, +2,+1, false, @@ -2694,7 +2694,7 @@ static short table_goal_r_make5[] = }; // Le robot construit un électro. -static short table_goal_r_make6[] = +static Sint16 table_goal_r_make6[] = { WM_ACTION_R_MAKE6, GOAL_GOHILI2, +2,+1, false, @@ -2758,7 +2758,7 @@ static short table_goal_r_make6[] = }; // Blupi monte dans une jeep. -static short table_goal_mjeep[] = +static Sint16 table_goal_mjeep[] = { WM_ACTION_MJEEP, GOAL_ISNOMALADE, @@ -2782,7 +2782,7 @@ static short table_goal_mjeep[] = }; // Blupi descend de la jeep. -static short table_goal_djeep[] = +static Sint16 table_goal_djeep[] = { WM_ACTION_DJEEP, GOAL_GOHILI2, +1,+1, false, @@ -2809,7 +2809,7 @@ static short table_goal_djeep[] = }; // Blupi monte dans une armure. -static short table_goal_marmure[] = +static Sint16 table_goal_marmure[] = { WM_ACTION_MARMURE, GOAL_ISNOMALADE, @@ -2852,7 +2852,7 @@ static short table_goal_marmure[] = }; // Blupi descend de l'armure. -static short table_goal_darmure[] = +static Sint16 table_goal_darmure[] = { WM_ACTION_DARMURE, GOAL_GOHILI2, +1,+1, false, @@ -2874,7 +2874,7 @@ static short table_goal_darmure[] = }; // Blupi cherche où planter des drapeaux. -static short table_goal_drapeau[] = +static Sint16 table_goal_drapeau[] = { WM_ACTION_DRAPEAU, GOAL_ENERGY, MAXENERGY/4, @@ -2888,7 +2888,7 @@ static short table_goal_drapeau[] = 0 }; -static short table_goal_drapeau2[] = +static Sint16 table_goal_drapeau2[] = { WM_ACTION_DRAPEAU2, GOAL_ENERGY, MAXENERGY/4, @@ -2910,7 +2910,7 @@ static short table_goal_drapeau2[] = }; // Plante un drapeau. -static short table_goal_drapeau3[] = +static Sint16 table_goal_drapeau3[] = { WM_ACTION_DRAPEAU3, GOAL_ENERGY, MAXENERGY/4, @@ -2933,7 +2933,7 @@ static short table_goal_drapeau3[] = }; // Blupi extrait du fer. -static short table_goal_extrait[] = +static Sint16 table_goal_extrait[] = { WM_ACTION_EXTRAIT, GOAL_ENERGY, MAXENERGY/4, @@ -2980,7 +2980,7 @@ static short table_goal_extrait[] = }; // Blupi fabrique une jeep. -static short table_goal_fabjeep[] = +static Sint16 table_goal_fabjeep[] = { WM_ACTION_FABJEEP, GOAL_ENERGY, MAXENERGY/4, @@ -3023,7 +3023,7 @@ static short table_goal_fabjeep[] = }; // Blupi fabrique une armure. -static short table_goal_fabarmure[] = +static Sint16 table_goal_fabarmure[] = { WM_ACTION_FABARMURE, GOAL_ENERGY, MAXENERGY/4, @@ -3066,7 +3066,7 @@ static short table_goal_fabarmure[] = }; // Blupi fabrique une mine. -static short table_goal_fabmine[] = +static Sint16 table_goal_fabmine[] = { WM_ACTION_FABMINE, GOAL_ENERGY, MAXENERGY/4, @@ -3113,7 +3113,7 @@ static short table_goal_fabmine[] = }; // Blupi fabrique un disciple. -static short table_goal_fabdisc[] = +static Sint16 table_goal_fabdisc[] = { WM_ACTION_FABDISC, GOAL_ENERGY, MAXENERGY/4, @@ -3165,7 +3165,7 @@ static short table_goal_fabdisc[] = }; // L'électro va sur un blupi puis lance ses rayons. -static short table_goal_e_rayon[] = +static Sint16 table_goal_e_rayon[] = { WM_ACTION_E_RAYON, GOAL_GOHILI2, 0,0, false, @@ -3255,7 +3255,7 @@ static short table_goal_e_rayon[] = }; // Blupi s'électrocute. -static short table_goal_electro[] = +static Sint16 table_goal_electro[] = { WM_ACTION_ELECTRO, GOAL_INTERRUPT, 0, // prioritaire @@ -3272,7 +3272,7 @@ static short table_goal_electro[] = 0 }; -static short table_goal_electrom[] = +static Sint16 table_goal_electrom[] = { WM_ACTION_ELECTROm, GOAL_INTERRUPT, 0, // prioritaire @@ -3290,7 +3290,7 @@ static short table_goal_electrom[] = }; // Blupi grille. -static short table_goal_grille[] = +static Sint16 table_goal_grille[] = { WM_ACTION_GRILLE, GOAL_INTERRUPT, 0, // prioritaire @@ -3308,7 +3308,7 @@ static short table_goal_grille[] = }; // L'araignée meurt. -static short table_goal_a_mort[] = +static Sint16 table_goal_a_mort[] = { WM_ACTION_A_MORT, GOAL_INTERRUPT, 0, // prioritaire @@ -3324,7 +3324,7 @@ static short table_goal_a_mort[] = }; // Blupi se prépare à répéter une liste. -static short table_goal_repeat[] = +static Sint16 table_goal_repeat[] = { WM_ACTION_REPEAT, GOAL_TERM, @@ -3332,7 +3332,7 @@ static short table_goal_repeat[] = }; // Blupi se téléporte d'un endroit à un autre. -static short table_goal_teleporte00[] = +static Sint16 table_goal_teleporte00[] = { WM_ACTION_TELEPORTE00, GOAL_GOHILI2, 0,0, false, @@ -3355,7 +3355,7 @@ static short table_goal_teleporte00[] = 0 }; -static short table_goal_teleporte10[] = +static Sint16 table_goal_teleporte10[] = { WM_ACTION_TELEPORTE10, GOAL_GOHILI2, +1,0, false, @@ -3378,7 +3378,7 @@ static short table_goal_teleporte10[] = 0 }; -static short table_goal_teleporte01[] = +static Sint16 table_goal_teleporte01[] = { WM_ACTION_TELEPORTE01, GOAL_GOHILI2, 0,+1, false, @@ -3401,7 +3401,7 @@ static short table_goal_teleporte01[] = 0 }; -static short table_goal_teleporte11[] = +static Sint16 table_goal_teleporte11[] = { WM_ACTION_TELEPORTE11, GOAL_GOHILI2, +1,+1, false, @@ -3425,7 +3425,7 @@ static short table_goal_teleporte11[] = }; -static short* table_pGoal[] = +static Sint16* table_pGoal[] = { table_goal_go, table_goal_maison, @@ -3530,9 +3530,9 @@ static short* table_pGoal[] = // Retourne le pointeur à la table table_goal_*. -short* GetTableGoal(int action) +Sint16* GetTableGoal(Sint32 action) { - short** ppTable = table_pGoal; + Sint16** ppTable = table_pGoal; while ( *ppTable != nullptr ) { diff --git a/src/decgoal.h b/src/decgoal.h index 4fe5307..4ae86b9 100644 --- a/src/decgoal.h +++ b/src/decgoal.h @@ -1,6 +1,8 @@ #pragma once +#include <SDL2/SDL_stdinc.h> + // Méta opérations (goal). #define GOAL_TERM 0 // @@ -54,5 +56,5 @@ #define GOAL_ACTUALISE 48 // #define GOAL_WAITFREE 49 // dx,dy -short* GetTableGoal (int action); -extern short table_goal_nbop[]; +Sint16* GetTableGoal (Sint32 action); +extern Sint16 table_goal_nbop[]; diff --git a/src/decio.cpp b/src/decio.cpp index b5405c7..f5af3f3 100644 --- a/src/decio.cpp +++ b/src/decio.cpp @@ -7,81 +7,81 @@ typedef struct { - short majRev; - short minRev; - long nbDecor; - long lgDecor; - long nbBlupi; - long lgBlupi; - long nbMove; - long lgMove; - short reserve1[100]; + Sint16 majRev; + Sint16 minRev; + Sint32 nbDecor; + Sint32 lgDecor; + Sint32 nbBlupi; + Sint32 lgBlupi; + Sint32 nbMove; + Sint32 lgMove; + Sint16 reserve1[100]; POINT celCoin; - short world; - long time; + Sint16 world; + Sint32 time; char buttonExist[MAXBUTTON]; Term term; - short music; - short region; - long totalTime; - short skill; + Sint16 music; + Sint16 region; + Sint32 totalTime; + Sint16 skill; POINT memoPos[4]; - short reserve2[29]; + Sint16 reserve2[29]; } DescFile; typedef struct { - int bExist; // true -> utilisé - int bHili; // true -> sélectionné + Sint32 bExist; // true -> utilisé + Sint32 bHili; // true -> sélectionné - short perso; // personnage, voir (*) + Sint16 perso; // personnage, voir (*) - short goalAction; // action (long terme) - short goalPhase; // phase (long terme) - POINT goalCel; // cellule visée (long terme) + Sint16 goalAction; // action (Sint32 terme) + Sint16 goalPhase; // phase (Sint32 terme) + POINT goalCel; // cellule visée (Sint32 terme) POINT passCel; // cellule tranversante - short energy; // énergie restante + Sint16 energy; // énergie restante POINT cel; // cellule actuelle POINT destCel; // cellule destination - short action; // action en cours - short aDirect; // direction actuelle - short sDirect; // direction souhaitée + Sint16 action; // action en cours + Sint16 aDirect; // direction actuelle + Sint16 sDirect; // direction souhaitée POINT pos; // position relative à partir de la cellule - short posZ; // déplacement z - short channel; - short lastIcon; - short icon; - short phase; // phase dans l'action - short step; // pas global - short interrupt; // 0=prioritaire, 1=normal, 2=misc - short clipLeft; - - int nbUsed; // nb de points déjà visités + Sint16 posZ; // déplacement z + Sint16 channel; + Sint16 lastIcon; + Sint16 icon; + Sint16 phase; // phase dans l'action + Sint16 step; // pas global + Sint16 interrupt; // 0=prioritaire, 1=normal, 2=misc + Sint16 clipLeft; + + Sint32 nbUsed; // nb de points déjà visités char nextRankUsed; POINT posUsed[MAXUSED]; char rankUsed[MAXUSED]; - short takeChannel; // objet transporté - short takeIcon; + Sint16 takeChannel; // objet transporté + Sint16 takeIcon; POINT fix; // point fixe (cultive, pont) - short jaugePhase; - short jaugeMax; - short stop; // 1 -> devra stopper - short bArrow; // true -> flèche en dessus de blupi - short bRepeat; // true -> répète l'action - short nLoop; // nb de boucles pour GOAL_OTHERLOOP - short cLoop; // boucle en cours - short vIcon; // icône variable + Sint16 jaugePhase; + Sint16 jaugeMax; + Sint16 stop; // 1 -> devra stopper + Sint16 bArrow; // true -> flèche en dessus de blupi + Sint16 bRepeat; // true -> répète l'action + Sint16 nLoop; // nb de boucles pour GOAL_OTHERLOOP + Sint16 cLoop; // boucle en cours + Sint16 vIcon; // icône variable POINT goalHili; // but visé - short bMalade; // true -> blupi malade - short bCache; // true -> caché (pas dessiné) - short vehicule; // véhicule utilisé par blupi, voir (**) + Sint16 bMalade; // true -> blupi malade + Sint16 bCache; // true -> caché (pas dessiné) + Sint16 vehicule; // véhicule utilisé par blupi, voir (**) char busyCount; char busyDelay; char clicCount; @@ -93,12 +93,12 @@ OldBlupi; // Sauve le décor sur disque. -bool CDecor::Write(int rank, bool bUser, int world, int time, int total) +bool CDecor::Write(Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total) { char filename[MAX_PATH]; FILE* file = nullptr; DescFile* pBuffer = nullptr; - int i; + Sint32 i; size_t nb; if ( bUser ) @@ -172,13 +172,13 @@ bool CDecor::Write(int rank, bool bUser, int world, int time, int total) // Lit le décor sur disque. -bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total) +bool CDecor::Read(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &total) { char filename[MAX_PATH]; FILE* file = nullptr; DescFile* pBuffer = nullptr; - int majRev, minRev; - int i, x, y; + Sint32 majRev, minRev; + Sint32 i, x, y; size_t nb; OldBlupi oldBlupi; @@ -313,12 +313,12 @@ bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total) // Indique si un fichier existe sur disque. -bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total) +bool CDecor::FileExist(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &total) { char filename[MAX_PATH]; FILE* file = nullptr; DescFile* pBuffer = nullptr; - int majRev, minRev; + Sint32 majRev, minRev; size_t nb; if ( bUser ) @@ -385,7 +385,7 @@ bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total) void CDecor::Flush() { - int x, y, i, icon; + Sint32 x, y, i, icon; Init(-1, -1); diff --git a/src/decmap.cpp b/src/decmap.cpp index 0d81fd5..ab216f2 100644 --- a/src/decmap.cpp +++ b/src/decmap.cpp @@ -410,7 +410,7 @@ static char color_fire[4] = void CDecor::MapPutCel(POINT pos) { POINT cel, fogCel; - int icon, i; + Sint32 icon, i; char* pColors; cel = ConvMapToCel(pos); @@ -479,7 +479,7 @@ void CDecor::MapPutCel(POINT pos) bool CDecor::GenerateMap() { POINT dim, pos, cel; - int dx, rank, i; + Sint32 dx, rank, i; if ( m_phase != -1 && m_phase%20 != 0 ) return true; diff --git a/src/decmove.cpp b/src/decmove.cpp index 7f1a150..73167c1 100644 --- a/src/decmove.cpp +++ b/src/decmove.cpp @@ -7,7 +7,7 @@ // Mouvement pour secouer un arbre // (synchrone avec ACTION_PIOCHE). -static short table_move1[] = +static Sint16 table_move1[] = { 9*4, // nb 0,0, 0,0, 0,0, 0,0, @@ -23,7 +23,7 @@ static short table_move1[] = // Mouvement pour faire sauter un objet (est) sur blupi // (synchrone avec ACTION_TAKE). -static short table_move2[] = +static Sint16 table_move2[] = { 9+19, // nb 0,0, 0,0, @@ -51,7 +51,7 @@ static short table_move2[] = // Mouvement pour faire sauter un objet (sud) sur blupi // (synchrone avec ACTION_TAKE2). -static short table_move3[] = +static Sint16 table_move3[] = { 9+19, // nb 0,0, 0,0, @@ -79,7 +79,7 @@ static short table_move3[] = // Mouvement pour déposer un objet (est) sur blupi // (synchrone avec ACTION_DEPOSE). -static short table_move4[] = +static Sint16 table_move4[] = { 10, // nb -30,-60, @@ -96,7 +96,7 @@ static short table_move4[] = // Mouvement pour déposer un objet (sud) sur blupi // (synchrone avec ACTION_DEPOSE2). -static short table_move5[] = +static Sint16 table_move5[] = { 10, // nb 30,-60, @@ -112,7 +112,7 @@ static short table_move5[] = }; // Mouvement pour pousser un pont vers l'est. -static short table_move6[] = +static Sint16 table_move6[] = { 40, // nb +2,+1, @@ -158,7 +158,7 @@ static short table_move6[] = }; // Mouvement pour pousser un pont vers l'ouest. -static short table_move7[] = +static Sint16 table_move7[] = { 40, // nb -2,-1, @@ -204,7 +204,7 @@ static short table_move7[] = }; // Mouvement pour pousser un pont vers le sud. -static short table_move8[] = +static Sint16 table_move8[] = { 40, // nb -2,+1, @@ -250,7 +250,7 @@ static short table_move8[] = }; // Mouvement pour pousser un pont vers le nord. -static short table_move9[] = +static Sint16 table_move9[] = { 40, // nb +2,-1, @@ -296,7 +296,7 @@ static short table_move9[] = }; // Mouvement pour secouer le laboratoire. -static short table_move10[] = +static Sint16 table_move10[] = { 16*4, // nb -2,0, +2,0, -2,0, +2,0, @@ -318,7 +318,7 @@ static short table_move10[] = }; // Mouvement pour secouer la mine. -static short table_move11[] = +static Sint16 table_move11[] = { 20*4, // nb 0,-1, 0,+1, 0,-1, 0,+1, @@ -344,7 +344,7 @@ static short table_move11[] = }; // Mouvement pour secouer l'usine. -static short table_move12[] = +static Sint16 table_move12[] = { 20*4, // nb -1,0, +1,0, -1,0, +1,0, @@ -369,7 +369,7 @@ static short table_move12[] = -2,0, +2,0, 0,+1, 0,+1, }; -short* GetListMoves(int rank) +Sint16* GetListMoves(Sint32 rank) { if ( rank == 1 ) return table_move1; if ( rank == 2 ) return table_move2; @@ -389,7 +389,7 @@ short* GetListMoves(int rank) // Petites flammes. -static short table_icon1[] = +static Sint16 table_icon1[] = { 8*3, 49,50,51,52,50,49,51,52, @@ -398,7 +398,7 @@ static short table_icon1[] = }; // Grandes flammes. -static short table_icon2[] = +static Sint16 table_icon2[] = { 8*3, 45,46,47,48,46,45,48,47, @@ -407,14 +407,14 @@ static short table_icon2[] = }; // Eclairs de la dalle nurserie. -static short table_icon3[] = +static Sint16 table_icon3[] = { 4, // nb 53,54,55,56, }; // Eclairs n-s entre les tours. -static short table_icon4[] = +static Sint16 table_icon4[] = { 8*4, // nb 74,76,78,76,74,78,74,76, @@ -424,7 +424,7 @@ static short table_icon4[] = }; // Eclairs e-o entre les tours. -static short table_icon5[] = +static Sint16 table_icon5[] = { 8*4, // nb 75,77,75,79,75,77,79,75, @@ -434,7 +434,7 @@ static short table_icon5[] = }; // Explosion de la dynamite. -static short table_icon6[] = +static Sint16 table_icon6[] = { 7+30, // nb 91,90,89,88,89,90,91, @@ -444,7 +444,7 @@ static short table_icon6[] = }; // Mèche de la dynamite. -static short table_icon7[] = +static Sint16 table_icon7[] = { 12*4, // nb 86,87,86,87,86,87,86,87,86,87,86,87, @@ -454,7 +454,7 @@ static short table_icon7[] = }; // Rayons de l'électrocuteur. -static short table_icon8[] = +static Sint16 table_icon8[] = { 10*10, // nb 75,-1,-1,74,-1,75,-1,74,75,-1, @@ -470,7 +470,7 @@ static short table_icon8[] = }; // Blupi écrasé. -static short table_icon9[] = +static Sint16 table_icon9[] = { 10*10, // nb 76,76,76,76,76,76,76,76,76,76, @@ -486,7 +486,7 @@ static short table_icon9[] = }; // Blupi malade écrasé. -static short table_icon10[] = +static Sint16 table_icon10[] = { 10*10, // nb 77,77,77,77,77,77,77,77,77,77, @@ -502,13 +502,13 @@ static short table_icon10[] = }; // Eclairs de la dalle téléporteur. -static short table_icon11[] = +static Sint16 table_icon11[] = { 4, // nb 81,82,83,84, }; -short* GetListIcons(int rank) +Sint16* GetListIcons(Sint32 rank) { if ( rank == 1 ) return table_icon1; if ( rank == 2 ) return table_icon2; @@ -532,7 +532,7 @@ short* GetListIcons(int rank) void CDecor::MoveFlush() { - int i, x, y; + Sint32 i, x, y; for ( i=0 ; i<MAXMOVE ; i++ ) { @@ -550,7 +550,7 @@ void CDecor::MoveFlush() // Retourne la durée du feu. -int CDecor::MoveMaxFire() +Sint32 CDecor::MoveMaxFire() { if ( m_skill >= 1 ) return (MAXFIRE/4)*3; return MAXFIRE; @@ -560,7 +560,7 @@ int CDecor::MoveMaxFire() void CDecor::MoveFixInit() { - int x, y; + Sint32 x, y; MoveFlush(); @@ -601,13 +601,13 @@ void CDecor::MoveFixInit() // Si bMisc=true, on garde 10 mouvements en réserve pour // des actions importantes (bMisc=false). -bool CDecor::MoveCreate(POINT cel, int rankBlupi, bool bFloor, - int channel, int icon, - int maskChannel, int maskIcon, - int total, int delai, int stepY, +bool CDecor::MoveCreate(POINT cel, Sint32 rankBlupi, bool bFloor, + Sint32 channel, Sint32 icon, + Sint32 maskChannel, Sint32 maskIcon, + Sint32 total, Sint32 delai, Sint32 stepY, bool bMisc, bool bNotIfExist) { - int rank, max; + Sint32 rank, max; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -656,9 +656,9 @@ bool CDecor::MoveCreate(POINT cel, int rankBlupi, bool bFloor, // Ajoute un mouvement. -bool CDecor::MoveAddMoves(POINT cel, int rankMoves) +bool CDecor::MoveAddMoves(POINT cel, Sint32 rankMoves) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -678,9 +678,9 @@ bool CDecor::MoveAddMoves(POINT cel, int rankMoves) // Ajoute un mouvement. -bool CDecor::MoveAddIcons(POINT cel, int rankIcons, bool bContinue) +bool CDecor::MoveAddIcons(POINT cel, Sint32 rankIcons, bool bContinue) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -708,7 +708,7 @@ bool CDecor::MoveAddIcons(POINT cel, int rankIcons, bool bContinue) bool CDecor::MoveStartFire(POINT cel) { - int channel, icon; + Sint32 channel, icon; cel.x = (cel.x/2)*2; cel.y = (cel.y/2)*2; @@ -760,10 +760,10 @@ bool CDecor::MoveStartFire(POINT cel) void CDecor::MoveProxiFire(POINT cel) { - int cx, cy, xx, yy, x, y, channel, icon; + Sint32 cx, cy, xx, yy, x, y, channel, icon; - static short tableInd[5] = {2,1,3,0,4}; - static short tablePos[5*5*2] = + static Sint16 tableInd[5] = {2,1,3,0,4}; + static Sint16 tablePos[5*5*2] = { 0, 0, -1,-2, 0,-2, +1,-2, 0, 0, -2,-1, -1,-1, 0,-1, +1,-1, +2,-1, @@ -817,9 +817,9 @@ void CDecor::MoveProxiFire(POINT cel) // Fait évoluer le feu. -void CDecor::MoveFire(int rank) +void CDecor::MoveFire(Sint32 rank) { - int x, y, icon, newIcon; + Sint32 x, y, icon, newIcon; POINT pos; x = (m_move[rank].cel.x/2)*2; @@ -956,7 +956,7 @@ void CDecor::MoveFire(int rank) void CDecor::MoveStep(bool bFirst) { - int rank, rankBlupi; + Sint32 rank, rankBlupi; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -1011,7 +1011,7 @@ void CDecor::MoveStep(bool bFirst) void CDecor::MoveFinish(POINT cel) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -1040,9 +1040,9 @@ void CDecor::MoveFinish(POINT cel) // Termine un mouvement, d'après le rang du blupi. -void CDecor::MoveFinish(int rankBlupi) +void CDecor::MoveFinish(Sint32 rankBlupi) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -1058,7 +1058,7 @@ void CDecor::MoveFinish(int rankBlupi) bool CDecor::MoveIsUsed(POINT cel) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -1075,9 +1075,9 @@ bool CDecor::MoveIsUsed(POINT cel) // Retourne l'objet en construction à un endroit donné. -bool CDecor::MoveGetObject(POINT cel, int &channel, int &icon) +bool CDecor::MoveGetObject(POINT cel, Sint32 &channel, Sint32 &icon) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { @@ -1097,9 +1097,9 @@ bool CDecor::MoveGetObject(POINT cel, int &channel, int &icon) // Modifie un objet en construction à un endroit donné. -bool CDecor::MovePutObject(POINT cel, int channel, int icon) +bool CDecor::MovePutObject(POINT cel, Sint32 channel, Sint32 icon) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXMOVE ; rank++ ) { diff --git a/src/decmove.h b/src/decmove.h index 8354020..46c541b 100644 --- a/src/decmove.h +++ b/src/decmove.h @@ -1,4 +1,4 @@ #pragma once -short * GetListMoves (int rank); -short * GetListIcons (int rank); +Sint16 * GetListMoves (Sint32 rank); +Sint16 * GetListIcons (Sint32 rank); diff --git a/src/decor.cpp b/src/decor.cpp index 23fcbea..dfa00a6 100644 --- a/src/decor.cpp +++ b/src/decor.cpp @@ -23,7 +23,7 @@ #define TEXTDELAY 10 // délai avant apparition tooltips -POINT GetCel(int x, int y) +POINT GetCel(Sint32 x, Sint32 y) { POINT cel; @@ -33,7 +33,7 @@ POINT GetCel(int x, int y) return cel; } -POINT GetCel(POINT cel, int x, int y) +POINT GetCel(POINT cel, Sint32 x, Sint32 y) { cel.x += x; cel.y += y; @@ -55,7 +55,7 @@ bool IsValid(POINT cel) // Retourne un vecteur orienté dans une direction donnée. -POINT GetVector(int direct) +POINT GetVector(Sint32 direct) { POINT vector; @@ -158,9 +158,9 @@ void CDecor::Create(CSound *pSound, CPixmap *pPixmap) // Initialise le décor avec un sol plat partout. -void CDecor::Init(int channel, int icon) +void CDecor::Init(Sint32 channel, Sint32 icon) { - int x, y; + Sint32 x, y; for ( x=0 ; x<MAXCELX/2 ; x++ ) { @@ -250,7 +250,7 @@ bool CDecor::LoadImages() void CDecor::ClearFog() { - int x, y, rank; + Sint32 x, y, rank; for ( x=0 ; x<MAXCELX/2 ; x++ ) { @@ -275,7 +275,7 @@ void CDecor::ClearFog() void CDecor::ClearFire() { - int x, y; + Sint32 x, y; for ( x=0 ; x<MAXCELX/2 ; x++ ) { @@ -343,7 +343,7 @@ void CDecor::FlipOutline() // Initialise un sol dans une cellule. -bool CDecor::PutFloor(POINT cel, int channel, int icon) +bool CDecor::PutFloor(POINT cel, Sint32 channel, Sint32 icon) { if ( cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY ) return false; @@ -360,7 +360,7 @@ bool CDecor::PutFloor(POINT cel, int channel, int icon) // Initialise un objet dans une cellule. -bool CDecor::PutObject(POINT cel, int channel, int icon) +bool CDecor::PutObject(POINT cel, Sint32 channel, Sint32 icon) { if ( cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY ) return false; @@ -377,7 +377,7 @@ bool CDecor::PutObject(POINT cel, int channel, int icon) // Retourne un sol dans une cellule. -bool CDecor::GetFloor(POINT cel, int &channel, int &icon) +bool CDecor::GetFloor(POINT cel, Sint32 &channel, Sint32 &icon) { if ( cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY ) return false; @@ -390,7 +390,7 @@ bool CDecor::GetFloor(POINT cel, int &channel, int &icon) // Retourne une objet dans une cellule. -bool CDecor::GetObject(POINT cel, int &channel, int &icon) +bool CDecor::GetObject(POINT cel, Sint32 &channel, Sint32 &icon) { if ( cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY ) return false; @@ -514,7 +514,7 @@ POINT CDecor::ConvPosToCel2(POINT pos) void CDecor::BuildPutBlupi() { - int x, y, dx, dy, xMin, yMin, rank, clipLeft; + Sint32 x, y, dx, dy, xMin, yMin, rank, clipLeft; POINT pos; #if 0 // déjà fait au point (1), voir Build @@ -631,10 +631,10 @@ void CDecor::BuildPutBlupi() // Dessine une cellule du décor contenant un sol animé. -void CDecor::BuildMoveFloor(int x, int y, POINT pos, int rank) +void CDecor::BuildMoveFloor(Sint32 x, Sint32 y, POINT pos, Sint32 rank) { - int icon, nb; - short* pTable; + Sint32 icon, nb; + Sint16* pTable; if ( m_move[rank].rankIcons == 0 ) { @@ -670,11 +670,11 @@ void CDecor::BuildMoveFloor(int x, int y, POINT pos, int rank) // Dessine une cellule du décor contenant un objet animé. -void CDecor::BuildMoveObject(int x, int y, POINT pos, int rank) +void CDecor::BuildMoveObject(Sint32 x, Sint32 y, POINT pos, Sint32 rank) { - int hBuild, offset, startY, endY; - int channel, icon, nb; - short* pTable; + Sint32 hBuild, offset, startY, endY; + Sint32 channel, icon, nb; + Sint16* pTable; if ( m_move[rank].rankMoves != 0 ) { @@ -783,12 +783,12 @@ void CDecor::BuildMoveObject(int x, int y, POINT pos, int rank) // Déplace l'objet transporté par blupi. -void BuildMoveTransport(int icon, POINT &pos) +void BuildMoveTransport(Sint32 icon, POINT &pos) { pos.x -= DIMCELX/2; pos.y -= 96; - static int offset_bateau[16*2] = + static Sint32 offset_bateau[16*2] = { -4,-3, // e -2,-3, @@ -808,7 +808,7 @@ void BuildMoveTransport(int icon, POINT &pos) -4,-2, }; - static int offset_jeep[16*2] = + static Sint32 offset_jeep[16*2] = { -2,-6, // e -1,-6, @@ -879,7 +879,7 @@ void BuildMoveTransport(int icon, POINT &pos) void CDecor::BuildGround(RECT clip) { //? OutputDebug("BuildGround\n"); - int x, y, i, j, nbx, nby, width, height, channel, icon; + Sint32 x, y, i, j, nbx, nby, width, height, channel, icon; POINT iCel, mCel, iPos, mPos, cPos, pos; width = clip.right-clip.left; @@ -1006,19 +1006,19 @@ void CDecor::BuildGround(RECT clip) void CDecor::Build(RECT clip, POINT posMouse) { - int x, y, i, j, nbx, nby, width, height, rank, icon, channel, n; + Sint32 x, y, i, j, nbx, nby, width, height, rank, icon, channel, n; POINT iCel, mCel, cel, iPos, mPos, cPos, pos, tPos; RECT oldClip, clipRect; - static int table_eau[6] = + static Sint32 table_eau[6] = { 70,68,14,69,14,68 }; - static int table_random_x[10] = + static Sint32 table_random_x[10] = { 2,5,1,9,4,0,6,3,8,7 }; - static int table_random_y[10] = + static Sint32 table_random_y[10] = { 4,8,3,5,9,1,7,2,0,6 }; @@ -1549,7 +1549,7 @@ void CDecor::Build(RECT clip, POINT posMouse) // 0 début de mise à jour périodique // 1 mise à jour périodique suivante -void CDecor::NextPhase(int mode) +void CDecor::NextPhase(Sint32 mode) { if ( mode == -1 ) { @@ -1571,14 +1571,14 @@ void CDecor::NextPhase(int mode) // Modifie le temps total passé dans cette partie. -void CDecor::SetTotalTime(int total) +void CDecor::SetTotalTime(Sint32 total) { m_totalTime = total; } // Retourne le temps total passé dans cette partie. -int CDecor::GetTotalTime() +Sint32 CDecor::GetTotalTime() { return m_totalTime; } @@ -1586,10 +1586,10 @@ int CDecor::GetTotalTime() // Compte le nombre total de sols contenus dans les décors. -int CDecor::CountFloor(int channel, int icon) +Sint32 CDecor::CountFloor(Sint32 channel, Sint32 icon) { - int x, y; - int nb = 0; + Sint32 x, y; + Sint32 nb = 0; for ( x=0 ; x<MAXCELX/2 ; x++ ) { @@ -1610,13 +1610,13 @@ int CDecor::CountFloor(int channel, int icon) // 2 construction d'une cellule 2x2 // WM_ACTION* action -int CDecor::CelOkForAction(POINT cel, int action, int rank, - int icons[4][4], +Sint32 CDecor::CelOkForAction(POINT cel, Sint32 action, Sint32 rank, + Sint32 icons[4][4], POINT &celOutline1, POINT &celOutline2) { - int x, y, i, j, channel, icon, nb, start, direct; - int error = 0; + Sint32 x, y, i, j, channel, icon, nb, start, direct; + Sint32 error = 0; bool bStrong = false; bool bTransport = false; bool bVehicule = false; @@ -2745,9 +2745,9 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, // Indique si une cellule est ok pour une action. // Le rang du blupi qui effectuera le travail est donnée dans rank. -int CDecor::CelOkForAction(POINT cel, int action, int rank) +Sint32 CDecor::CelOkForAction(POINT cel, Sint32 action, Sint32 rank) { - int icons[4][4]; + Sint32 icons[4][4]; POINT celOutline1, celOutline2; return CelOkForAction(cel, action, rank, icons, @@ -2756,9 +2756,9 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank) // Retourne le rang du nième blupi sélectionné. -int CDecor::GetHiliRankBlupi(int nb) +Sint32 CDecor::GetHiliRankBlupi(Sint32 nb) { - int rank; + Sint32 rank; if ( m_nbBlupiHili == 0 ) return -1; if ( m_nbBlupiHili == 1 ) @@ -2785,9 +2785,9 @@ int CDecor::GetHiliRankBlupi(int nb) // 1 construction d'une cellule 1x1 // 2 construction d'une cellule 2x2 -void CDecor::CelHili(POINT pos, int action) +void CDecor::CelHili(POINT pos, Sint32 action) { - int x, y, i, channel, icon, rank, nb; + Sint32 x, y, i, channel, icon, rank, nb; POINT cel; for ( x=0 ; x<4 ; x++ ) @@ -2898,7 +2898,7 @@ void CDecor::CelHili(POINT pos, int action) // Marque la cellule visée par la souris pour un bouton donné. -void CDecor::CelHiliButton(POINT cel, int button) +void CDecor::CelHiliButton(POINT cel, Sint32 button) { POINT celOutline1, celOutline2; @@ -2943,9 +2943,9 @@ void CDecor::CelHiliButton(POINT cel, int button) // Marque la cellule visée par la souris pour une répétition donnée. -void CDecor::CelHiliRepeat(int list) +void CDecor::CelHiliRepeat(Sint32 list) { - int rank, button, x, y, i; + Sint32 rank, button, x, y, i; POINT cel; for ( x=0 ; x<4 ; x++ ) @@ -3012,7 +3012,7 @@ void CDecor::CelHiliRepeat(int list) const char *CDecor::GetResHili(POINT posMouse) { - int icon; + Sint32 icon; // Les valeurs `corner == true` correspondent aux objets placés // au coin inf/droit de la cellule. @@ -3322,7 +3322,7 @@ POINT CDecor::GetHome() // Mémoirise une position pendant le jeu. -void CDecor::MemoPos(int rank, bool bRecord) +void CDecor::MemoPos(Sint32 rank, bool bRecord) { POINT pos; @@ -3354,14 +3354,14 @@ void CDecor::MemoPos(int rank, bool bRecord) // Gestion du temps absolu global. -void CDecor::SetTime(int time) +void CDecor::SetTime(Sint32 time) { m_time = time; m_timeConst = time; // vraiment ? m_timeFlipOutline = time; } -int CDecor::GetTime() +Sint32 CDecor::GetTime() { return m_time; } @@ -3369,12 +3369,12 @@ int CDecor::GetTime() // Gestion de la musique midi. -void CDecor::SetMusic(int music) +void CDecor::SetMusic(Sint32 music) { m_music = music; } -int CDecor::GetMusic() +Sint32 CDecor::GetMusic() { return m_music; } @@ -3382,12 +3382,12 @@ int CDecor::GetMusic() // Gestion de la difficulté. -void CDecor::SetSkill(int skill) +void CDecor::SetSkill(Sint32 skill) { m_skill = skill; } -int CDecor::GetSkill() +Sint32 CDecor::GetSkill() { return m_skill; } @@ -3399,12 +3399,12 @@ int CDecor::GetSkill() // 2 = hiver // 3 = sapin -void CDecor::SetRegion(int region) +void CDecor::SetRegion(Sint32 region) { m_region = region; } -int CDecor::GetRegion() +Sint32 CDecor::GetRegion() { return m_region; } @@ -3423,13 +3423,13 @@ bool CDecor::GetInfoMode() return m_bInfo; } -void CDecor::SetInfoHeight(int height) +void CDecor::SetInfoHeight(Sint32 height) { m_infoHeight = height; m_bGroundRedraw = true; // faudra redessiner les sols } -int CDecor::GetInfoHeight() +Sint32 CDecor::GetInfoHeight() { if ( m_bInfo ) return m_infoHeight; else return 0; diff --git a/src/decor.h b/src/decor.h index 5c8d439..1cad40b 100644 --- a/src/decor.h +++ b/src/decor.h @@ -24,14 +24,14 @@ // Descripteur d'une cellule du décor. typedef struct { - short floorChannel; - short floorIcon; - short objectChannel; - short objectIcon; - short fog; // brouillard - short rankMove; // rang dans m_move - short workBlupi; // rang du blupi travaillant ici - short fire; + Sint16 floorChannel; + Sint16 floorIcon; + Sint16 objectChannel; + Sint16 objectIcon; + Sint16 fog; // brouillard + Sint16 rankMove; // rang dans m_move + Sint16 workBlupi; // rang du blupi travaillant ici + Sint16 fire; } Cellule; // Cette structure doit être la plus petite possible, car @@ -44,67 +44,67 @@ Cellule; typedef struct { - int bExist; // true -> utilisé - int bHili; // true -> sélectionné + Sint32 bExist; // true -> utilisé + Sint32 bHili; // true -> sélectionné - short perso; // personnage, voir (*) + Sint16 perso; // personnage, voir (*) - short goalAction; // action (long terme) - short goalPhase; // phase (long terme) - POINT goalCel; // cellule visée (long terme) + Sint16 goalAction; // action (Sint32 terme) + Sint16 goalPhase; // phase (Sint32 terme) + POINT goalCel; // cellule visée (Sint32 terme) POINT passCel; // cellule tranversante - short energy; // énergie restante + Sint16 energy; // énergie restante POINT cel; // cellule actuelle POINT destCel; // cellule destination - short action; // action en cours - short aDirect; // direction actuelle - short sDirect; // direction souhaitée + Sint16 action; // action en cours + Sint16 aDirect; // direction actuelle + Sint16 sDirect; // direction souhaitée POINT pos; // position relative à partir de la cellule - short posZ; // déplacement z - short channel; - short lastIcon; - short icon; - short phase; // phase dans l'action - short step; // pas global - short interrupt; // 0=prioritaire, 1=normal, 2=misc - short clipLeft; - - int nbUsed; // nb de points déjà visités + Sint16 posZ; // déplacement z + Sint16 channel; + Sint16 lastIcon; + Sint16 icon; + Sint16 phase; // phase dans l'action + Sint16 step; // pas global + Sint16 interrupt; // 0=prioritaire, 1=normal, 2=misc + Sint16 clipLeft; + + Sint32 nbUsed; // nb de points déjà visités char nextRankUsed; POINT posUsed[MAXUSED]; char rankUsed[MAXUSED]; - short takeChannel; // objet transporté - short takeIcon; + Sint16 takeChannel; // objet transporté + Sint16 takeIcon; POINT fix; // point fixe (cultive, pont) - short jaugePhase; - short jaugeMax; - short stop; // 1 -> devra stopper - short bArrow; // true -> flèche en dessus de blupi - short bRepeat; // true -> répète l'action - short nLoop; // nb de boucles pour GOAL_OTHERLOOP - short cLoop; // boucle en cours - short vIcon; // icône variable + Sint16 jaugePhase; + Sint16 jaugeMax; + Sint16 stop; // 1 -> devra stopper + Sint16 bArrow; // true -> flèche en dessus de blupi + Sint16 bRepeat; // true -> répète l'action + Sint16 nLoop; // nb de boucles pour GOAL_OTHERLOOP + Sint16 cLoop; // boucle en cours + Sint16 vIcon; // icône variable POINT goalHili; // but visé - short bMalade; // true -> blupi malade - short bCache; // true -> caché (pas dessiné) - short vehicule; // véhicule utilisé par blupi, voir (**) + Sint16 bMalade; // true -> blupi malade + Sint16 bCache; // true -> caché (pas dessiné) + Sint16 vehicule; // véhicule utilisé par blupi, voir (**) char busyCount; char busyDelay; char clicCount; char clicDelay; char reserve2[2]; - short listButton[MAXLIST]; + Sint16 listButton[MAXLIST]; POINT listCel[MAXLIST]; - short listParam[MAXLIST]; - short repeatLevelHope; - short repeatLevel; - short reserve3[88]; + Sint16 listParam[MAXLIST]; + Sint16 repeatLevelHope; + Sint16 repeatLevel; + Sint16 reserve3[88]; } Blupi; @@ -132,26 +132,26 @@ Blupi; typedef struct { - int bExist; // true -> utilisé + Sint32 bExist; // true -> utilisé POINT cel; // cellule du décor - short rankBlupi; // blupi travaillant ici - - int bFloor; // true -> floor, false -> object - short channel; - short icon; - short maskChannel; - short maskIcon; - short phase; // phase pour pMoves ou pIcon - short rankMoves; // *nb,dx,dy,... - short rankIcons; // *nb,i,i,... - - short total; // nb total d'étapes - short delai; // délai entre deux pas - short stepY; // pas vertical *100 - - short cTotal; - short cDelai; + Sint16 rankBlupi; // blupi travaillant ici + + Sint32 bFloor; // true -> floor, false -> object + Sint16 channel; + Sint16 icon; + Sint16 maskChannel; + Sint16 maskIcon; + Sint16 phase; // phase pour pMoves ou pIcon + Sint16 rankMoves; // *nb,dx,dy,... + Sint16 rankIcons; // *nb,i,i,... + + Sint16 total; // nb total d'étapes + Sint16 delai; // délai entre deux pas + Sint16 stepY; // pas vertical *100 + + Sint16 cTotal; + Sint16 cDelai; } Move; @@ -166,71 +166,71 @@ public: // Arrange.cpp void ArrangeFloor(POINT cel); - void ArrangeMur(POINT cel, int &icon, int index); - void ArrangeBuild(POINT cel, int &channel, int &icon); + void ArrangeMur(POINT cel, Sint32 &icon, Sint32 index); + void ArrangeBuild(POINT cel, Sint32 &channel, Sint32 &icon); void ArrangeObject(POINT cel); bool ArrangeFillTestFloor(POINT cel1, POINT cel2); bool ArrangeFillTest(POINT pos); - void ArrangeFillPut(POINT pos, int channel, int icon); + void ArrangeFillPut(POINT pos, Sint32 channel, Sint32 icon); void ArrangeFillSearch(POINT pos); - void ArrangeFill(POINT pos, int channel, int icon, bool bFloor); + void ArrangeFill(POINT pos, Sint32 channel, Sint32 icon, bool bFloor); void ArrangeBlupi(); // Obstacle.cpp - void SearchFloor(int rank, int icon, POINT cel, int *pBits); - void SearchObject(int rank, int icon, POINT cel, int *pBits); - void AjustFloor(int rank, int icon, POINT cel, int *pBits); - void AjustObject(int rank, int icon, POINT cel, int *pBits); - bool IsFreeDirect(POINT cel, int direct, int rank); + void SearchFloor(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); + void SearchObject(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); + void AjustFloor(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); + void AjustObject(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); + bool IsFreeDirect(POINT cel, Sint32 direct, Sint32 rank); bool IsFreeCelObstacle(POINT cel); - bool IsFreeCelFloor(POINT cel, int rank); - bool IsFreeCelGo(POINT cel, int rank); - bool IsFreeCelHili(POINT cel, int rank); - bool IsFreeCel(POINT cel, int rank); - bool IsFreeCelDepose(POINT cel, int rank); - bool IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit); - bool IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit); - bool IsFreeJump(POINT cel, int direct, int rank, int &action); - bool IsFreeGlisse(POINT cel, int direct, int rank, int &action); - int DirectSearch(POINT cel, POINT goal); - void FlushUsed(int rank); - void AddUsedPos(int rank, POINT pos); - bool IsUsedPos(int rank, POINT pos); - bool SearchBestBase(int rank, int &action, POINT &newCel, int &direct); - bool SearchBestPass(int rank, int &action); - bool IsWorkableObject(POINT cel, int rank); - bool SearchOtherObject(int rank, POINT initCel, int action, - int distMax, int channel, - int firstIcon1, int lastIcon1, - int firstIcon2, int lastIcon2, - POINT &foundCel, int &foundIcon); - bool SearchOtherDrapeau(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon); - bool SearchOtherBateau(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon); - bool IsSpiderObject(int icon); - bool SearchSpiderObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon); - bool IsTracksObject(int icon); - bool SearchTracksObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon); - bool IsRobotObject(int icon); - bool SearchRobotObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon, - int &foundAction); - bool IsBombeObject(int icon); - bool SearchBombeObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon); - bool SearchElectroObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon); - bool IsUsineBuild(int rank, POINT cel); - bool IsUsineFree(int rank, POINT cel); + bool IsFreeCelFloor(POINT cel, Sint32 rank); + bool IsFreeCelGo(POINT cel, Sint32 rank); + bool IsFreeCelHili(POINT cel, Sint32 rank); + bool IsFreeCel(POINT cel, Sint32 rank); + bool IsFreeCelDepose(POINT cel, Sint32 rank); + bool IsFreeCelEmbarque(POINT cel, Sint32 rank, Sint32 &action, POINT &limit); + bool IsFreeCelDebarque(POINT cel, Sint32 rank, Sint32 &action, POINT &limit); + bool IsFreeJump(POINT cel, Sint32 direct, Sint32 rank, Sint32 &action); + bool IsFreeGlisse(POINT cel, Sint32 direct, Sint32 rank, Sint32 &action); + Sint32 DirectSearch(POINT cel, POINT goal); + void FlushUsed(Sint32 rank); + void AddUsedPos(Sint32 rank, POINT pos); + bool IsUsedPos(Sint32 rank, POINT pos); + bool SearchBestBase(Sint32 rank, Sint32 &action, POINT &newCel, Sint32 &direct); + bool SearchBestPass(Sint32 rank, Sint32 &action); + bool IsWorkableObject(POINT cel, Sint32 rank); + bool SearchOtherObject(Sint32 rank, POINT initCel, Sint32 action, + Sint32 distMax, Sint32 channel, + Sint32 firstIcon1, Sint32 lastIcon1, + Sint32 firstIcon2, Sint32 lastIcon2, + POINT &foundCel, Sint32 &foundIcon); + bool SearchOtherDrapeau(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon); + bool SearchOtherBateau(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon); + bool IsSpiderObject(Sint32 icon); + bool SearchSpiderObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon); + bool IsTracksObject(Sint32 icon); + bool SearchTracksObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon); + bool IsRobotObject(Sint32 icon); + bool SearchRobotObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon, + Sint32 &foundAction); + bool IsBombeObject(Sint32 icon); + bool SearchBombeObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon); + bool SearchElectroObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon); + bool IsUsineBuild(Sint32 rank, POINT cel); + bool IsUsineFree(Sint32 rank, POINT cel); bool IsFireCel(POINT cel); bool IsVirusCel(POINT cel); - int IsBuildPont(POINT &cel, int &iconBuild); - bool IsBuildBateau(POINT cel, int &direct); + Sint32 IsBuildPont(POINT &cel, Sint32 &iconBuild); + bool IsBuildBateau(POINT cel, Sint32 &direct); void InitDrapeau(); void AddDrapeau(POINT cel); void SubDrapeau(POINT cel); @@ -238,94 +238,94 @@ public: // DecBlupi.cpp void BlupiFlush(); - int BlupiCreate(POINT cel, int action, int direct, - int perso, int energy); - bool BlupiDelete(POINT cel, int perso=-1); - void BlupiDelete(int rank); - void BlupiKill(int exRank, POINT cel, int type); - bool BlupiIfExist(int rank); - void BlupiCheat(int cheat); - void BlupiActualise(int rank); - void BlupiAdaptIcon(int rank); - void BlupiPushFog(int rank); - void BlupiSound(int rank, int sound, POINT pos, bool bStop=false); - void BlupiInitAction(int rank, int action, int direct=-1); - void BlupiChangeAction(int rank, int action, int direct=-1); - void ListFlush(int rank); - int ListGetParam(int rank, int button, POINT cel); - bool ListPut(int rank, int button, POINT cel, POINT cMem); - void ListRemove(int rank); - int ListSearch(int rank, int button, POINT cel, const char *&textForButton); - bool RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem, - int param, int list); - void GoalStart(int rank, int action, POINT cel); - bool GoalNextPhase(int rank); - void SetTotalTime(int total); - int GetTotalTime(); - void GoalInitJauge(int rank); - void GoalInitPassCel(int rank); - void GoalAdjustCel(int rank, int &x, int &y); - bool GoalNextOp(int rank, short *pTable); - void GoalUnwork(int rank); - void GoalStop(int rank, bool bError=false, bool bSound=true); + Sint32 BlupiCreate(POINT cel, Sint32 action, Sint32 direct, + Sint32 perso, Sint32 energy); + bool BlupiDelete(POINT cel, Sint32 perso=-1); + void BlupiDelete(Sint32 rank); + void BlupiKill(Sint32 exRank, POINT cel, Sint32 type); + bool BlupiIfExist(Sint32 rank); + void BlupiCheat(Sint32 cheat); + void BlupiActualise(Sint32 rank); + void BlupiAdaptIcon(Sint32 rank); + void BlupiPushFog(Sint32 rank); + void BlupiSound(Sint32 rank, Sint32 sound, POINT pos, bool bStop=false); + void BlupiInitAction(Sint32 rank, Sint32 action, Sint32 direct=-1); + void BlupiChangeAction(Sint32 rank, Sint32 action, Sint32 direct=-1); + void ListFlush(Sint32 rank); + Sint32 ListGetParam(Sint32 rank, Sint32 button, POINT cel); + bool ListPut(Sint32 rank, Sint32 button, POINT cel, POINT cMem); + void ListRemove(Sint32 rank); + Sint32 ListSearch(Sint32 rank, Sint32 button, POINT cel, const char *&textForButton); + bool RepeatAdjust(Sint32 rank, Sint32 button, POINT &cel, POINT &cMem, + Sint32 param, Sint32 list); + void GoalStart(Sint32 rank, Sint32 action, POINT cel); + bool GoalNextPhase(Sint32 rank); + void SetTotalTime(Sint32 total); + Sint32 GetTotalTime(); + void GoalInitJauge(Sint32 rank); + void GoalInitPassCel(Sint32 rank); + void GoalAdjustCel(Sint32 rank, Sint32 &x, Sint32 &y); + bool GoalNextOp(Sint32 rank, Sint16 *pTable); + void GoalUnwork(Sint32 rank); + void GoalStop(Sint32 rank, bool bError=false, bool bSound=true); bool BlupiIsGoalUsed(POINT cel); - void BlupiStartStopRayon(int rank, POINT startCel, POINT endCel); - bool BlupiRotate(int rank); - bool BlupiNextAction(int rank); - void BlupiNextGoal(int rank); + void BlupiStartStopRayon(Sint32 rank, POINT startCel, POINT endCel); + bool BlupiRotate(Sint32 rank); + bool BlupiNextAction(Sint32 rank); + void BlupiNextGoal(Sint32 rank); void BlupiStep(bool bFirst); - void BlupiGetRect(int rank, RECT &rect); - int GetTargetBlupi(POINT pos); + void BlupiGetRect(Sint32 rank, RECT &rect); + Sint32 GetTargetBlupi(POINT pos); void BlupiDeselect(); - void BlupiDeselect(int rank); - void BlupiSetArrow(int rank, bool bArrow); + void BlupiDeselect(Sint32 rank); + void BlupiSetArrow(Sint32 rank, bool bArrow); void InitOutlineRect(); void BlupiHiliDown(POINT pos, bool bAdd=false); void BlupiHiliMove(POINT pos, bool bAdd=false); void BlupiHiliUp(POINT pos, bool bAdd=false); void BlupiDrawHili(); - int GetDefButton(POINT cel); - bool BlupiGoal(int rank, int button, POINT cel, POINT cMem); - void BlupiGoal(POINT cel, int button); - void BlupiDestCel(int rank); + Sint32 GetDefButton(POINT cel); + bool BlupiGoal(Sint32 rank, Sint32 button, POINT cel, POINT cMem); + void BlupiGoal(POINT cel, Sint32 button); + void BlupiDestCel(Sint32 rank); bool IsTracksHere(POINT cel, bool bSkipInMove); - bool IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, bool bSkipInMove); - bool IsBlupiHereEx(POINT cel, int exRank, bool bSkipInMove); + bool IsBlupiHereEx(POINT cel1, POINT cel2, Sint32 exRank, bool bSkipInMove); + bool IsBlupiHereEx(POINT cel, Sint32 exRank, bool bSkipInMove); bool IsBlupiHere(POINT cel, bool bSkipInMove); - bool IsBlupiHere(POINT cel, int direct, bool bSkipInMove); - void GetLevelJauge(int *pLevels, int *pTypes); - bool IsWorkBlupi(int rank); - void BlupiGetButtons(POINT pos, int &nb, int *pButtons, int *pErrors, - std::unordered_map<int, const char *> &texts, int &perso); + bool IsBlupiHere(POINT cel, Sint32 direct, bool bSkipInMove); + void GetLevelJauge(Sint32 *pLevels, Sint32 *pTypes); + bool IsWorkBlupi(Sint32 rank); + void BlupiGetButtons(POINT pos, Sint32 &nb, Sint32 *pButtons, Sint32 *pErrors, + std::unordered_map<Sint32, const char *> &texts, Sint32 &perso); void TerminatedInit(); - int IsTerminated(); + Sint32 IsTerminated(); Term* GetTerminated(); // DecMove.cpp void MoveFlush(); - int MoveMaxFire(); + Sint32 MoveMaxFire(); void MoveFixInit(); - bool MoveCreate(POINT cel, int rankBlupi, bool bFloor, - int channel, int icon, - int maskChannel, int maskIcon, - int total, int delai, int stepY, + bool MoveCreate(POINT cel, Sint32 rankBlupi, bool bFloor, + Sint32 channel, Sint32 icon, + Sint32 maskChannel, Sint32 maskIcon, + Sint32 total, Sint32 delai, Sint32 stepY, bool bMisc=false, bool bNotIfExist=false); - bool MoveAddMoves(POINT cel, int rankMoves); - bool MoveAddIcons(POINT cel, int rankIcons, bool bContinue=false); + bool MoveAddMoves(POINT cel, Sint32 rankMoves); + bool MoveAddIcons(POINT cel, Sint32 rankIcons, bool bContinue=false); bool MoveStartFire(POINT cel); void MoveProxiFire(POINT cel); - void MoveFire(int rank); + void MoveFire(Sint32 rank); void MoveStep(bool bFirst); void MoveFinish(POINT cel); - void MoveFinish(int rankBlupi); + void MoveFinish(Sint32 rankBlupi); bool MoveIsUsed(POINT cel); - bool MoveGetObject(POINT cel, int &channel, int &icon); - bool MovePutObject(POINT cel, int channel, int icon); + bool MoveGetObject(POINT cel, Sint32 &channel, Sint32 &icon); + bool MovePutObject(POINT cel, Sint32 channel, Sint32 icon); // DecIO.cpp - bool Write(int rank, bool bUser, int world, int time, int total); - bool Read(int rank, bool bUser, int &world, int &time, int &total); - bool FileExist(int rank, bool bUser, int &world, int &time, int &total); + bool Write(Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total); + bool Read(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &total); + bool FileExist(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &total); void Flush(); // DecMap.cpp @@ -339,25 +339,25 @@ public: // DecStat.cpp void StatisticInit(); void StatisticUpdate(); - int StatisticGetBlupi(); - int StatisticGetFire(); + Sint32 StatisticGetBlupi(); + Sint32 StatisticGetFire(); void StatisticDraw(); void GenerateStatictic(); bool StatisticDown(POINT pos); bool StatisticMove(POINT pos); bool StatisticUp(POINT pos); - int StatisticDetect(POINT pos); + Sint32 StatisticDetect(POINT pos); // Chemin.cpp - void CheminMemPos(int exRank); - bool CheminTestPos(POINT pos, int &rank); - int CheminARebours(int rank); - void CheminFillTerrain(int rank); - bool CheminTestDirection(int rank, int pos, int dir, - int &next, int &li, - int &cout, int &action); - bool CheminCherche(int rank, int &action); - bool IsCheminFree(int rank, POINT dest, int button); + void CheminMemPos(Sint32 exRank); + bool CheminTestPos(POINT pos, Sint32 &rank); + Sint32 CheminARebours(Sint32 rank); + void CheminFillTerrain(Sint32 rank); + bool CheminTestDirection(Sint32 rank, Sint32 pos, Sint32 dir, + Sint32 &next, Sint32 &li, + Sint32 &cout, Sint32 &action); + bool CheminCherche(Sint32 rank, Sint32 &action); + bool IsCheminFree(Sint32 rank, POINT dest, Sint32 button); // Decor.cpp void SetShiftOffset(POINT offset); @@ -366,7 +366,7 @@ public: POINT ConvPosToCel2(POINT pos); void Create(CSound *pSound, CPixmap *pPixmap); - void Init(int channel, int icon); + void Init(Sint32 channel, Sint32 icon); void InitAfterBuild(); void ResetHili(); bool LoadImages(); @@ -379,53 +379,53 @@ public: bool GetSuper(); void SetSuper(bool bSuper); void FlipOutline(); - bool PutFloor(POINT cel, int channel, int icon); - bool PutObject(POINT cel, int channel, int icon); - bool GetFloor(POINT cel, int &channel, int &icon); - bool GetObject(POINT cel, int &channel, int &icon); + bool PutFloor(POINT cel, Sint32 channel, Sint32 icon); + bool PutObject(POINT cel, Sint32 channel, Sint32 icon); + bool GetFloor(POINT cel, Sint32 &channel, Sint32 &icon); + bool GetObject(POINT cel, Sint32 &channel, Sint32 &icon); bool SetFire(POINT cel, bool bFire); void SetCoin(POINT coin, bool bCenter=false); POINT GetCoin(); POINT GetHome(); - void MemoPos(int rank, bool bRecord); + void MemoPos(Sint32 rank, bool bRecord); - void SetTime(int time); - int GetTime(); + void SetTime(Sint32 time); + Sint32 GetTime(); - void SetMusic(int music); - int GetMusic(); + void SetMusic(Sint32 music); + Sint32 GetMusic(); - void SetSkill(int skill); - int GetSkill(); + void SetSkill(Sint32 skill); + Sint32 GetSkill(); - void SetRegion(int region); - int GetRegion(); + void SetRegion(Sint32 region); + Sint32 GetRegion(); void SetInfoMode(bool bInfo); bool GetInfoMode(); - void SetInfoHeight(int height); - int GetInfoHeight(); + void SetInfoHeight(Sint32 height); + Sint32 GetInfoHeight(); char* GetButtonExist(); void BuildPutBlupi(); - void BuildMoveFloor(int x, int y, POINT pos, int rank); - void BuildMoveObject(int x, int y, POINT pos, int rank); + void BuildMoveFloor(Sint32 x, Sint32 y, POINT pos, Sint32 rank); + void BuildMoveObject(Sint32 x, Sint32 y, POINT pos, Sint32 rank); void BuildGround(RECT clip); void Build(RECT clip, POINT posMouse); - void NextPhase(int mode); + void NextPhase(Sint32 mode); - int CountFloor(int channel, int icon); - int CelOkForAction(POINT cel, int action, int rank, - int icons[4][4], + Sint32 CountFloor(Sint32 channel, Sint32 icon); + Sint32 CelOkForAction(POINT cel, Sint32 action, Sint32 rank, + Sint32 icons[4][4], POINT &celOutline1, POINT &celOutline2); - int CelOkForAction(POINT cel, int action, int rank); - int GetHiliRankBlupi(int nb); - void CelHili(POINT pos, int action); - void CelHiliButton(POINT cel, int button); - void CelHiliRepeat(int list); + Sint32 CelOkForAction(POINT cel, Sint32 action, Sint32 rank); + Sint32 GetHiliRankBlupi(Sint32 nb); + void CelHili(POINT pos, Sint32 action); + void CelHiliButton(POINT cel, Sint32 button); + void CelHiliRepeat(Sint32 list); const char *GetResHili(POINT posMouse); void HideTooltips(bool bHide); @@ -437,15 +437,15 @@ public: protected: - bool GetSeeBits(POINT cel, char *pBits, int index); - int GetSeeIcon(char *pBits, int index); + bool GetSeeBits(POINT cel, char *pBits, Sint32 index); + Sint32 GetSeeIcon(char *pBits, Sint32 index); protected: CSound* m_pSound; CPixmap* m_pPixmap; Cellule* m_pUndoDecor; Cellule m_decor[MAXCELX/2][MAXCELY/2]; - short m_rankBlupi[MAXCELX][MAXCELY]; + Sint16 m_rankBlupi[MAXCELX][MAXCELY]; Blupi m_blupi[MAXBLUPI]; Move m_move[MAXMOVE]; POINT m_celCoin; // cellule sup/gauche @@ -454,78 +454,78 @@ protected: POINT m_celOutline1; POINT m_celOutline2; POINT m_shiftOffset; - int m_iconHili[4][4]; - int m_rankHili; // rang du blupi visé + Sint32 m_iconHili[4][4]; + Sint32 m_rankHili; // rang du blupi visé bool m_bHiliRect; POINT m_p1Hili; // coins rectangle de sélection POINT m_p2Hili; - int m_shiftHili; - int m_nbBlupiHili; // nb de blupi sélectionnés - int m_rankBlupiHili; // rang blupi sélectionné + Sint32 m_shiftHili; + Sint32 m_nbBlupiHili; // nb de blupi sélectionnés + Sint32 m_rankBlupiHili; // rang blupi sélectionné bool m_bFog; // true -> brouillard (jeu) bool m_bBuild; // true -> construction bool m_bInvincible; // true -> cheat code bool m_bSuper; // true -> cheat code Uint32 m_colors[100]; - int m_time; // temps relatif global - int m_timeConst; // temps relatif global constant - int m_timeFlipOutline; // temps quand basculer mode outline - int m_totalTime; // temps total passé sur une partie - int m_phase; // phase pour la carte + Sint32 m_time; // temps relatif global + Sint32 m_timeConst; // temps relatif global constant + Sint32 m_timeFlipOutline; // temps quand basculer mode outline + Sint32 m_totalTime; // temps total passé sur une partie + Sint32 m_phase; // phase pour la carte POINT m_celArrow; // cellule avec flèche bool m_bOutline; bool m_bGroundRedraw; char m_buttonExist[MAXBUTTON]; - int m_statNb; // nb de statistiques - int m_statFirst; // première statistique visible - int m_bStatUp; // flèche up statistique - int m_bStatDown; // flèche down statistique - int m_statHili; // statistique survolée + Sint32 m_statNb; // nb de statistiques + Sint32 m_statFirst; // première statistique visible + Sint32 m_bStatUp; // flèche up statistique + Sint32 m_bStatDown; // flèche down statistique + Sint32 m_statHili; // statistique survolée bool m_bStatRecalc; // true -> recalcule les statistiques bool m_bStatRedraw; // true -> redessine les statistiques - int m_nbStatHach; // nb de hachures - int m_nbStatHachBlupi; // hachures occupées par blupi - int m_nbStatHachPlanche;// hachures occupées par planches - int m_nbStatHachTomate; // hachures occupées par tomates - int m_nbStatHachMetal; // hachures occupées par métal - int m_nbStatHachRobot; // hachures occupées par robot - int m_nbStatHome; // nb de maisons - int m_nbStatHomeBlupi; // maisons occupées par blupi - int m_nbStatRobots; // nb d'ennemis + Sint32 m_nbStatHach; // nb de hachures + Sint32 m_nbStatHachBlupi; // hachures occupées par blupi + Sint32 m_nbStatHachPlanche;// hachures occupées par planches + Sint32 m_nbStatHachTomate; // hachures occupées par tomates + Sint32 m_nbStatHachMetal; // hachures occupées par métal + Sint32 m_nbStatHachRobot; // hachures occupées par robot + Sint32 m_nbStatHome; // nb de maisons + Sint32 m_nbStatHomeBlupi; // maisons occupées par blupi + Sint32 m_nbStatRobots; // nb d'ennemis Term m_term; // conditions pour gagner - int m_winCount; // compteur avant gagné - int m_winLastHachBlupi; // dernier nombre atteint - int m_winLastHachPlanche;// dernier nombre atteint - int m_winLastHachTomate;// dernier nombre atteint - int m_winLastHachMetal; // dernier nombre atteint - int m_winLastHachRobot; // dernier nombre atteint - int m_winLastHome; // dernier nombre atteint - int m_winLastHomeBlupi; // dernier nombre atteint - int m_winLastRobots; // dernier nombre atteint - int m_music; // numéro musique - int m_region; // numéro région (*) - int m_lastRegion; // numéro dernière région - int m_blupiHere; + Sint32 m_winCount; // compteur avant gagné + Sint32 m_winLastHachBlupi; // dernier nombre atteint + Sint32 m_winLastHachPlanche;// dernier nombre atteint + Sint32 m_winLastHachTomate;// dernier nombre atteint + Sint32 m_winLastHachMetal; // dernier nombre atteint + Sint32 m_winLastHachRobot; // dernier nombre atteint + Sint32 m_winLastHome; // dernier nombre atteint + Sint32 m_winLastHomeBlupi; // dernier nombre atteint + Sint32 m_winLastRobots; // dernier nombre atteint + Sint32 m_music; // numéro musique + Sint32 m_region; // numéro région (*) + Sint32 m_lastRegion; // numéro dernière région + Sint32 m_blupiHere; POINT m_lastDrapeau[MAXLASTDRAPEAU]; bool m_bHideTooltips; // true -> menu présent char m_text[50]; POINT m_textLastPos; - int m_textCount; - int m_skill; + Sint32 m_textCount; + Sint32 m_skill; bool m_bInfo; - int m_infoHeight; + Sint32 m_infoHeight; POINT m_memoPos[4]; Uint8 m_cheminWork[MAXCELX*MAXCELY]; - int m_cheminNbPos; + Sint32 m_cheminNbPos; POINT m_cheminPos[MAXBLUPI*2]; - int m_cheminRank[MAXBLUPI*2]; + Sint32 m_cheminRank[MAXBLUPI*2]; bool m_bFillFloor; - int m_fillSearchChannel; - int m_fillSearchIcon; - int m_fillPutChannel; - int m_fillPutIcon; + Sint32 m_fillSearchChannel; + Sint32 m_fillSearchIcon; + Sint32 m_fillPutChannel; + Sint32 m_fillPutIcon; char* m_pFillMap; }; @@ -537,9 +537,9 @@ protected: ///////////////////////////////////////////////////////////////////////////// -POINT GetCel (int x, int y); -POINT GetCel (POINT cel, int x, int y); +POINT GetCel (Sint32 x, Sint32 y); +POINT GetCel (POINT cel, Sint32 x, Sint32 y); bool IsValid (POINT cel); -POINT GetVector (int direct); -extern int table_multi_goal[]; -extern short table_actions[]; +POINT GetVector (Sint32 direct); +extern Sint32 table_multi_goal[]; +extern Sint16 table_actions[]; diff --git a/src/decstat.cpp b/src/decstat.cpp index 7efe13f..62e9b20 100644 --- a/src/decstat.cpp +++ b/src/decstat.cpp @@ -24,15 +24,15 @@ typedef struct { - short bExist; - short perso; // -1=objet, -2=feu, -3=flèche - short firstIcon; // négatif si sol - short lastIcon; // négatif si sol - short drawIcon; - short bBigIcon; + Sint16 bExist; + Sint16 perso; // -1=objet, -2=feu, -3=flèche + Sint16 firstIcon; // négatif si sol + Sint16 lastIcon; // négatif si sol + Sint16 drawIcon; + Sint16 bBigIcon; const char *text; - short nb; - short lastShow; + Sint16 nb; + Sint16 lastShow; } Statistic; @@ -360,7 +360,7 @@ static Statistic table_statistic[] = // Retourne la statistique correspondant à un rang donné. -Statistic* StatisticGet(int rank) +Statistic* StatisticGet(Sint32 rank) { Statistic* pStatistic; @@ -412,7 +412,7 @@ void CDecor::StatisticInit() void CDecor::StatisticUpdate() { - int rank, x, y, icon, nb; + Sint32 rank, x, y, icon, nb; bool bHach; Statistic* pStatistic; @@ -643,7 +643,7 @@ void CDecor::StatisticUpdate() // Retourne le nombre de blupi. -int CDecor::StatisticGetBlupi() +Sint32 CDecor::StatisticGetBlupi() { return table_statistic[STATBLUPIf].nb + table_statistic[STATBLUPIm].nb + @@ -652,7 +652,7 @@ int CDecor::StatisticGetBlupi() // Retourne le nombre de cellules en feu. -int CDecor::StatisticGetFire() +Sint32 CDecor::StatisticGetFire() { return table_statistic[STATFEU].nb; } @@ -663,7 +663,7 @@ void CDecor::StatisticDraw() { POINT pos; RECT rect; - int rank, icon, nb; + Sint32 rank, icon, nb; Statistic* pStatistic; char text[50]; const char *textRes; @@ -805,7 +805,7 @@ void CDecor::GenerateStatictic() bool CDecor::StatisticDown(POINT pos) { - int hili, rank, x, y, show, icon; + Sint32 hili, rank, x, y, show, icon; POINT cel; Statistic* pStatistic; @@ -994,7 +994,7 @@ bool CDecor::StatisticDown(POINT pos) bool CDecor::StatisticMove(POINT pos) { - int rank; + Sint32 rank; rank = StatisticDetect(pos); @@ -1016,9 +1016,9 @@ bool CDecor::StatisticUp(POINT pos) // Détecte dans quelle statistique est la souris. -int CDecor::StatisticDetect(POINT pos) +Sint32 CDecor::StatisticDetect(POINT pos) { - int rank; + Sint32 rank; // Dans un bouton stop/setup/write ? if ( pos.x >= 10 && pos.x <= 10+42*3 && @@ -3,6 +3,8 @@ #pragma once +#include <SDL2/SDL_stdinc.h> + #define _INTRO false // true si images d'introduction @@ -603,17 +605,17 @@ enum MouseSprites typedef struct { - short bHachBlupi; // blupi sur dalle hachurée - short bHachPlanche; // planches sur dalle hachurée - short bStopFire; // feu éteint - short nbMinBlupi; // nb de blupi nécessaires - short nbMaxBlupi; // nb de blupi nécessaires - short bHomeBlupi; // blupi à la maison - short bKillRobots; // plus d'ennemis - short bHachTomate; // tomates sur dalle hachurée - short bHachMetal; // métal sur dalle hachurée - short bHachRobot; // robot sur dalle hachurée - short reserve[14]; + Sint16 bHachBlupi; // blupi sur dalle hachurée + Sint16 bHachPlanche; // planches sur dalle hachurée + Sint16 bStopFire; // feu éteint + Sint16 nbMinBlupi; // nb de blupi nécessaires + Sint16 nbMaxBlupi; // nb de blupi nécessaires + Sint16 bHomeBlupi; // blupi à la maison + Sint16 bKillRobots; // plus d'ennemis + Sint16 bHachTomate; // tomates sur dalle hachurée + Sint16 bHachMetal; // métal sur dalle hachurée + Sint16 bHachRobot; // robot sur dalle hachurée + Sint16 reserve[14]; } Term; diff --git a/src/event.cpp b/src/event.cpp index 396b0a1..ed90c4c 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -34,21 +34,21 @@ typedef struct { - short majRev; - short minRev; - short reserve1[9]; - short exercice; // exercice en cours (0..n) - short mission; // mission en cours (0..n) - short speed; - short bMovie; - short maxMission; // dernière mission effectuée (0..n) - short scrollSpeed; - short audioVolume; - short midiVolume; - short bAccessBuild; - short prive; - short skill; - short reserve2[93]; + Sint16 majRev; + Sint16 minRev; + Sint16 reserve1[9]; + Sint16 exercice; // exercice en cours (0..n) + Sint16 mission; // mission en cours (0..n) + Sint16 speed; + Sint16 bMovie; + Sint16 maxMission; // dernière mission effectuée (0..n) + Sint16 scrollSpeed; + Sint16 audioVolume; + Sint16 midiVolume; + Sint16 bAccessBuild; + Sint16 prive; + Sint16 skill; + Sint16 reserve2[93]; } DescInfo; @@ -1453,7 +1453,7 @@ static Phase table[] = CEvent::CEvent() { - int i; + Sint32 i; m_bFullScreen = true; m_mouseType = MOUSETYPEGRA; @@ -1524,7 +1524,7 @@ CEvent::~CEvent() POINT CEvent::GetMousePos() { POINT pos; - int x, y; + Sint32 x, y; SDL_GetMouseState (&x, &y); pos.x = x; @@ -1543,7 +1543,7 @@ void CEvent::SetFullScreen(bool bFullScreen) // Initialise le type de souris. -void CEvent::SetMouseType(int mouseType) +void CEvent::SetMouseType(Sint32 mouseType) { m_mouseType = mouseType; } @@ -1573,13 +1573,13 @@ void CEvent::Create(CPixmap *pPixmap, CDecor *pDecor, // Retourne l'index d'un bouton. -int CEvent::GetButtonIndex(int button) +Sint32 CEvent::GetButtonIndex(Sint32 button) { - int i=0; + Sint32 i=0; while ( table[m_index].buttons[i].message != 0 ) { - if ( (unsigned int) button == table[m_index].buttons[i].message ) + if ( (Uint32) button == table[m_index].buttons[i].message ) { return i; } @@ -1589,9 +1589,9 @@ int CEvent::GetButtonIndex(int button) return -1; } -int CEvent::GetState(int button) +Sint32 CEvent::GetState(Sint32 button) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return 0; @@ -1599,9 +1599,9 @@ int CEvent::GetState(int button) return m_buttons[index].GetState(); } -void CEvent::SetState(int button, int state) +void CEvent::SetState(Sint32 button, Sint32 state) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return; @@ -1609,9 +1609,9 @@ void CEvent::SetState(int button, int state) m_buttons[index].SetState(state); } -bool CEvent::GetEnable(int button) +bool CEvent::GetEnable(Sint32 button) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return 0; @@ -1619,9 +1619,9 @@ bool CEvent::GetEnable(int button) return m_buttons[index].GetEnable(); } -void CEvent::SetEnable(int button, bool bEnable) +void CEvent::SetEnable(Sint32 button, bool bEnable) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return; @@ -1629,9 +1629,9 @@ void CEvent::SetEnable(int button, bool bEnable) m_buttons[index].SetEnable(bEnable); } -bool CEvent::GetHide(int button) +bool CEvent::GetHide(Sint32 button) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return 0; @@ -1639,9 +1639,9 @@ bool CEvent::GetHide(int button) return m_buttons[index].GetHide(); } -void CEvent::SetHide(int button, bool bHide) +void CEvent::SetHide(Sint32 button, bool bHide) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return; @@ -1649,9 +1649,9 @@ void CEvent::SetHide(int button, bool bHide) m_buttons[index].SetHide(bHide); } -int CEvent::GetMenu(int button) +Sint32 CEvent::GetMenu(Sint32 button) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return 0; @@ -1659,9 +1659,9 @@ int CEvent::GetMenu(int button) return m_buttons[index].GetMenu(); } -void CEvent::SetMenu(int button, int menu) +void CEvent::SetMenu(Sint32 button, Sint32 menu) { - int index; + Sint32 index; index = GetButtonIndex(button); if ( index < 0 ) return; @@ -1675,7 +1675,7 @@ void CEvent::SetMenu(int button, int menu) void CEvent::RestoreGame() { - int i; + Sint32 i; if ( m_phase == WM_PHASE_PLAY ) { @@ -1702,7 +1702,7 @@ void CEvent::RestoreGame() bool CEvent::CreateButtons() { - int i=0, message; + Sint32 i=0, message; POINT pos; bool bMinimizeRedraw = false; @@ -1750,7 +1750,7 @@ bool CEvent::CreateButtons() void AddCheatCode(char *pDst, char *pSrc) { - int i; + Sint32 i; size_t j; if ( pDst[0] != 0 ) strcat(pDst, " / "); @@ -1766,7 +1766,7 @@ void AddCheatCode(char *pDst, char *pSrc) // Dessine un texte multi-lignes centré. -void CEvent::DrawTextCenter(const char *text, int x, int y, int font) +void CEvent::DrawTextCenter(const char *text, Sint32 x, Sint32 y, Sint32 font) { POINT pos; pos.x = x; @@ -1778,10 +1778,10 @@ void CEvent::DrawTextCenter(const char *text, int x, int y, int font) bool CEvent::DrawButtons() { - int i; - int levels[2]; - int types[2]; - int world, time, lg, button, volume, pente, icon; + Sint32 i; + Sint32 levels[2]; + Sint32 types[2]; + Sint32 world, time, lg, button, volume, pente, icon; char res[100]; char text[100]; POINT pos; @@ -2521,7 +2521,7 @@ void CEvent::HideMouse(bool bHide) bool CEvent::EventButtons(const SDL_Event &event, POINT pos) { POINT test; - int lg, oldx, sound; + Sint32 lg, oldx, sound; // Cherche le tool tips à utiliser pour la souris. m_textToolTips[0] = 0; @@ -2557,13 +2557,13 @@ bool CEvent::EventButtons(const SDL_Event &event, POINT pos) if ( oldx != m_posToolTips.x ) { - for (int i = 0; i < 2; i++) + for (Sint32 i = 0; i < 2; i++) m_jauges[i].SetRedraw(); } } else { - int i = 0; + Sint32 i = 0; while ( table[m_index].buttons[i].message != 0 ) { const auto text = m_buttons[i].GetToolTips(pos); @@ -2660,7 +2660,7 @@ bool CEvent::EventButtons(const SDL_Event &event, POINT pos) } - int i = 0; + Sint32 i = 0; while ( table[m_index].buttons[i].message != 0 ) { if ( m_buttons[i].TreatEvent(event) ) return true; @@ -2680,7 +2680,7 @@ bool CEvent::EventButtons(const SDL_Event &event, POINT pos) bool CEvent::MouseOnButton(POINT pos) { - int i; + Sint32 i; i = 0; while ( table[m_index].buttons[i].message != 0 ) @@ -2695,9 +2695,9 @@ bool CEvent::MouseOnButton(POINT pos) // Retourne l'index dans table pour une phase donnée. -int CEvent::SearchPhase(unsigned int phase) +Sint32 CEvent::SearchPhase(Uint32 phase) { - int i=0; + Sint32 i=0; while ( table[i].phase != 0 ) { @@ -2710,7 +2710,7 @@ int CEvent::SearchPhase(unsigned int phase) // Donne le numéro du monde. -int CEvent::GetWorld() +Sint32 CEvent::GetWorld() { if ( m_bPrivate ) return m_private; if ( m_bSchool ) return m_exercice; @@ -2719,14 +2719,14 @@ int CEvent::GetWorld() // Donne le numéro physique du monde. -int CEvent::GetPhysicalWorld() +Sint32 CEvent::GetPhysicalWorld() { if ( m_bPrivate ) return m_private+200; if ( m_bSchool ) return m_exercice; else return m_mission+100; } -int CEvent::GetImageWorld() +Sint32 CEvent::GetImageWorld() { if ( m_bPrivate ) return 2; if ( m_bSchool ) return 0; @@ -2753,9 +2753,9 @@ bool CEvent::IsHelpHide() // Change de phase. -bool CEvent::ChangePhase(unsigned int phase) +bool CEvent::ChangePhase(Uint32 phase) { - int index, world, time, total, music, i, max; + Sint32 index, world, time, total, music, i, max; POINT totalDim, iconDim; char filename[MAX_PATH]; char* pButtonExist; @@ -3157,7 +3157,7 @@ bool CEvent::ChangePhase(unsigned int phase) // Retourne la phase en cours. -unsigned int CEvent::GetPhase() +Uint32 CEvent::GetPhase() { return m_phase; } @@ -3200,7 +3200,7 @@ void CEvent::MovieToStart() // Décale le décor. -void CEvent::DecorShift(int dx, int dy) +void CEvent::DecorShift(Sint32 dx, Sint32 dy) { POINT coin; @@ -3220,7 +3220,7 @@ void CEvent::DecorShift(int dx, int dy) void CEvent::DecorAutoShift(POINT pos) { - int max; + Sint32 max; POINT offset; m_bShift = false; @@ -3347,7 +3347,7 @@ bool CEvent::PlayDown(POINT pos, const SDL_Event &event) { bool bDecor = false; bool bMap = false; - int rank, button, h; + Sint32 rank, button, h; POINT cel; m_pDecor->BlupiSetArrow(0, false); // enlève toutes les flèches @@ -3458,7 +3458,7 @@ bool CEvent::PlayMove(POINT pos, Uint16 mod) bool CEvent::PlayUp(POINT pos, Uint16 mod) { - static int table_sound_boing[3] = + static Sint32 table_sound_boing[3] = { SOUND_BOING1, SOUND_BOING2, @@ -3503,9 +3503,9 @@ bool CEvent::PlayUp(POINT pos, Uint16 mod) // Clic dans un bouton. // Message = WM_BUTTON0..WM_BUTTON39 -void CEvent::ChangeButtons(int message) +void CEvent::ChangeButtons(Sint32 message) { - int button, state, volume, max; + Sint32 button, state, volume, max; char* pButtonExist; Term* pTerm; @@ -3674,9 +3674,9 @@ void CEvent::ChangeButtons(int message) // Met un sol si nécessaire sous un objet. -void CEvent::BuildFloor(POINT cel, int insIcon) +void CEvent::BuildFloor(POINT cel, Sint32 insIcon) { - int iFloor, channel, icon; + Sint32 iFloor, channel, icon; if ( insIcon == -1 ) return; // supprime ? @@ -3725,9 +3725,9 @@ void CEvent::BuildFloor(POINT cel, int insIcon) // Enlève si nécessaire un objet sur l'eau. -void CEvent::BuildWater(POINT cel, int insIcon) +void CEvent::BuildWater(POINT cel, Sint32 insIcon) { - int channel, icon; + Sint32 channel, icon; if ( insIcon != 14 ) return; // rien à faire si pas eau @@ -3744,7 +3744,7 @@ void CEvent::BuildWater(POINT cel, int insIcon) // Cette table donne les objets à construire en fonction // du choix dans le menu. -static int tableFloor[] = +static Sint32 tableFloor[] = { 1,49,50,51,0,0,0,0,0,0, // 0 herbe 20,66,79,0,0,0,0,0,0,0, // 1 foncé @@ -3754,7 +3754,7 @@ static int tableFloor[] = 52,80,0,0,0,0,0,0,0,0, // 5 couveuse }; -static int tableObject[] = +static Sint32 tableObject[] = { -1,0,0,0,0,0,0,0,0,0, // 0 détruit 0,4,1,2,3,5,0,0,0,0, // 1 plantes @@ -3762,7 +3762,7 @@ static int tableObject[] = 81,83,94,0,0,0,0,0,0,0, // 5 fleurs }; -static int tableHome[] = +static Sint32 tableHome[] = { -1,0,0,0,0,0,0,0,0,0, // 0 détruit 113,61,28,120,0,0,0,0,0,0, // 1 maison @@ -3782,7 +3782,7 @@ static int tableHome[] = bool CEvent::BuildDown(POINT pos, Uint16 mod, bool bMix) { POINT cel; - int menu, channel, icon; + Sint32 menu, channel, icon; if ( bMix && m_pDecor->MapMove(pos) ) return true; @@ -4028,9 +4028,9 @@ bool CEvent::IsMovie() // Lit une partie (user000.blp). -void CEvent::Read(int message) +void CEvent::Read(Sint32 message) { - int world, time, total; + Sint32 world, time, total; m_pDecor->Read(message-WM_READ0, true, world, time, total); m_pDecor->SetTime(time); @@ -4058,9 +4058,9 @@ void CEvent::Read(int message) // Ecrit une partie (user000.blp). -void CEvent::Write(int message) +void CEvent::Write(Sint32 message) { - int time, total; + Sint32 time, total; time = m_pDecor->GetTime(); total = m_pDecor->GetTotalTime(); @@ -4074,7 +4074,7 @@ void CEvent::Write(int message) void CEvent::PrivateLibelle() { - int i, nb, h1, h2; + Sint32 i, nb, h1, h2; Term term; char string[100]; char buffer[100]; @@ -4154,14 +4154,14 @@ void CEvent::PrivateLibelle() // Lit le libellé d'un monde. -bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp) +bool CEvent::ReadLibelle(Sint32 world, bool bSchool, bool bHelp) { FILE* file = nullptr; char* pBuffer = nullptr; char* pText; char* pDest; char indic; - int h1, h2; + Sint32 h1, h2; size_t nb; if ( bSchool ) indic = '$'; @@ -4302,9 +4302,9 @@ bool CEvent::ReadInfo() // Modifie la vitesse du jeu. -void CEvent::SetSpeed(int speed) +void CEvent::SetSpeed(Sint32 speed) { - int max; + Sint32 max; if ( m_bSpeed ) max = 8; else max = 2; @@ -4314,7 +4314,7 @@ void CEvent::SetSpeed(int speed) m_speed = speed; } -int CEvent::GetSpeed() +Sint32 CEvent::GetSpeed() { return m_speed; } @@ -4386,7 +4386,7 @@ bool CEvent::DemoPlayStart() char filename[MAX_PATH]; FILE* file = nullptr; DemoHeader header; - int world, time, total; + Sint32 world, time, total; size_t nb; m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); @@ -4448,12 +4448,12 @@ void CEvent::DemoPlayStop() ChangePhase(WM_PHASE_INIT); } -void CEvent::WinToSDLEvent (unsigned int msg, WPARAM wParam, LPARAM lParam, SDL_Event &event) +void CEvent::WinToSDLEvent (Uint32 msg, WPARAM wParam, LPARAM lParam, SDL_Event &event) { -#define GET_X_LPARAM(lp) ((int) (short) LOWORD (lp)) -#define GET_Y_LPARAM(lp) ((int) (short) HIWORD (lp)) +#define GET_X_LPARAM(lp) ((Sint32) (Sint16) LOWORD (lp)) +#define GET_Y_LPARAM(lp) ((Sint32) (Sint16) HIWORD (lp)) - static const std::unordered_map<unsigned int, SDL_Keysym> keycodes = { + static const std::unordered_map<Uint32, SDL_Keysym> keycodes = { { '0', { SDL_SCANCODE_0, SDLK_0, 0, 0 } }, { '1', { SDL_SCANCODE_1, SDLK_1, 0, 0 } }, { '2', { SDL_SCANCODE_2, SDLK_2, 0, 0 } }, @@ -4544,8 +4544,8 @@ void CEvent::WinToSDLEvent (unsigned int msg, WPARAM wParam, LPARAM lParam, SDL_ void CEvent::DemoStep() { - int time; - unsigned int message; + Sint32 time; + Uint32 message; WPARAM wParam; LPARAM lParam; @@ -4599,7 +4599,7 @@ void CEvent::DemoStep() // Mémorise un événement. -void CEvent::DemoRecEvent(unsigned int message, WPARAM wParam, LPARAM lParam) +void CEvent::DemoRecEvent(Uint32 message, WPARAM wParam, LPARAM lParam) { if ( m_bDemoRec && m_pDemoBuffer != nullptr && (message == WM_KEYDOWN || @@ -4615,15 +4615,15 @@ void CEvent::DemoRecEvent(unsigned int message, WPARAM wParam, LPARAM lParam) m_pDemoBuffer[m_demoIndex-1].time == m_demoTime && m_pDemoBuffer[m_demoIndex-1].message == message ) { - m_pDemoBuffer[m_demoIndex-1].wParam = static_cast<unsigned int> (wParam); - m_pDemoBuffer[m_demoIndex-1].lParam = static_cast<unsigned int> (lParam); + m_pDemoBuffer[m_demoIndex-1].wParam = static_cast<Uint32> (wParam); + m_pDemoBuffer[m_demoIndex-1].lParam = static_cast<Uint32> (lParam); } else { m_pDemoBuffer[m_demoIndex].time = m_demoTime; m_pDemoBuffer[m_demoIndex].message = message; - m_pDemoBuffer[m_demoIndex].wParam = static_cast<unsigned int> (wParam); - m_pDemoBuffer[m_demoIndex].lParam = static_cast<unsigned int> (lParam); + m_pDemoBuffer[m_demoIndex].wParam = static_cast<Uint32> (wParam); + m_pDemoBuffer[m_demoIndex].lParam = static_cast<Uint32> (lParam); m_demoIndex ++; if ( m_demoIndex >= MAXDEMO ) @@ -4668,7 +4668,7 @@ bool CEvent::TreatEvent(const SDL_Event &event) bool CEvent::TreatEventBase(const SDL_Event &event) { POINT pos; - int i, sound; + Sint32 i, sound; char c; bool bEnable; @@ -5356,7 +5356,7 @@ void CEvent::IntroStep() } } -void CEvent::PushUserEvent (int code) +void CEvent::PushUserEvent (Sint32 code) { SDL_Event event; diff --git a/src/event.h b/src/event.h index c8ea970..9129f6e 100644 --- a/src/event.h +++ b/src/event.h @@ -15,19 +15,19 @@ class CMovie; typedef struct { - unsigned int message; - int type; - int iconMenu[20]; - int x, y; + Uint32 message; + Sint32 type; + Sint32 iconMenu[20]; + Sint32 x, y; const char *toolTips[16]; } Button; typedef struct { - unsigned int phase; + Uint32 phase; char backName[20]; - int bCDrom; + Sint32 bCDrom; Button buttons[MAXBUTTON]; } Phase; @@ -35,22 +35,22 @@ Phase; typedef struct { - short majRev; - short minRev; - short bSchool; - short bPrivate; - short world; - short skill; - short reserve1[99]; + Sint16 majRev; + Sint16 minRev; + Sint16 bSchool; + Sint16 bPrivate; + Sint16 world; + Sint16 skill; + Sint16 reserve1[99]; } DemoHeader; typedef struct { - int time; - unsigned int message; - unsigned int wParam; // WPARAM - unsigned int lParam; // LPARAM + Sint32 time; + Uint32 message; + Uint32 wParam; // WPARAM + Uint32 lParam; // LPARAM } DemoEvent; @@ -64,26 +64,26 @@ public: POINT GetMousePos(); void Create(CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie); void SetFullScreen(bool bFullScreen); - void SetMouseType(int mouseType); - int GetWorld(); - int GetPhysicalWorld(); - int GetImageWorld(); + void SetMouseType(Sint32 mouseType); + Sint32 GetWorld(); + Sint32 GetPhysicalWorld(); + Sint32 GetImageWorld(); bool IsHelpHide(); - bool ChangePhase(unsigned int phase); + bool ChangePhase(Uint32 phase); void MovieToStart(); - unsigned int GetPhase(); + Uint32 GetPhase(); void TryInsert(); void RestoreGame(); - int GetButtonIndex(int button); - int GetState(int button); - void SetState(int button, int state); - bool GetEnable(int button); - void SetEnable(int button, bool bEnable); - bool GetHide(int button); - void SetHide(int button, bool bHide); - int GetMenu(int button); - void SetMenu(int button, int menu); + Sint32 GetButtonIndex(Sint32 button); + Sint32 GetState(Sint32 button); + void SetState(Sint32 button, Sint32 state); + bool GetEnable(Sint32 button); + void SetEnable(Sint32 button, bool bEnable); + bool GetHide(Sint32 button); + void SetHide(Sint32 button, bool bHide); + Sint32 GetMenu(Sint32 button); + void SetMenu(Sint32 button, Sint32 menu); bool DrawButtons(); MouseSprites MousePosToSprite(POINT pos); @@ -100,11 +100,11 @@ public: void StopMovie(); bool IsMovie(); - void Read(int message); - void Write(int message); + void Read(Sint32 message); + void Write(Sint32 message); - void SetSpeed(int speed); - int GetSpeed(); + void SetSpeed(Sint32 speed); + Sint32 GetSpeed(); bool GetPause(); bool IsShift(); @@ -113,29 +113,29 @@ public: void IntroStep(); public: - static void PushUserEvent (int code); + static void PushUserEvent (Sint32 code); protected: - void DrawTextCenter(const char *text, int x, int y, int font=0); + void DrawTextCenter(const char *text, Sint32 x, Sint32 y, Sint32 font=0); bool CreateButtons(); bool EventButtons(const SDL_Event &event, POINT pos); bool MouseOnButton(POINT pos); - int SearchPhase(unsigned int phase); - void DecorShift(int dx, int dy); + Sint32 SearchPhase(Uint32 phase); + void DecorShift(Sint32 dx, Sint32 dy); bool PlayDown(POINT pos, const SDL_Event &event); bool PlayMove(POINT pos, Uint16 mod); bool PlayUp(POINT pos, Uint16 mod); - void ChangeButtons(int message); + void ChangeButtons(Sint32 message); - void BuildFloor(POINT cel, int insIcon); - void BuildWater(POINT cel, int insIcon); + void BuildFloor(POINT cel, Sint32 insIcon); + void BuildWater(POINT cel, Sint32 insIcon); bool BuildDown(POINT pos, Uint16 mod, bool bMix=true); bool BuildMove(POINT pos, Uint16 mod, const SDL_Event &event); bool BuildUp(POINT pos); void PrivateLibelle(); - bool ReadLibelle(int world, bool bSchool, bool bHelp); + bool ReadLibelle(Sint32 world, bool bSchool, bool bHelp); bool WriteInfo(); bool ReadInfo(); @@ -143,71 +143,71 @@ protected: void DemoRecStop(); bool DemoPlayStart(); void DemoPlayStop(); - static void WinToSDLEvent (unsigned int msg, WPARAM wParam, LPARAM lParam, SDL_Event &event); - void DemoRecEvent(unsigned int message, WPARAM wParam, LPARAM lParam); + static void WinToSDLEvent (Uint32 msg, WPARAM wParam, LPARAM lParam, SDL_Event &event); + void DemoRecEvent(Uint32 message, WPARAM wParam, LPARAM lParam); protected: - int m_speed; - int m_exercice; - int m_mission; - int m_private; - int m_maxMission; - unsigned int m_phase; - int m_index; + Sint32 m_speed; + Sint32 m_exercice; + Sint32 m_mission; + Sint32 m_private; + Sint32 m_maxMission; + Uint32 m_phase; + Sint32 m_index; bool m_bSchool; bool m_bPrivate; bool m_bAccessBuild; bool m_bFullScreen; - int m_mouseType; + Sint32 m_mouseType; CPixmap* m_pPixmap; CDecor* m_pDecor; CSound* m_pSound; CMovie* m_pMovie; char m_movieToStart[MAX_PATH]; - int m_phaseAfterMovie; + Sint32 m_phaseAfterMovie; CButton m_buttons[MAXBUTTON]; - int m_lastFloor[MAXBUTTON]; - int m_lastObject[MAXBUTTON]; - int m_lastHome[MAXBUTTON]; + Sint32 m_lastFloor[MAXBUTTON]; + Sint32 m_lastObject[MAXBUTTON]; + Sint32 m_lastHome[MAXBUTTON]; bool m_bRunMovie; bool m_bBuildModify; CJauge m_jauges[2]; CMenu m_menu; bool m_bMenu; POINT m_menuPos; - int m_menuNb; - int m_menuButtons[MAXBUTTON]; - int m_menuErrors[MAXBUTTON]; - std::unordered_map<int, const char *> m_menuTexts; - int m_menuPerso; + Sint32 m_menuNb; + Sint32 m_menuButtons[MAXBUTTON]; + Sint32 m_menuErrors[MAXBUTTON]; + std::unordered_map<Sint32, const char *> m_menuTexts; + Sint32 m_menuPerso; POINT m_menuCel; POINT m_oldMousePos; bool m_bMouseDown; bool m_bHili; - int m_fileWorld[10]; - int m_fileTime[10]; + Sint32 m_fileWorld[10]; + Sint32 m_fileTime[10]; POINT m_posToolTips; char m_textToolTips[50]; MouseSprites m_mouseSprite; bool m_bFillMouse; bool m_bWaitMouse; bool m_bHideMouse; - int m_rankCheat; - int m_posCheat; + Sint32 m_rankCheat; + Sint32 m_posCheat; bool m_bMovie; bool m_bSpeed; bool m_bHelp; bool m_bAllMissions; bool m_bChangeCheat; - int m_scrollSpeed; + Sint32 m_scrollSpeed; bool m_bPause; bool m_bShift; - int m_shiftPhase; + Sint32 m_shiftPhase; POINT m_shiftVector; POINT m_shiftOffset; char m_libelle[1000]; - int m_tryPhase; - int m_tryInsertCount; + Sint32 m_tryPhase; + Sint32 m_tryInsertCount; POINT m_posInfoButton; POINT m_posHelpButton; bool m_bHiliInfoButton; @@ -216,13 +216,13 @@ protected: bool m_bDemoRec; bool m_bDemoPlay; DemoEvent* m_pDemoBuffer; - int m_demoTime; + Sint32 m_demoTime; size_t m_demoIndex; size_t m_demoEnd; - int m_demoNumber; + Sint32 m_demoNumber; Uint16 m_keymod; POINT m_debugPos; - int m_introTime; + Sint32 m_introTime; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/fifo.cpp b/src/fifo.cpp index 3d549b7..b2b5ab1 100644 --- a/src/fifo.cpp +++ b/src/fifo.cpp @@ -1,14 +1,15 @@ // Class CFifo, gestion d'une liste en fifo #include <stdlib.h> +#include <SDL2/SDL_stdinc.h> #include "fifo.h" -// gestion d'une pile classée en valeur croissantes -// typiquement reprend les coordonnées les plus proches +// gestion d'une pile classée en valeur croissantes +// typiquement reprend les coordonnées les plus proches // du but en premier lieu -CPileTriee::CPileTriee(long taille) +CPileTriee::CPileTriee(Sint32 taille) { m_taille = taille; m_max = m_out = 0; @@ -20,26 +21,26 @@ CPileTriee::~CPileTriee() free( m_data ); } -long CPileTriee::get() +Sint32 CPileTriee::get() { if (m_out == m_max) return -1; - long val = m_data [m_out].pos; + Sint32 val = m_data [m_out].pos; m_out++; if (m_out>=m_taille) m_out = 0; return val; } -void CPileTriee::put(long pos, long dist) +void CPileTriee::put(Sint32 pos, Sint32 dist) { - long i=m_out; - long p,d,m; + Sint32 i=m_out; + Sint32 p,d,m; while (i!=m_max) { - // le point est-il plus proche que celui-là ? + // le point est-il plus proche que celui-là ? if (dist<m_data[i].dist) { - // oui, insert et décale le suivant + // oui, insert et décale le suivant p = m_data[i].pos; d = m_data[i].dist; m_data[i].pos = pos; @@ -51,7 +52,7 @@ void CPileTriee::put(long pos, long dist) if (i>=m_taille) i=0; } - // ajoute le point éloigné à la suite + // ajoute le point éloigné à la suite m = m_max+1; if (m>=m_taille) m=0; if (m!=m_out) @@ -60,4 +61,4 @@ void CPileTriee::put(long pos, long dist) m_data[m_max].dist = dist; m_max = m; } -}
\ No newline at end of file +} @@ -8,8 +8,8 @@ // en fonction de leur distance à la cible typedef struct { - long pos; - long dist; + Sint32 pos; + Sint32 dist; } Element; @@ -19,15 +19,15 @@ Element; class CPileTriee { private: - long m_taille; // nombre de polongs max - long m_max; // position limite - long m_out; // position pour reprendre + Sint32 m_taille; // nombre de polongs max + Sint32 m_max; // position limite + Sint32 m_out; // position pour reprendre Element* m_data; // données public: - CPileTriee(long taille); + CPileTriee(Sint32 taille); ~CPileTriee(); - void put(long pos, long dist); - long get(); + void put(Sint32 pos, Sint32 dist); + Sint32 get(); };
\ No newline at end of file diff --git a/src/fog.cpp b/src/fog.cpp index 4b3c89b..62229c8 100644 --- a/src/fog.cpp +++ b/src/fog.cpp @@ -27,7 +27,7 @@ static char tableFog[15*4] = // Retourne les bits contenant du brouillard. -bool GetFogBits(int icon, char *pBits) +bool GetFogBits(Sint32 icon, char *pBits) { pBits[0] = 0; pBits[1] = 0; @@ -46,9 +46,9 @@ bool GetFogBits(int icon, char *pBits) // Retourne l'icône correspondant aux bits de brouillard. -int GetFogIcon(char *pBits) +Sint32 GetFogIcon(char *pBits) { - int i; + Sint32 i; for ( i=0 ; i<15 ; i++ ) { @@ -108,9 +108,9 @@ static char table_fog[17*17] = // Ecarte le brouillard autour d'un blupi. -void CDecor::BlupiPushFog(int rank) +void CDecor::BlupiPushFog(Sint32 rank) { - int x, y, i; + Sint32 x, y, i; POINT cel; char cBits[4]; char nBits[4]; diff --git a/src/jauge.cpp b/src/jauge.cpp index c0d3536..420ae07 100644 --- a/src/jauge.cpp +++ b/src/jauge.cpp @@ -34,7 +34,7 @@ CJauge::~CJauge() // Crée un nouveau bouton. bool CJauge::Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, bool bMinimizeRedraw) + POINT pos, Sint32 type, bool bMinimizeRedraw) { m_pPixmap = pPixmap; m_pSound = pSound; @@ -54,7 +54,7 @@ bool CJauge::Create(CPixmap *pPixmap, CSound *pSound, void CJauge::Draw() { - int part; + Sint32 part; RECT rect; if ( m_bMinimizeRedraw && !m_bRedraw ) return; @@ -97,7 +97,7 @@ void CJauge::Redraw() // Modifie le niveau. -void CJauge::SetLevel(int level) +void CJauge::SetLevel(Sint32 level) { if ( level < 0 ) level = 0; if ( level > 100 ) level = 100; @@ -112,7 +112,7 @@ void CJauge::SetLevel(int level) // Modifie le type. -void CJauge::SetType(int type) +void CJauge::SetType(Sint32 type) { if ( m_type != type ) { diff --git a/src/jauge.h b/src/jauge.h index a4b6d78..25de815 100644 --- a/src/jauge.h +++ b/src/jauge.h @@ -15,12 +15,12 @@ public: ~CJauge(); bool Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, bool bMinimizeRedraw); + POINT pos, Sint32 type, bool bMinimizeRedraw); void Draw(); void Redraw(); - void SetLevel(int level); - void SetType(int type); + void SetLevel(Sint32 level); + void SetType(Sint32 type); bool GetHide(); void SetHide(bool bHide); @@ -35,8 +35,8 @@ protected: bool m_bHide; // true si bouton caché POINT m_pos; // coin sup/gauche POINT m_dim; // dimensions - int m_type; - int m_level; + Sint32 m_type; + Sint32 m_level; bool m_bMinimizeRedraw; bool m_bRedraw; // true -> doit être redessiné }; diff --git a/src/menu.cpp b/src/menu.cpp index 8e89c5e..1bb5488 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -22,7 +22,7 @@ #define MARGMENU 0 -static const short table_button_icon[] = +static const Sint16 table_button_icon[] = { 24, // go 40, // stop @@ -61,7 +61,7 @@ static const short table_button_icon[] = 106, // fabarmure }; -static const char *GetText(int rank) +static const char *GetText(Sint32 rank) { static const char *list[] = { "Go", @@ -104,7 +104,7 @@ static const char *GetText(int rank) return gettext (list[rank]); } -static const char *GetErr(int rank) +static const char *GetErr(Sint32 rank) { static const char *list[] = { "Impossible", @@ -141,9 +141,9 @@ CMenu::~CMenu() // Crée un nouveau bouton. bool CMenu::Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, int nb, int *pButtons, int *pErrors, - std::unordered_map<int, const char *> &texts, - int perso) + POINT pos, Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, + std::unordered_map<Sint32, const char *> &texts, + Sint32 perso) { pos.x -= DIMBUTTONX/2; pos.y -= DIMBUTTONY/2; @@ -177,10 +177,10 @@ bool CMenu::Create(CPixmap *pPixmap, CSound *pSound, // Met à jour le menu. -void CMenu::Update(int nb, int *pButtons, int *pErrors, - std::unordered_map<int, const char *> &texts) +void CMenu::Update(Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, + std::unordered_map<Sint32, const char *> &texts) { - int i; + Sint32 i; m_nbButtons = nb; @@ -212,7 +212,7 @@ void CMenu::Delete() void CMenu::Draw() { - int i, state, icon; + Sint32 i, state, icon; POINT pos; RECT oldClip, clipRect; char text[50]; @@ -357,7 +357,7 @@ void CMenu::Draw() // Retourne le bouton sélectionné. -int CMenu::GetSel() +Sint32 CMenu::GetSel() { if ( m_selRank == -1 ) return -1; @@ -366,7 +366,7 @@ int CMenu::GetSel() // Retourne le rang sélectionné. -int CMenu::GetRank() +Sint32 CMenu::GetRank() { return m_selRank; } @@ -436,9 +436,9 @@ bool CMenu::TreatEvent(const SDL_Event &event) // Détecte dans quel bouton est la souris. -int CMenu::Detect(POINT pos) +Sint32 CMenu::Detect(POINT pos) { - int rank; + Sint32 rank; if ( pos.x < m_pos.x || pos.x > m_pos.x+m_dim.x || pos.y < m_pos.y || pos.y > m_pos.y+m_dim.y ) return -1; @@ -14,15 +14,15 @@ public: ~CMenu(); bool Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, int nb, int *pButtons, int *pErrors, - std::unordered_map<int, const char *> &texts, - int perso); - void Update(int nb, int *pButtons, int *pErrors, - std::unordered_map<int, const char *> &texts); + POINT pos, Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, + std::unordered_map<Sint32, const char *> &texts, + Sint32 perso); + void Update(Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, + std::unordered_map<Sint32, const char *> &texts); void Delete(); void Draw(); - int GetSel(); - int GetRank(); + Sint32 GetSel(); + Sint32 GetRank(); bool IsError(); bool IsExist(); void Message(); @@ -30,7 +30,7 @@ public: bool TreatEvent(const SDL_Event &event); protected: - int Detect(POINT pos); + Sint32 Detect(POINT pos); bool MouseDown(POINT pos); bool MouseMove(POINT pos); bool MouseUp(POINT pos); @@ -41,14 +41,14 @@ protected: CSound* m_pSound; POINT m_pos; // coin sup/gauche POINT m_dim; // dimensions - int m_nbButtons; + Sint32 m_nbButtons; POINT m_nbCel; - int m_perso; - int m_buttons[MAXBUTTON]; - int m_errors[MAXBUTTON]; - std::unordered_map<int, const char *> m_texts; - unsigned int m_messages[MAXBUTTON]; - int m_selRank; + Sint32 m_perso; + Sint32 m_buttons[MAXBUTTON]; + Sint32 m_errors[MAXBUTTON]; + std::unordered_map<Sint32, const char *> m_texts; + Uint32 m_messages[MAXBUTTON]; + Sint32 m_selRank; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/misc.cpp b/src/misc.cpp index a25e822..68e262d 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -22,7 +22,7 @@ // Variables globales extern bool g_bFullScreen; // false si mode de test -extern int g_mouseType; +extern Sint32 g_mouseType; // Affiche un message de debug. @@ -60,14 +60,14 @@ void InitRandom() // Retourne un nombre al�atoire compris entre // deux bornes (inclues). -int Random(int min, int max) +Sint32 Random(Sint32 min, Sint32 max) { - long n; + Sint32 n; n = rand(); n = min+(n%(max-min+1)); - return (int)n; + return (Sint32)n; } @@ -11,7 +11,7 @@ extern void OutputDebug(const char *pMessage); extern POINT ConvLongToPos(LPARAM lParam); extern void InitRandom(); -extern int Random(int min, int max); +extern Sint32 Random(Sint32 min, Sint32 max); std::string GetBaseDir(); extern void AddUserPath(char *pFilename); diff --git a/src/movie.cpp b/src/movie.cpp index 86247c0..cc050be 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -25,7 +25,7 @@ bool CMovie::initAVI() { // Initialize Kitchensink with network support and all formats. - int err = Kit_Init (KIT_INIT_FORMATS); + Sint32 err = Kit_Init (KIT_INIT_FORMATS); if (err != 0) { fprintf (stderr, "Unable to initialize Kitchensink: %s", Kit_GetError ()); @@ -258,7 +258,7 @@ bool CMovie::Render () // Refresh audio if (SDL_GetQueuedAudioSize (m_audioDev) < AUDIOBUFFER_SIZE) { - int need = AUDIOBUFFER_SIZE - m_ret; + Sint32 need = AUDIOBUFFER_SIZE - m_ret; SDL_LockAudio (); while (need > 0) diff --git a/src/movie.h b/src/movie.h index a95e133..57df6f2 100644 --- a/src/movie.h +++ b/src/movie.h @@ -37,7 +37,7 @@ protected: Kit_Source *m_movie; Kit_Player *m_player; SDL_Texture *m_videoTex; - int m_ret; + Sint32 m_ret; SDL_AudioDeviceID m_audioDev; char m_audiobuf[AUDIOBUFFER_SIZE]; diff --git a/src/obstacle.cpp b/src/obstacle.cpp index 5a7619c..8c6455d 100644 --- a/src/obstacle.cpp +++ b/src/obstacle.cpp @@ -1267,12 +1267,12 @@ static char tableObstacleObject[] = // Retourne les obstacles autour d'une cellule, sous la // forme d'un tableau de 3x3. -void CDecor::SearchFloor(int rank, int icon, POINT cel, int *pBits) +void CDecor::SearchFloor(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits) { char* pTable; - int first, last; - int dx, dy, x, y, i; - int def = 0; + Sint32 first, last; + Sint32 dx, dy, x, y, i; + Sint32 def = 0; pTable = tableObstacleFloor; first = 0; @@ -1316,10 +1316,10 @@ void CDecor::SearchFloor(int rank, int icon, POINT cel, int *pBits) // Retourne les obstacles autour d'une cellule, sous la // forme d'un tableau de 3x3. -void CDecor::SearchObject(int rank, int icon, POINT cel, int *pBits) +void CDecor::SearchObject(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits) { char* pTable; - int dx, dy, x, y, i; + Sint32 dx, dy, x, y, i; if ( icon >= 0 && icon <= 127 ) { @@ -1350,9 +1350,9 @@ void CDecor::SearchObject(int rank, int icon, POINT cel, int *pBits) // Ajuste un sol en fonction du personnage. -void CDecor::AjustFloor(int rank, int icon, POINT cel, int *pBits) +void CDecor::AjustFloor(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits) { - int i; + Sint32 i; if ( rank < 0 ) return; @@ -1415,9 +1415,9 @@ void CDecor::AjustFloor(int rank, int icon, POINT cel, int *pBits) // Ajuste un obstacle en fonction du personnage. -void CDecor::AjustObject(int rank, int icon, POINT cel, int *pBits) +void CDecor::AjustObject(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits) { - int i; + Sint32 i; if ( rank < 0 ) return; @@ -1567,9 +1567,9 @@ void CDecor::AjustObject(int rank, int icon, POINT cel, int *pBits) // Copie un tableau 3x3 dans un tableau 9x9. -void Copy33To99(int *pSrc33, int *pDst99, int dx, int dy) +void Copy33To99(Sint32 *pSrc33, Sint32 *pDst99, Sint32 dx, Sint32 dy) { - int x, y; + Sint32 x, y; for ( y=0 ; y<3 ; y++ ) { @@ -1582,10 +1582,10 @@ void Copy33To99(int *pSrc33, int *pDst99, int dx, int dy) // Indique s'il est possible d'avancer dans une direction donnée. -bool CDecor::IsFreeDirect(POINT cel, int direct, int rank) +bool CDecor::IsFreeDirect(POINT cel, Sint32 direct, Sint32 rank) { - int icon, workBlupi; - int bits[3*3], obstacles[9*9]; + Sint32 icon, workBlupi; + Sint32 bits[3*3], obstacles[9*9]; POINT test, vector; vector = GetVector(direct); @@ -1656,8 +1656,8 @@ bool CDecor::IsFreeDirect(POINT cel, int direct, int rank) bool CDecor::IsFreeCelObstacle(POINT cel) { - int icon; - int bits[9]; + Sint32 icon; + Sint32 bits[9]; if ( !IsValid(cel) ) return false; @@ -1679,10 +1679,10 @@ bool CDecor::IsFreeCelObstacle(POINT cel) // en tenant compte uniquement des sols. // Retourne true si blupi peut y aller ! -bool CDecor::IsFreeCelFloor(POINT cel, int rank) +bool CDecor::IsFreeCelFloor(POINT cel, Sint32 rank) { - int icon; - int bits[9]; + Sint32 icon; + Sint32 bits[9]; if ( !IsValid(cel) ) return false; @@ -1701,11 +1701,11 @@ bool CDecor::IsFreeCelFloor(POINT cel, int rank) // Est utilisé pour savoir si blupi peut venir ici // débarquer en bateau ou monter dans sa jeep. -bool CDecor::IsFreeCelGo(POINT cel, int rank) +bool CDecor::IsFreeCelGo(POINT cel, Sint32 rank) { bool bOK; POINT limit; - int action, channel, icon; + Sint32 action, channel, icon; if ( rank == -1 ) return IsFreeCel(cel, rank); @@ -1765,11 +1765,11 @@ bool CDecor::IsFreeCelGo(POINT cel, int rank) // Est utilisé pour savoir comment est la mise en évidence (hili) // à cet endroit. -bool CDecor::IsFreeCelHili(POINT cel, int rank) +bool CDecor::IsFreeCelHili(POINT cel, Sint32 rank) { bool bOK; POINT limit; - int workBlupi, channel, icon, action; + Sint32 workBlupi, channel, icon, action; if ( IsValid(cel) ) { @@ -1808,10 +1808,10 @@ bool CDecor::IsFreeCelHili(POINT cel, int rank) // Indique si une cellule est libre. // Est utilisé pour savoir si blupi peut venir ici. -bool CDecor::IsFreeCel(POINT cel, int rank) +bool CDecor::IsFreeCel(POINT cel, Sint32 rank) { - int icon, workBlupi; - int bits[9]; + Sint32 icon, workBlupi; + Sint32 bits[9]; if ( !IsValid(cel) ) return false; @@ -1840,9 +1840,9 @@ bool CDecor::IsFreeCel(POINT cel, int rank) // Indique si blupi peut déposer un objet ici. -bool CDecor::IsFreeCelDepose(POINT cel, int rank) +bool CDecor::IsFreeCelDepose(POINT cel, Sint32 rank) { - int icon; + Sint32 icon; if ( !IsFreeCel(cel, rank) ) return false; @@ -1866,11 +1866,11 @@ bool CDecor::IsFreeCelDepose(POINT cel, int rank) // Le point retourné dans "limit" indique jusqu'où il est // possible de marcher normalement (sans passe muraille). -bool CDecor::IsFreeCelEmbarque(POINT cel, int rank, - int &action, POINT &limit) +bool CDecor::IsFreeCelEmbarque(POINT cel, Sint32 rank, + Sint32 &action, POINT &limit) { bool bOK; - int channel, icon; + Sint32 channel, icon; // Impossible si blupi n'est pas à pied, // ou s'il s'agit d'un disciple. @@ -1945,12 +1945,12 @@ bool CDecor::IsFreeCelEmbarque(POINT cel, int rank, // Le point retourné dans "limit" indique jusqu'où il est // possible de naviguer normalement (sans passe muraille). -bool CDecor::IsFreeCelDebarque(POINT cel, int rank, - int &action, POINT &limit) +bool CDecor::IsFreeCelDebarque(POINT cel, Sint32 rank, + Sint32 &action, POINT &limit) { bool bOK; - int channel1, icon1; - int channel2, icon2; + Sint32 channel1, icon1; + Sint32 channel2, icon2; // Impossible si blupi n'est pas en bateau. if ( rank == -1 || m_blupi[rank].vehicule != 1 ) return false; @@ -2009,11 +2009,11 @@ bool CDecor::IsFreeCelDebarque(POINT cel, int rank, // Indique s'il est possible de sauter dans une direction. -bool CDecor::IsFreeJump(POINT cel, int direct, int rank, int &action) +bool CDecor::IsFreeJump(POINT cel, Sint32 direct, Sint32 rank, Sint32 &action) { POINT depart, vector; - int i, icon; - int bits[3*3]; + Sint32 i, icon; + Sint32 bits[3*3]; // Refuse de sauter si blupi n'est pas à pied ! if ( m_blupi[rank].vehicule != 0 ) return false; @@ -2062,9 +2062,9 @@ bool CDecor::IsFreeJump(POINT cel, int direct, int rank, int &action) // Indique s'il est possible de glisser dans une direction. -bool CDecor::IsFreeGlisse(POINT cel, int direct, int rank, int &action) +bool CDecor::IsFreeGlisse(POINT cel, Sint32 direct, Sint32 rank, Sint32 &action) { - int channel, icon; + Sint32 channel, icon; // Y'a que blupi qui glisse ! if ( m_blupi[rank].perso != 0 ) return false; @@ -2085,10 +2085,10 @@ bool CDecor::IsFreeGlisse(POINT cel, int direct, int rank, int &action) // Cherche la meilleure direction pour atteindre un but. // Retourne -1 si on est déjà sur le but. -int CDecor::DirectSearch(POINT cel, POINT goal) +Sint32 CDecor::DirectSearch(POINT cel, POINT goal) { POINT dir; - int direct, tan; + Sint32 direct, tan; dir.x = goal.x - cel.x; dir.y = goal.y - cel.y; @@ -2171,7 +2171,7 @@ int CDecor::DirectSearch(POINT cel, POINT goal) // Vide les positions déjà essayées. -void CDecor::FlushUsed(int rank) +void CDecor::FlushUsed(Sint32 rank) { m_blupi[rank].nbUsed = 0; m_blupi[rank].nextRankUsed = 0; @@ -2179,9 +2179,9 @@ void CDecor::FlushUsed(int rank) // Ajoute une position déjà été essayée. -void CDecor::AddUsedPos(int rank, POINT pos) +void CDecor::AddUsedPos(Sint32 rank, POINT pos) { - int i, j, old; + Sint32 i, j, old; // Un virus est bête. if ( m_blupi[rank].perso == 2 ) return; @@ -2229,9 +2229,9 @@ void CDecor::AddUsedPos(int rank, POINT pos) // Cherche si une position a déjà été essayée. -bool CDecor::IsUsedPos(int rank, POINT pos) +bool CDecor::IsUsedPos(Sint32 rank, POINT pos) { - int i; + Sint32 i; for ( i=0 ; i<m_blupi[rank].nbUsed ; i++ ) { @@ -2245,10 +2245,10 @@ bool CDecor::IsUsedPos(int rank, POINT pos) // Cherche la meilleure direction pour atteindre un but. -bool CDecor::SearchBestBase(int rank, int &action, POINT &newCel, int &direct) +bool CDecor::SearchBestBase(Sint32 rank, Sint32 &action, POINT &newCel, Sint32 &direct) { - int searchDirect[8] = {0,1,7,2,6,5,3,4}; - int tryDirect, workBlupi, i, a; + Sint32 searchDirect[8] = {0,1,7,2,6,5,3,4}; + Sint32 tryDirect, workBlupi, i, a; POINT cel, vector; bool bFree; @@ -2341,10 +2341,10 @@ bool CDecor::SearchBestBase(int rank, int &action, POINT &newCel, int &direct) // Cherche la meilleure direction pour atteindre un but. -bool CDecor::SearchBestPass(int rank, int &action) +bool CDecor::SearchBestPass(Sint32 rank, Sint32 &action) { Blupi iBlupi; - int i, j, direct; + Sint32 i, j, direct; POINT iCel, lCel, cel; if ( m_blupi[rank].perso == 0 || // blupi ? @@ -2454,7 +2454,7 @@ bool CDecor::SearchBestPass(int rank, int &action) // Le sol doit permettre d'aller aux 4 coins, et il ne doit // pas y avoir un autre blupi que soi-même. -bool CDecor::IsWorkableObject(POINT cel, int rank) +bool CDecor::IsWorkableObject(POINT cel, Sint32 rank) { if ( !IsFreeCelFloor(GetCel(cel,0,0), -1) || !IsFreeCelFloor(GetCel(cel,1,0), -1) || @@ -2476,15 +2476,15 @@ bool CDecor::IsWorkableObject(POINT cel, int rank) // Cherche un autre objet pour continuer une action // (comme par exemple abatre des arbres). -bool CDecor::SearchOtherObject(int rank, POINT initCel, int action, - int distMax, int channel, - int firstIcon1, int lastIcon1, - int firstIcon2, int lastIcon2, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchOtherObject(Sint32 rank, POINT initCel, Sint32 action, + Sint32 distMax, Sint32 channel, + Sint32 firstIcon1, Sint32 lastIcon1, + Sint32 firstIcon2, Sint32 lastIcon2, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy; - int x, y, xx, yy; - int dist, min = distMax; + Sint32 startx, starty, endx, endy; + Sint32 x, y, xx, yy; + Sint32 dist, min = distMax; POINT cel; bool bOK; @@ -2594,12 +2594,12 @@ bool CDecor::SearchOtherObject(int rank, POINT initCel, int action, // Cherche un autre sol pouvant contenir du fer, pour y // planter un drapeau. -bool CDecor::SearchOtherDrapeau(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchOtherDrapeau(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy, icon; - int x, y; - int dist, min = distMax; + Sint32 startx, starty, endx, endy, icon; + Sint32 x, y; + Sint32 dist, min = distMax; POINT cel; startx = ((initCel.x-distMax/2)/2)*2; @@ -2647,12 +2647,12 @@ bool CDecor::SearchOtherDrapeau(int rank, POINT initCel, int distMax, // Cherche un autre sol permettant de déposer du bois // pour construire un bateau. -bool CDecor::SearchOtherBateau(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchOtherBateau(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy; - int x, y, direct; - int dist, min = distMax; + Sint32 startx, starty, endx, endy; + Sint32 x, y, direct; + Sint32 dist, min = distMax; startx = ((initCel.x-distMax/2)/2)*2; endx = ((initCel.x+distMax/2)/2)*2; @@ -2688,7 +2688,7 @@ bool CDecor::SearchOtherBateau(int rank, POINT initCel, int distMax, // Vérifie si l'objet peut être détruit par l'araignée. -bool CDecor::IsSpiderObject(int icon) +bool CDecor::IsSpiderObject(Sint32 icon) { return ( icon == 60 || // tomates ? icon == 92 || // poison ? @@ -2697,12 +2697,12 @@ bool CDecor::IsSpiderObject(int icon) // Cherche un autre objet pour l'araignée. -bool CDecor::SearchSpiderObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchSpiderObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy; - int x, y; - int dist, min = distMax; + Sint32 startx, starty, endx, endy; + Sint32 x, y; + Sint32 dist, min = distMax; POINT cel; startx = ((initCel.x-distMax/2)/2)*2; @@ -2749,7 +2749,7 @@ bool CDecor::SearchSpiderObject(int rank, POINT initCel, int distMax, // Vérifie si l'objet peut être détruit par le tracks. -bool CDecor::IsTracksObject(int icon) +bool CDecor::IsTracksObject(Sint32 icon) { return ( icon == 36 || // planches ? icon == 44 || // pierres ? @@ -2768,12 +2768,12 @@ bool CDecor::IsTracksObject(int icon) // Cherche un autre objet pour le tracks. -bool CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchTracksObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy, icon; - int x, y; - int dist, min = distMax; + Sint32 startx, starty, endx, endy, icon; + Sint32 x, y; + Sint32 dist, min = distMax; //? POINT cel; startx = ((initCel.x-distMax/2)/2)*2; @@ -2849,7 +2849,7 @@ bool CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, // Vérifie si l'objet peut être détruit par le robot. -bool CDecor::IsRobotObject(int icon) +bool CDecor::IsRobotObject(Sint32 icon) { return ( icon == 85 || // dynamite ? icon == 93 || // piège ? @@ -2860,16 +2860,16 @@ bool CDecor::IsRobotObject(int icon) // Cherche une autre action pour le robot. // C'est ici qu'est contenue l'IA du robot ! -bool CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon, - int &foundAction) +bool CDecor::SearchRobotObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon, + Sint32 &foundAction) { - int startx, starty, endx, endy; - int x, y; - int dist, maxUsine, min = distMax; - int nbUsine[10]; - int nbPerso[10]; - int i, r, d, dd, icon, index, nb; + Sint32 startx, starty, endx, endy; + Sint32 x, y; + Sint32 dist, maxUsine, min = distMax; + Sint32 nbUsine[10]; + Sint32 nbPerso[10]; + Sint32 i, r, d, dd, icon, index, nb; if ( m_term.bHachRobot ) // robot sur dalles hachurées ? { @@ -3136,10 +3136,10 @@ bool CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, // Teste si un emplacement est ok pour bâtir une usine. -bool CDecor::IsUsineBuild(int rank, POINT cel) +bool CDecor::IsUsineBuild(Sint32 rank, POINT cel) { - int icon, channel; - int x, y; + Sint32 icon, channel; + Sint32 x, y; // Pas sur les dalles hachurées ! GetFloor(cel, channel, icon); @@ -3165,9 +3165,9 @@ bool CDecor::IsUsineBuild(int rank, POINT cel) // L'usine doit être libre devant (lieu de stationnement // pour l'ennemi qui sera construit). -bool CDecor::IsUsineFree(int rank, POINT cel) +bool CDecor::IsUsineFree(Sint32 rank, POINT cel) { - int channel, icon; + Sint32 channel, icon; GetObject(cel, channel, icon); @@ -3190,7 +3190,7 @@ bool CDecor::IsUsineFree(int rank, POINT cel) // Vérifie si l'objet peut être détruit par une bombe. -bool CDecor::IsBombeObject(int icon) +bool CDecor::IsBombeObject(Sint32 icon) { return ( icon == 36 || // planches ? icon == 61 || // cabane ? @@ -3202,12 +3202,12 @@ bool CDecor::IsBombeObject(int icon) // Cherche un autre objet pour une bombe. -bool CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchBombeObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy; - int x, y; - int dist, min = distMax; + Sint32 startx, starty, endx, endy; + Sint32 x, y; + Sint32 dist, min = distMax; POINT cel; startx = ((initCel.x-distMax/2)/2)*2; @@ -3253,12 +3253,12 @@ bool CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, // Cherche un autre objet pour un électro. -bool CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, - POINT &foundCel, int &foundIcon) +bool CDecor::SearchElectroObject(Sint32 rank, POINT initCel, Sint32 distMax, + POINT &foundCel, Sint32 &foundIcon) { - int startx, starty, endx, endy; - int x, y, i, d, dd, r; - int dist, min = distMax; + Sint32 startx, starty, endx, endy; + Sint32 x, y, i, d, dd, r; + Sint32 dist, min = distMax; POINT cel; startx = ((initCel.x-10/2)/2)*2; @@ -3352,7 +3352,7 @@ bool CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, bool CDecor::IsFireCel(POINT cel) { - int x, y; + Sint32 x, y; POINT test; cel.x = (cel.x/2)*2; @@ -3380,7 +3380,7 @@ bool CDecor::IsFireCel(POINT cel) bool CDecor::IsVirusCel(POINT cel) { - int rank; + Sint32 rank; for ( rank=0 ; rank<MAXBLUPI ; rank++ ) { @@ -3402,11 +3402,11 @@ bool CDecor::IsVirusCel(POINT cel) // d'une cellule donnée (cel). // Retourne 0 si c'est possible, ou une erreur autrement ! -int CDecor::IsBuildPont(POINT &cel, int &iconBuild) +Sint32 CDecor::IsBuildPont(POINT &cel, Sint32 &iconBuild) { POINT vector, test; - int i, channel, icon, p1, p2, p3, r1, r2, nb, rest; - int error = ERROR_MISC; + Sint32 i, channel, icon, p1, p2, p3, r1, r2, nb, rest; + Sint32 error = ERROR_MISC; for ( i=0 ; i<4 ; i++ ) { @@ -3531,10 +3531,10 @@ int CDecor::IsBuildPont(POINT &cel, int &iconBuild) // Regarde s'il est possible de construire un bateau à partir // d'une cellule donnée (cel). -bool CDecor::IsBuildBateau(POINT cel, int &direct) +bool CDecor::IsBuildBateau(POINT cel, Sint32 &direct) { - int fChannel, fIcon; - int oChannel, oIcon; + Sint32 fChannel, fIcon; + Sint32 oChannel, oIcon; GetFloor (GetCel(cel,+2,0), fChannel, fIcon); GetObject(GetCel(cel,+2,0), oChannel, oIcon); @@ -3581,7 +3581,7 @@ bool CDecor::IsBuildBateau(POINT cel, int &direct) void CDecor::InitDrapeau() { - int i; + Sint32 i; for ( i=0 ; i<MAXLASTDRAPEAU ; i++ ) { @@ -3594,7 +3594,7 @@ void CDecor::InitDrapeau() void CDecor::AddDrapeau(POINT cel) { - int i; + Sint32 i; if ( TestDrapeau(cel) ) return; // déjà dans la liste @@ -3610,7 +3610,7 @@ void CDecor::AddDrapeau(POINT cel) void CDecor::SubDrapeau(POINT cel) { - int i; + Sint32 i; for ( i=0 ; i<MAXLASTDRAPEAU ; i++ ) { @@ -3627,7 +3627,7 @@ void CDecor::SubDrapeau(POINT cel) bool CDecor::TestDrapeau(POINT cel) { - int i; + Sint32 i; for ( i=0 ; i<MAXLASTDRAPEAU ; i++ ) { diff --git a/src/pixmap.cpp b/src/pixmap.cpp index 46bdaae..bd43e80 100644 --- a/src/pixmap.cpp +++ b/src/pixmap.cpp @@ -26,7 +26,7 @@ CPixmap::CPixmap() { - int i; + Sint32 i; m_bFullScreen = false; m_mouseType = MOUSETYPEGRA; @@ -51,7 +51,7 @@ CPixmap::CPixmap() CPixmap::~CPixmap() { - int i; + Sint32 i; for (i = 0; i < MAXIMAGE; i++) { @@ -76,7 +76,7 @@ CPixmap::~CPixmap() // Retourne false en cas d'erreur. bool CPixmap::Create(POINT dim, - bool bFullScreen, int mouseType) + bool bFullScreen, Sint32 mouseType) { m_bFullScreen = bFullScreen; m_mouseType = mouseType; @@ -107,9 +107,9 @@ void CPixmap::Fill(RECT rect, COLORREF color) // Effectue un appel BltFast. // Les modes sont 0=transparent, 1=opaque. -int CPixmap::BltFast(int chDst, int channel, POINT dst, RECT rcRect) +Sint32 CPixmap::BltFast(Sint32 chDst, Sint32 channel, POINT dst, RECT rcRect) { - int res, limit; + Sint32 res, limit; // Effectue un peu de clipping. if ( dst.x < m_clipRect.left ) @@ -172,9 +172,9 @@ int CPixmap::BltFast(int chDst, int channel, POINT dst, RECT rcRect) // Effectue un appel BltFast. // Les modes sont 0=transparent, 1=opaque. -int CPixmap::BltFast(SDL_Texture *lpSDL, int channel, POINT dst, RECT rcRect) +Sint32 CPixmap::BltFast(SDL_Texture *lpSDL, Sint32 channel, POINT dst, RECT rcRect) { - int res; + Sint32 res; SDL_Rect srcRect, dstRect; srcRect.x = rcRect.left; @@ -194,7 +194,7 @@ int CPixmap::BltFast(SDL_Texture *lpSDL, int channel, POINT dst, RECT rcRect) // Cache une image contenant des ic�nes. -bool CPixmap::Cache(int channel, const char *pFilename, POINT totalDim, POINT iconDim) +bool CPixmap::Cache(Sint32 channel, const char *pFilename, POINT totalDim, POINT iconDim) { if ( channel < 0 || channel >= MAXIMAGE ) return false; @@ -208,8 +208,8 @@ bool CPixmap::Cache(int channel, const char *pFilename, POINT totalDim, POINT ic m_lpSDLBlupi = surface; SDL_Texture *texture = SDL_CreateTextureFromSurface (g_renderer, surface); - unsigned int format; - int access, w, h; + Uint32 format; + Sint32 access, w, h; SDL_QueryTexture (texture, &format, &access, &w, &h); if (!m_lpSDLTexture[channel]) @@ -251,7 +251,7 @@ bool CPixmap::Cache(int channel, const char *pFilename, POINT totalDim, POINT ic // Cache une image globale. -bool CPixmap::Cache(int channel, const char *pFilename, POINT totalDim) +bool CPixmap::Cache(Sint32 channel, const char *pFilename, POINT totalDim) { POINT iconDim; @@ -265,7 +265,7 @@ bool CPixmap::Cache(int channel, const char *pFilename, POINT totalDim) // Cache une image provenant d'un bitmap. -bool CPixmap::Cache(int channel, SDL_Surface *surface, POINT totalDim) +bool CPixmap::Cache(Sint32 channel, SDL_Surface *surface, POINT totalDim) { if ( channel < 0 || channel >= MAXIMAGE ) return false; @@ -301,9 +301,9 @@ RECT CPixmap::GetClipping() // Teste si un point fait partie d'une ic�ne. -bool CPixmap::IsIconPixel(int channel, int rank, POINT pos) +bool CPixmap::IsIconPixel(Sint32 channel, Sint32 rank, POINT pos) { - int nbx, nby; + Sint32 nbx, nby; if ( channel < 0 || channel >= MAXIMAGE ) return false; if (m_lpSDLTexture[channel] == nullptr ) return false; @@ -337,9 +337,9 @@ bool CPixmap::IsIconPixel(int channel, int rank, POINT pos) // Dessine une partie d'image rectangulaire. // Les modes sont 0=transparent, 1=opaque. -bool CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, bool bMask) +bool CPixmap::DrawIcon(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask) { - int nbx, nby; + Sint32 nbx, nby; RECT rect; if ( channel < 0 || channel >= MAXIMAGE ) return false; @@ -371,9 +371,9 @@ bool CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, bool bMask) // 32,32 34,33 // 33,48 35,49 -bool CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, bool bMask) +bool CPixmap::DrawIconDemi(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask) { - int nbx, nby; + Sint32 nbx, nby; RECT rect; if ( channel < 0 || channel >= MAXIMAGE ) return false; @@ -399,10 +399,10 @@ bool CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, bool bMa // Dessine une partie d'image rectangulaire. -bool CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, - int startY, int endY, bool bMask) +bool CPixmap::DrawIconPart(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, + Sint32 startY, Sint32 endY, bool bMask) { - int nbx, nby; + Sint32 nbx, nby; RECT rect; if ( channel < 0 || channel >= MAXIMAGE ) return false; @@ -429,7 +429,7 @@ bool CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, // Dessine une partie d'image n'importe o�. -bool CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, bool bMask) +bool CPixmap::DrawPart(Sint32 chDst, Sint32 channel, POINT dest, RECT rect, bool bMask) { if ( channel < 0 || channel >= MAXIMAGE ) return false; if (m_lpSDLTexture[channel] == nullptr ) return false; @@ -439,10 +439,10 @@ bool CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, bool bMask // Dessine une partie d'image rectangulaire. -bool CPixmap::DrawImage(int chDst, int channel, RECT rect) +bool CPixmap::DrawImage(Sint32 chDst, Sint32 channel, RECT rect) { POINT dst; - int res; + Sint32 res; if ( channel < 0 || channel >= MAXIMAGE ) return false; if (m_lpSDLTexture[channel] == nullptr ) return false; @@ -466,13 +466,13 @@ bool CPixmap::DrawImage(int chDst, int channel, RECT rect) // Construit une ic�ne en utilisant un masque. -bool CPixmap::BuildIconMask(int channelMask, int rankMask, - int channel, int rankSrc, int rankDst) +bool CPixmap::BuildIconMask(Sint32 channelMask, Sint32 rankMask, + Sint32 channel, Sint32 rankSrc, Sint32 rankDst) { - int nbx, nby; + Sint32 nbx, nby; POINT posDst; RECT rect; - int res; + Sint32 res; if ( channel < 0 || channel >= MAXIMAGE ) return false; if (m_lpSDLTexture[channel] == nullptr ) return false; @@ -526,7 +526,7 @@ bool CPixmap::Display() // Change le lutin de la souris. -void CPixmap::SetMouseSprite(int sprite, bool bDemoPlay) +void CPixmap::SetMouseSprite(Sint32 sprite, bool bDemoPlay) { if ( m_mouseSprite == sprite ) return; @@ -547,7 +547,7 @@ void CPixmap::MouseShow(bool bShow) RECT CPixmap::MouseRectSprite() { - int rank, nbx; + Sint32 rank, nbx; RECT rcRect; rank = 348; @@ -575,9 +575,9 @@ RECT CPixmap::MouseRectSprite() return rcRect; } -SDL_Point CPixmap::GetCursorHotSpot (int sprite) +SDL_Point CPixmap::GetCursorHotSpot (Sint32 sprite) { - static const int hotspots[MAXCURSORS * 2] = + static const Sint32 hotspots[MAXCURSORS * 2] = { 30, 30, // SPRITE_ARROW 20, 15, // SPRITE_POINTER @@ -599,7 +599,7 @@ SDL_Point CPixmap::GetCursorHotSpot (int sprite) if (sprite >= SPRITE_BEGIN && sprite <= SPRITE_END) { - const int rank = sprite - SPRITE_BEGIN; // rank <- 0..n + const Sint32 rank = sprite - SPRITE_BEGIN; // rank <- 0..n hotspot.x = hotspots[rank * 2 + 0]; hotspot.y = hotspots[rank * 2 + 1]; @@ -608,9 +608,9 @@ SDL_Point CPixmap::GetCursorHotSpot (int sprite) return hotspot; } -SDL_Rect CPixmap::GetCursorRect (int sprite) +SDL_Rect CPixmap::GetCursorRect (Sint32 sprite) { - int rank; + Sint32 rank; SDL_Rect rcRect; switch (sprite) @@ -657,7 +657,7 @@ SDL_Rect CPixmap::GetCursorRect (int sprite) break; } - int nbx = m_totalDim[CHBLUPI].x / m_iconDim[CHBLUPI].x; + Sint32 nbx = m_totalDim[CHBLUPI].x / m_iconDim[CHBLUPI].x; rcRect.x = (rank % nbx) * m_iconDim[CHBLUPI].x; rcRect.y = (rank / nbx) * m_iconDim[CHBLUPI].y; @@ -685,7 +685,7 @@ void CPixmap::LoadCursors () amask = 0xff000000; #endif - for (int sprite = SPRITE_BEGIN; sprite <= SPRITE_END; ++sprite) + for (Sint32 sprite = SPRITE_BEGIN; sprite <= SPRITE_END; ++sprite) { SDL_Point hotspot = this->GetCursorHotSpot (sprite); SDL_Rect rect = this->GetCursorRect (sprite); diff --git a/src/pixmap.h b/src/pixmap.h index 6b4e3d3..25a2e09 100644 --- a/src/pixmap.h +++ b/src/pixmap.h @@ -15,51 +15,51 @@ public: CPixmap(); ~CPixmap(); - bool Create(POINT dim, bool bFullScreen, int mouseType); + bool Create(POINT dim, bool bFullScreen, Sint32 mouseType); bool Flush(); void Fill(RECT rect, COLORREF color); - bool Cache(int channel, const char *pFilename, POINT totalDim, POINT iconDim); - bool Cache(int channel, const char *pFilename, POINT totalDim); - bool Cache(int channel, SDL_Surface *surface, POINT totalDim); + bool Cache(Sint32 channel, const char *pFilename, POINT totalDim, POINT iconDim); + bool Cache(Sint32 channel, const char *pFilename, POINT totalDim); + bool Cache(Sint32 channel, SDL_Surface *surface, POINT totalDim); void SetClipping(RECT clip); RECT GetClipping(); - bool IsIconPixel(int channel, int rank, POINT pos); + bool IsIconPixel(Sint32 channel, Sint32 rank, POINT pos); - bool DrawIcon(int chDst, int channel, int rank, POINT pos, bool bMask=false); - bool DrawIconDemi(int chDst, int channel, int rank, POINT pos, bool bMask=false); - bool DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, bool bMask=false); - bool DrawPart(int chDst, int channel, POINT dest, RECT rect, bool bMask=false); - bool DrawImage(int chDst, int channel, RECT rect); + bool DrawIcon(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask=false); + bool DrawIconDemi(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask=false); + bool DrawIconPart(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, Sint32 startY, Sint32 endY, bool bMask=false); + bool DrawPart(Sint32 chDst, Sint32 channel, POINT dest, RECT rect, bool bMask=false); + bool DrawImage(Sint32 chDst, Sint32 channel, RECT rect); - bool BuildIconMask(int channelMask, int rankMask, - int channel, int rankSrc, int rankDst); + bool BuildIconMask(Sint32 channelMask, Sint32 rankMask, + Sint32 channel, Sint32 rankSrc, Sint32 rankDst); bool Display(); - void SetMouseSprite(int sprite, bool bDemoPlay); + void SetMouseSprite(Sint32 sprite, bool bDemoPlay); void MouseShow(bool bShow); void LoadCursors (); void ChangeSprite (MouseSprites sprite); protected: - int BltFast(int chDst, int channel, POINT dst, RECT rcRect); - int BltFast(SDL_Texture *lpSDL, int channel, POINT dst, RECT rcRect); + Sint32 BltFast(Sint32 chDst, Sint32 channel, POINT dst, RECT rcRect); + Sint32 BltFast(SDL_Texture *lpSDL, Sint32 channel, POINT dst, RECT rcRect); RECT MouseRectSprite(); - SDL_Point GetCursorHotSpot (int sprite); - SDL_Rect GetCursorRect (int sprite); + SDL_Point GetCursorHotSpot (Sint32 sprite); + SDL_Rect GetCursorRect (Sint32 sprite); protected: bool m_bFullScreen; - int m_mouseType; + Sint32 m_mouseType; bool m_bDebug; bool m_bPalette; POINT m_dim; // dimensions totales RECT m_clipRect; // rectangle de clipping - int m_mouseSprite; + Sint32 m_mouseSprite; bool m_bBackDisplayed; SDL_Cursor * m_lpCurrentCursor; diff --git a/src/sound.cpp b/src/sound.cpp index 84c14bc..d66be26 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -13,7 +13,7 @@ bool CSound::StopAllSounds() { - for (int i = 0; i < MAXSOUND; i ++) + for (Sint32 i = 0; i < MAXSOUND; i ++) { if (!m_lpSDL[i]) continue; @@ -27,7 +27,7 @@ bool CSound::StopAllSounds() CSound::CSound() { - int i; + Sint32 i; m_bEnable = false; m_bState = false; @@ -51,7 +51,7 @@ CSound::CSound() CSound::~CSound() { - int i; + Sint32 i; for ( i=0 ; i<MAXSOUND ; i++ ) { @@ -102,23 +102,23 @@ void CSound::SetState(bool bState) // Gestion des volumes audio (.wav) et midi (.mid). -void CSound::SetAudioVolume(int volume) +void CSound::SetAudioVolume(Sint32 volume) { m_audioVolume = volume; } -int CSound::GetAudioVolume() +Sint32 CSound::GetAudioVolume() { if ( !m_bEnable ) return 0; return m_audioVolume; } -void CSound::SetMidiVolume(int volume) +void CSound::SetMidiVolume(Sint32 volume) { m_midiVolume = volume; } -int CSound::GetMidiVolume() +Sint32 CSound::GetMidiVolume() { if ( !m_bEnable ) return 0; return m_midiVolume; @@ -129,7 +129,7 @@ int CSound::GetMidiVolume() void CSound::CacheAll() { - int i; + Sint32 i; char name[50]; if ( !m_bEnable ) return; @@ -143,7 +143,7 @@ void CSound::CacheAll() // Charge un fichier son (.wav). -bool CSound::Cache(int channel, const char *pFilename) +bool CSound::Cache(Sint32 channel, const char *pFilename) { if ( !m_bEnable ) return false; if ( channel < 0 || channel >= MAXSOUND ) return false; @@ -165,7 +165,7 @@ bool CSound::Cache(int channel, const char *pFilename) // D�charge un son. -void CSound::Flush(int channel) +void CSound::Flush(Sint32 channel) { if ( !m_bEnable ) return; if ( channel < 0 || channel >= MAXSOUND ) return; @@ -182,7 +182,7 @@ void CSound::Flush(int channel) // Le panoramique est compris entre 255,0 (gauche), 127,128 (centre) // et 0,255 (droite). -bool CSound::Play(int channel, int volume, Uint8 panLeft, Uint8 panRight) +bool CSound::Play(Sint32 channel, Sint32 volume, Uint8 panLeft, Uint8 panRight) { if (!m_bEnable) return true; @@ -208,9 +208,9 @@ bool CSound::Play(int channel, int volume, Uint8 panLeft, Uint8 panRight) // Si rank != -1, il indique le rang du blupi dont il faudra // �ventuellement stopper le dernier son en cours ! -bool CSound::PlayImage(int channel, POINT pos, int rank) +bool CSound::PlayImage(Sint32 channel, POINT pos, Sint32 rank) { - int stopCh, volumex, volumey, volume; + Sint32 stopCh, volumex, volumey, volume; if ( rank >= 0 && rank < MAXBLUPI ) { @@ -360,7 +360,7 @@ void CSound::AdaptVolumeMusic() // Indique le nombre de suspend � sauter. -void CSound::SetSuspendSkip(int nb) +void CSound::SetSuspendSkip(Sint32 nb) { m_nbSuspendSkip = nb; } diff --git a/src/sound.h b/src/sound.h index 49ad56a..d06cf56 100644 --- a/src/sound.h +++ b/src/sound.h @@ -23,17 +23,17 @@ public: void SetState(bool bState); bool GetEnable(); - void SetAudioVolume(int volume); - int GetAudioVolume(); - void SetMidiVolume(int volume); - int GetMidiVolume(); + void SetAudioVolume(Sint32 volume); + Sint32 GetAudioVolume(); + void SetMidiVolume(Sint32 volume); + Sint32 GetMidiVolume(); void CacheAll(); - bool Cache(int channel, const char *pFilename); - void Flush(int channel); + bool Cache(Sint32 channel, const char *pFilename); + void Flush(Sint32 channel); - bool Play(int channel, int volume=0, Uint8 panLeft = 255, Uint8 panRight = 255); - bool PlayImage(int channel, POINT pos, int rank=-1); + bool Play(Sint32 channel, Sint32 volume=0, Uint8 panLeft = 255, Uint8 panRight = 255); + bool PlayImage(Sint32 channel, POINT pos, Sint32 rank=-1); bool PlayMusic(const char *lpszMIDIFilename); bool RestartMusic(); void SuspendMusic(); @@ -41,7 +41,7 @@ public: bool IsPlayingMusic(); bool IsStoppedOnDemand (); void AdaptVolumeMusic(); - void SetSuspendSkip(int nb); + void SetSuspendSkip(Sint32 nb); bool StopAllSounds(); protected: @@ -50,12 +50,12 @@ protected: bool m_bStopped; Mix_Music *m_pMusic; Mix_Chunk *m_lpSDL[MAXSOUND]; - short m_channelBlupi[MAXBLUPI]; + Sint16 m_channelBlupi[MAXBLUPI]; char m_MIDIFilename[50]; - int m_audioVolume; - int m_midiVolume; - int m_lastMidiVolume; - int m_nbSuspendSkip; + Sint32 m_audioVolume; + Sint32 m_midiVolume; + Sint32 m_lastMidiVolume; + Sint32 m_nbSuspendSkip; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/text.cpp b/src/text.cpp index a031083..3e38d58 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -12,9 +12,9 @@ // Retourne l'offset pour un caractère donné. -int GetOffset(char c) +Sint32 GetOffset(char c) { - int i; + Sint32 i; static unsigned char table_accents[15] = { @@ -36,7 +36,7 @@ int GetOffset(char c) // Retourne la longueur d'un caractère. -int GetCharWidth(char c, int font) +Sint32 GetCharWidth(char c, Sint32 font) { static unsigned char table_width[128] = { @@ -74,9 +74,9 @@ int GetCharWidth(char c, int font) // Affiche un texte. -void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, int font) +void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font) { - int rank; + Sint32 rank; if ( font == FONTLITTLE ) { @@ -104,9 +104,9 @@ void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, int font) // Affiche un texte penché. void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font) + Sint32 pente, Sint32 font) { - int rank, lg, rel, start; + Sint32 rank, lg, rel, start; start = pos.y; rel = 0; @@ -129,11 +129,11 @@ void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, // par "n|", avec n=part. void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font, int part) + Sint32 pente, Sint32 font, Sint32 part) { char text[100]; char* pDest; - int itl; + Sint32 itl; if ( font == FONTLITTLE ) itl = DIMLITTLEY; else itl = DIMTEXTY; @@ -183,11 +183,11 @@ void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, // Affiche un texte centré pouvant éventuellement // contenir plusieurs lignes séparées par des '\n'. -void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, int font) +void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font) { char text[100]; char* pDest; - int itl; + Sint32 itl; POINT start; if ( font == FONTLITTLE ) itl = DIMLITTLEY; @@ -222,12 +222,12 @@ void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, int font) // Retourne la hauteur d'un texte. -int GetTextHeight(char *pText, int font, int part) +Sint32 GetTextHeight(char *pText, Sint32 font, Sint32 part) { char text[100]; char* pDest; - int itl; - int h=0; + Sint32 itl; + Sint32 h=0; if ( font == FONTLITTLE ) itl = DIMLITTLEY; else itl = DIMTEXTY; @@ -269,9 +269,9 @@ int GetTextHeight(char *pText, int font, int part) // Retourne la longueur d'un texte. -int GetTextWidth(const char *pText, int font) +Sint32 GetTextWidth(const char *pText, Sint32 font) { - int width = 0; + Sint32 width = 0; while ( *pText != 0 ) { @@ -284,9 +284,9 @@ int GetTextWidth(const char *pText, int font) // Retourne la longueur d'un grand chiffre. -void GetBignumInfo(int num, int &start, int &lg) +void GetBignumInfo(Sint32 num, Sint32 &start, Sint32 &lg) { - static int table[11] = + static Sint32 table[11] = { 0,53,87,133,164,217,253,297,340,382,426 }; @@ -297,11 +297,11 @@ void GetBignumInfo(int num, int &start, int &lg) // Affiche un grand nombre. -void DrawBignum(CPixmap *pPixmap, POINT pos, int num) +void DrawBignum(CPixmap *pPixmap, POINT pos, Sint32 num) { char string[10]; - int i = 0; - int start, lg; + Sint32 i = 0; + Sint32 start, lg; RECT rect; sprintf(string, "%d", num); @@ -323,12 +323,12 @@ void DrawBignum(CPixmap *pPixmap, POINT pos, int num) // Retourne la longueur d'un grand nombre. -int GetBignumWidth(int num) +Sint32 GetBignumWidth(Sint32 num) { char string[10]; - int i = 0; - int start, lg; - int width = -4; + Sint32 i = 0; + Sint32 start, lg; + Sint32 width = -4; sprintf(string, "%d", num); @@ -8,28 +8,28 @@ #define FONTLITTLE 10 extern -void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, int font=0); +void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font=0); extern void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font=0); + Sint32 pente, Sint32 font=0); extern void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font=0, int part=-1); + Sint32 pente, Sint32 font=0, Sint32 part=-1); extern -void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, int font=0); +void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font=0); extern -int GetTextHeight(char *pText, int font=0, int part=-1); +Sint32 GetTextHeight(char *pText, Sint32 font=0, Sint32 part=-1); extern -int GetTextWidth(const char *pText, int font=0); +Sint32 GetTextWidth(const char *pText, Sint32 font=0); extern -void DrawBignum(CPixmap *pPixmap, POINT pos, int num); +void DrawBignum(CPixmap *pPixmap, POINT pos, Sint32 num); extern -int GetBignumWidth(int num); +Sint32 GetBignumWidth(Sint32 num); |