mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Cosmetics: fix style, remove deadcode, const
This commit is contained in:
parent
01c8b5a042
commit
ebec94b32b
@ -1,30 +1,25 @@
|
||||
// Action.cpp
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "def.h"
|
||||
#include "action.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
|
||||
#define MAXICON (1 + 50)
|
||||
#define MAXMOVE (2 + 30 * 3)
|
||||
#define MAXSOUND (1 + 50)
|
||||
|
||||
typedef struct
|
||||
struct DescAction
|
||||
{
|
||||
Sint16 action;
|
||||
Sint16 channel;
|
||||
Sint16 icons[8][MAXICON]; // nb, icones,
|
||||
Sint16 moves[8][MAXMOVE]; // nb, nb, x,y,
|
||||
Sint16 sounds[MAXSOUND]; // nb, sons,
|
||||
}
|
||||
DescAction;
|
||||
};
|
||||
|
||||
|
||||
static DescAction action_table[] =
|
||||
static const DescAction action_table[] =
|
||||
{
|
||||
{
|
||||
ACTION_STOP,
|
||||
@ -2712,7 +2707,6 @@ static DescAction action_table[] =
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Calcule l'action suivante.
|
||||
// Retourne false lorsque l'action est terminée.
|
||||
|
||||
@ -2721,7 +2715,7 @@ bool Action (Sint16 action, Sint16 direct,
|
||||
Sint16 &channel, Sint16 &icon, POINT &pos, Sint16 &posZ,
|
||||
Sint16 &sound)
|
||||
{
|
||||
DescAction *pTable = action_table;
|
||||
const auto *pTable = action_table;
|
||||
Sint16 nbIcon, nbPhase, nbMove, nbSound, i;
|
||||
|
||||
pos.x = 0;
|
||||
@ -2773,9 +2767,7 @@ bool Action (Sint16 action, Sint16 direct,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Sint16 rotate_table[] =
|
||||
static const Sint16 rotate_table[] =
|
||||
{
|
||||
0, 6, 12, 18, 24, 30, 36, 42,
|
||||
1, 7, 13, 19, 25, 31, 37, 43,
|
||||
@ -2804,7 +2796,7 @@ static Sint16 rotate_table[] =
|
||||
|
||||
bool Rotate (Sint16 &icon, Sint16 direct)
|
||||
{
|
||||
Sint16 *pTable = rotate_table;
|
||||
const auto *pTable = rotate_table;
|
||||
Sint16 i;
|
||||
Sint16 offset = 0;
|
||||
|
||||
@ -2865,7 +2857,7 @@ bool Rotate (Sint16 &icon, Sint16 direct)
|
||||
|
||||
Sint32 GetIconDirect (Sint16 icon)
|
||||
{
|
||||
Sint16 *pTable = rotate_table;
|
||||
const auto *pTable = rotate_table;
|
||||
Sint16 i;
|
||||
|
||||
if (icon >= 169 && icon <= 192) // blupi malade ?
|
||||
@ -2883,10 +2875,8 @@ Sint32 GetIconDirect (Sint16 icon)
|
||||
while (pTable[0] != -1)
|
||||
{
|
||||
for (i = 0 ; i < 8 ; i++)
|
||||
{
|
||||
if (icon == pTable[i])
|
||||
return i * 16;
|
||||
}
|
||||
|
||||
pTable += 8;
|
||||
}
|
||||
@ -2894,20 +2884,22 @@ Sint32 GetIconDirect (Sint16 icon)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Retourne l'amplitude d'une action, en nombre
|
||||
// de cellules.
|
||||
|
||||
Sint32 GetAmplitude (Sint16 action)
|
||||
{
|
||||
if (action == ACTION_SAUTE2)
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_SAUTE2:
|
||||
return 2;
|
||||
if (action == ACTION_SAUTE3)
|
||||
case ACTION_SAUTE3:
|
||||
return 3;
|
||||
if (action == ACTION_SAUTE4)
|
||||
case ACTION_SAUTE4:
|
||||
return 4;
|
||||
if (action == ACTION_SAUTE5)
|
||||
case ACTION_SAUTE5:
|
||||
return 5;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
// Action.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -10,13 +8,6 @@ bool Action (Sint16 action, Sint16 direct,
|
||||
Sint16 &phase, Sint16 &step,
|
||||
Sint16 &channel, Sint16 &icon, POINT &pos, Sint16 &posZ,
|
||||
Sint16 &sound);
|
||||
|
||||
extern
|
||||
bool Rotate (Sint16 &icon, Sint16 direct);
|
||||
|
||||
extern
|
||||
Sint32 GetIconDirect (Sint16 icon);
|
||||
|
||||
extern
|
||||
Sint32 GetAmplitude (Sint16 action);
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
// Arrange.cpp
|
||||
//
|
||||
|
||||
#include "decor.h"
|
||||
#include "misc.h"
|
||||
@ -8,7 +6,7 @@
|
||||
// l'eau lorsque la valeur est à un.
|
||||
// 0 1
|
||||
// 2 3
|
||||
static char tableSee[14 * 4] =
|
||||
static const char tableSee[14 * 4] =
|
||||
{
|
||||
0, 0, 0, 0, // 1
|
||||
0, 1, 0, 1, // 2
|
||||
@ -30,7 +28,7 @@ static char tableSee[14 * 4] =
|
||||
// la mousse ou de la terre lorsque la valeur est à un.
|
||||
// 0 1
|
||||
// 2 3
|
||||
static char tableDark[13 * 4] =
|
||||
static const char tableDark[13 * 4] =
|
||||
{
|
||||
1, 1, 1, 1, // 20
|
||||
0, 1, 0, 1, // 21
|
||||
@ -121,13 +119,13 @@ bool CDecor::GetSeeBits (POINT cel, char *pBits, Sint32 index)
|
||||
return true;
|
||||
}
|
||||
|
||||
void CopyBits (char *pDst, char *pSrc)
|
||||
static void CopyBits (char *pDst, char *pSrc)
|
||||
{
|
||||
for (Sint32 i = 0 ; i < 4 ; i++)
|
||||
*pDst++ = *pSrc++;
|
||||
}
|
||||
|
||||
bool ChangeBits (char *pDst, char *pSrc)
|
||||
static bool ChangeBits (char *pDst, char *pSrc)
|
||||
{
|
||||
for (Sint32 i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
@ -371,11 +369,9 @@ void CDecor::ArrangeFloor (POINT cel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cette table donne les directions dans l'ordre
|
||||
// est-sud-ouest-nord pour les murs.
|
||||
static char tableMur[5 * 15] =
|
||||
static const char tableMur[5 * 15] =
|
||||
{
|
||||
20, 1, 0, 1, 0,
|
||||
21, 0, 1, 0, 1,
|
||||
@ -396,7 +392,7 @@ static char tableMur[5 * 15] =
|
||||
21, 0, 0, 0, 1,
|
||||
};
|
||||
|
||||
static Sint16 tableMurDir[4 * 2] =
|
||||
static const Sint16 tableMurDir[4 * 2] =
|
||||
{
|
||||
+2, 0, // est
|
||||
0, +2, // sur
|
||||
@ -685,8 +681,6 @@ void CDecor::ArrangeObject (POINT cel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test s'il faut remplir le sol ici.
|
||||
|
||||
bool CDecor::ArrangeFillTestFloor (POINT cel1, POINT cel2)
|
||||
@ -907,7 +901,6 @@ void CDecor::ArrangeFill (POINT pos, Sint32 channel, Sint32 icon, bool bFloor)
|
||||
free (m_pFillMap);
|
||||
}
|
||||
|
||||
|
||||
// Supprime tous les personnages bloqués dans des murs
|
||||
// ou debout sur l'eau.
|
||||
|
||||
@ -924,4 +917,3 @@ void CDecor::ArrangeBlupi()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
// blupi.cpp
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "blupi.h"
|
||||
#include "def.h"
|
||||
#include "resource.h"
|
||||
@ -17,36 +16,33 @@
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
// D�finitions globales
|
||||
// Global definitions
|
||||
|
||||
#define NAME "Blupi"
|
||||
#define TITLE "Blupi"
|
||||
|
||||
|
||||
// Variables globales
|
||||
// Global variables
|
||||
|
||||
SDL_Window *g_window;
|
||||
SDL_Renderer *g_renderer;
|
||||
|
||||
CEvent *g_pEvent = nullptr;
|
||||
CPixmap *g_pPixmap = nullptr; // pixmap principal
|
||||
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
|
||||
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
|
||||
|
||||
Uint32 g_lastPhase = 999;
|
||||
|
||||
|
||||
|
||||
|
||||
// Lit un num�ro d�cimal.
|
||||
|
||||
Sint32 GetNum (char *p)
|
||||
static Sint32 GetNum (char *p)
|
||||
{
|
||||
Sint32 n = 0;
|
||||
|
||||
@ -61,7 +57,7 @@ Sint32 GetNum (char *p)
|
||||
|
||||
// Lit le fichier de configuration.
|
||||
|
||||
bool ReadConfig (Sint32 argc, char *argv[])
|
||||
static bool ReadConfig ()
|
||||
{
|
||||
FILE *file = nullptr;
|
||||
char buffer[200];
|
||||
@ -118,10 +114,9 @@ bool ReadConfig (Sint32 argc, char *argv[])
|
||||
return true;
|
||||
}
|
||||
|
||||
// Main frame update
|
||||
|
||||
// Mise � jour principale.
|
||||
|
||||
void UpdateFrame (void)
|
||||
static void UpdateFrame (void)
|
||||
{
|
||||
RECT clip, rcRect;
|
||||
Uint32 phase;
|
||||
@ -218,27 +213,9 @@ void UpdateFrame (void)
|
||||
}
|
||||
}
|
||||
|
||||
// Restore the game after a fullscreen enabling
|
||||
|
||||
void Benchmark()
|
||||
{
|
||||
Sint32 i;
|
||||
POINT pos = { 0, 0 };
|
||||
|
||||
g_pPixmap->DrawIcon (-1, 2, 10, pos, 0);
|
||||
|
||||
pos.x = 300;
|
||||
pos.y = 350;
|
||||
for (i = 0 ; i < 10000 ; i++)
|
||||
g_pPixmap->DrawIcon (-1, 2, i % 4, pos, 0);
|
||||
|
||||
g_pPixmap->DrawIcon (-1, 2, 10, pos, 0);
|
||||
g_pSound->Play (0);
|
||||
}
|
||||
|
||||
|
||||
// Restitue le jeu apr�s une activation en mode fullScreen.
|
||||
|
||||
bool RestoreGame()
|
||||
static bool RestoreGame ()
|
||||
{
|
||||
if (g_pPixmap == nullptr)
|
||||
return false;
|
||||
@ -247,9 +224,9 @@ bool RestoreGame()
|
||||
return true;
|
||||
}
|
||||
|
||||
// Lib�re le jeu avant une d�sactivation en mode fullScreen.
|
||||
// Flush the game before a fullscreen disabling
|
||||
|
||||
bool FlushGame()
|
||||
static bool FlushGame ()
|
||||
{
|
||||
if (g_pPixmap == nullptr)
|
||||
return false;
|
||||
@ -257,7 +234,6 @@ bool FlushGame()
|
||||
return g_pPixmap->Flush ();
|
||||
}
|
||||
|
||||
|
||||
// Finished with all objects we use; release them.
|
||||
|
||||
static void FinishObjects (void)
|
||||
@ -295,7 +271,7 @@ static void FinishObjects (void)
|
||||
}
|
||||
}
|
||||
|
||||
void WindowProc2 (const SDL_Event &event)
|
||||
static void WindowProc2 (const SDL_Event &event)
|
||||
{
|
||||
POINT totalDim, iconDim;
|
||||
|
||||
@ -419,7 +395,7 @@ static bool DoInit (Sint32 argc, char *argv[])
|
||||
RECT rcRect;
|
||||
bool bOK;
|
||||
|
||||
bOK = ReadConfig (argc, argv); // lit le fichier config.ini
|
||||
bOK = ReadConfig (); // lit le fichier config.ini
|
||||
|
||||
auto res = SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER);
|
||||
if (res < 0)
|
||||
@ -435,7 +411,7 @@ static bool DoInit (Sint32 argc, char *argv[])
|
||||
|
||||
if (!g_window)
|
||||
{
|
||||
printf (SDL_GetError());
|
||||
printf ("%s", SDL_GetError ());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -444,7 +420,7 @@ static bool DoInit (Sint32 argc, char *argv[])
|
||||
SDL_RENDERER_PRESENTVSYNC);
|
||||
if (!g_renderer)
|
||||
{
|
||||
printf (SDL_GetError());
|
||||
printf ("%s", SDL_GetError ());
|
||||
SDL_DestroyWindow (g_window);
|
||||
return false;
|
||||
}
|
||||
@ -617,10 +593,9 @@ static bool DoInit (Sint32 argc, char *argv[])
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Programme principal.
|
||||
|
||||
Sint32 main (Sint32 argc, char *argv[])
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
if (!DoInit (argc, argv))
|
||||
return -1;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
@ -1,8 +1,7 @@
|
||||
// Button.cpp
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#include "def.h"
|
||||
#include "pixmap.h"
|
||||
@ -13,10 +12,6 @@
|
||||
#include "event.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Constructeur.
|
||||
|
||||
CButton::CButton()
|
||||
{
|
||||
m_type = 0;
|
||||
@ -33,12 +28,7 @@ CButton::CButton()
|
||||
m_message = static_cast<Uint32> (-1);
|
||||
}
|
||||
|
||||
// Destructeur.
|
||||
|
||||
CButton::~CButton()
|
||||
{
|
||||
}
|
||||
|
||||
CButton::~CButton () {}
|
||||
|
||||
// Crée un nouveau bouton.
|
||||
|
||||
@ -229,7 +219,6 @@ void CButton::SetEnable (bool bEnable)
|
||||
m_bEnable = bEnable;
|
||||
}
|
||||
|
||||
|
||||
bool CButton::GetHide ()
|
||||
{
|
||||
return m_bHide;
|
||||
@ -243,7 +232,6 @@ void CButton::SetHide (bool bHide)
|
||||
m_bHide = bHide;
|
||||
}
|
||||
|
||||
|
||||
// Traitement d'un événement.
|
||||
|
||||
bool CButton::TreatEvent (const SDL_Event &event)
|
||||
@ -292,7 +280,6 @@ bool CButton::TreatEvent (const SDL_Event &event)
|
||||
|
||||
// (*) Tous les boutons doivent recevoir l'événement BUTTONUP !
|
||||
|
||||
|
||||
// Indique si la souris est sur ce bouton.
|
||||
|
||||
bool CButton::MouseOnButton (POINT pos)
|
||||
@ -300,7 +287,6 @@ bool CButton::MouseOnButton (POINT pos)
|
||||
return Detect (pos);
|
||||
}
|
||||
|
||||
|
||||
// Retourne le tooltips pour un bouton, en fonction
|
||||
// de la position de la souris.
|
||||
|
||||
@ -338,7 +324,6 @@ const char *CButton::GetToolTips (POINT pos)
|
||||
return gettext (m_toolTips[rank]);
|
||||
}
|
||||
|
||||
|
||||
// Détecte si la souris est dans le bouton.
|
||||
|
||||
bool CButton::Detect (POINT pos)
|
||||
@ -442,5 +427,3 @@ bool CButton::MouseUp (POINT pos)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
16
src/button.h
16
src/button.h
@ -1,11 +1,8 @@
|
||||
// Button.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CButton
|
||||
{
|
||||
public:
|
||||
@ -34,6 +31,7 @@ public:
|
||||
|
||||
bool TreatEvent (const SDL_Event &event);
|
||||
bool MouseOnButton (POINT pos);
|
||||
|
||||
const char *GetToolTips (POINT pos);
|
||||
|
||||
|
||||
@ -47,6 +45,7 @@ protected:
|
||||
CPixmap *m_pPixmap;
|
||||
CDecor *m_pDecor;
|
||||
CSound *m_pSound;
|
||||
|
||||
Sint32 m_type; // type de bouton
|
||||
bool m_bEnable; // true si bouton actif
|
||||
bool m_bHide; // true si bouton caché
|
||||
@ -56,13 +55,14 @@ protected:
|
||||
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
|
||||
|
||||
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é
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
bool m_bMouseDown; // true -> bouton souris pressé
|
||||
bool m_bRedraw; // true -> doit être redessiné
|
||||
bool m_bMinimizeRedraw;
|
||||
};
|
||||
|
@ -1,4 +1,3 @@
|
||||
// chemin.cpp
|
||||
|
||||
// (c) 1997, Denis Dumoulin
|
||||
|
||||
@ -56,7 +55,6 @@ bool CDecor::CheminTestPos (POINT pos, Sint32 &rank)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// une fois le but trouvé, reprend en arrière
|
||||
// à la recherche du chemin le plus court
|
||||
|
||||
@ -100,7 +98,6 @@ bis:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// troisième méthode de recherche
|
||||
// semblable à la précédente,
|
||||
// mais les points à explorer sont classés selon leur distance à la cible
|
||||
@ -179,7 +176,6 @@ void CDecor::CheminFillTerrain (Sint32 rank)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// routine déterninant si une direction est possible
|
||||
// retourne l'incrément pour passer à la nouvelle case
|
||||
// et le "prix à payer" pour aller dans cette direction
|
||||
@ -269,9 +265,8 @@ bool CDecor::CheminTestDirection (Sint32 rank, Sint32 pos, Sint32 dir,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Retourne true si on a assigné une nouvelle direction à blupi.
|
||||
|
||||
bool CDecor::CheminCherche (Sint32 rank, Sint32 &action)
|
||||
{
|
||||
Sint32 cout; // prix pour aller dans une direction
|
||||
@ -310,7 +305,6 @@ bool CDecor::CheminCherche (Sint32 rank, Sint32 &action)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Teste s'il est possible de se rendre à un endroit donné.
|
||||
|
||||
bool CDecor::IsCheminFree (Sint32 rank, POINT dest, Sint32 button)
|
||||
@ -365,4 +359,3 @@ bool CDecor::IsCheminFree (Sint32 rank, POINT dest, Sint32 button)
|
||||
|
||||
return bOK;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// DecBlupi.cpp
|
||||
//
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "gettext.h"
|
||||
#include "def.h"
|
||||
#include "decor.h"
|
||||
@ -12,7 +11,7 @@
|
||||
|
||||
// Cette table donne l'action à effectuer pour un bouton
|
||||
// enfoncé.
|
||||
Sint16 table_actions[] =
|
||||
const Sint16 table_actions[] =
|
||||
{
|
||||
WM_ACTION_GO,
|
||||
WM_ACTION_STOP,
|
||||
@ -51,10 +50,6 @@ Sint16 table_actions[] =
|
||||
WM_ACTION_FABARMURE,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Supprime tous les blupi.
|
||||
|
||||
void CDecor::BlupiFlush()
|
||||
@ -290,8 +285,6 @@ void CDecor::BlupiKill (Sint32 exRank, POINT cel, Sint32 type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test si un blupi existe.
|
||||
|
||||
bool CDecor::BlupiIfExist (Sint32 rank)
|
||||
@ -299,7 +292,6 @@ bool CDecor::BlupiIfExist (Sint32 rank)
|
||||
return !!m_blupi[rank].bExist;
|
||||
}
|
||||
|
||||
|
||||
// Triche pour tous les blupi.
|
||||
// #1 -> (POWER) redonne l'énergie maximale
|
||||
// #2 -> (LONESOME) tue toutes les araignées/virus/etc.
|
||||
@ -330,7 +322,6 @@ void CDecor::BlupiCheat (Sint32 cheat)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Actualise un blupi pour pouvoir le dessiner dans son état.
|
||||
|
||||
void CDecor::BlupiActualise (Sint32 rank)
|
||||
@ -444,7 +435,6 @@ void CDecor::BlupiAdaptIcon (Sint32 rank)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fait entendre un son pour un blupi.
|
||||
// Si bStop=true, on stoppe le son précédent associé
|
||||
// à ce blupi (rank), si nécessaire.
|
||||
@ -513,7 +503,7 @@ void CDecor::BlupiSound (Sint32 rank, Sint32 sound, POINT pos, bool bStop)
|
||||
|
||||
// Sons associés à des actions.
|
||||
|
||||
static Sint16 tableSound[] =
|
||||
static const Sint16 tableSound[] =
|
||||
{
|
||||
ACTION_BRULE, SOUND_BRULE,
|
||||
ACTION_TCHAO, SOUND_TCHAO,
|
||||
@ -528,7 +518,7 @@ static Sint16 tableSound[] =
|
||||
|
||||
void CDecor::BlupiInitAction (Sint32 rank, Sint32 action, Sint32 direct)
|
||||
{
|
||||
Sint16 *pTable = tableSound;
|
||||
const auto *pTable = tableSound;
|
||||
POINT pos;
|
||||
Sint32 rand;
|
||||
|
||||
@ -809,6 +799,7 @@ void CDecor::BlupiChangeAction (Sint32 rank, Sint32 action, Sint32 direct)
|
||||
{
|
||||
if (rank < 0)
|
||||
return;
|
||||
|
||||
BlupiInitAction (rank, action, direct);
|
||||
BlupiDestCel (rank);
|
||||
m_blupi[rank].phase = 0;
|
||||
@ -817,8 +808,6 @@ void CDecor::BlupiChangeAction (Sint32 rank, Sint32 action, Sint32 direct)
|
||||
BlupiNextAction (rank);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Vide la liste des actions.
|
||||
|
||||
void CDecor::ListFlush (Sint32 rank)
|
||||
@ -1186,8 +1175,6 @@ ok:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Démarre une action.
|
||||
|
||||
void CDecor::GoalStart (Sint32 rank, Sint32 action, POINT cel)
|
||||
@ -2268,7 +2255,6 @@ void CDecor::GoalStop (Sint32 rank, bool bError, bool bSound)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Teste si une cellule est déjà utilisée comme but pour
|
||||
// n'importe quel blupi.
|
||||
|
||||
@ -2287,7 +2273,6 @@ bool CDecor::BlupiIsGoalUsed (POINT cel)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Démarre ou stoppe un rayon entre deux tours.
|
||||
|
||||
void CDecor::BlupiStartStopRayon (Sint32 rank, POINT startCel, POINT endCel)
|
||||
@ -2362,7 +2347,6 @@ void CDecor::BlupiStartStopRayon (Sint32 rank, POINT startCel, POINT endCel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Tourne un blupi, si nécessaire.
|
||||
// Retourne false si ce n'est pas nécessaire.
|
||||
|
||||
@ -3254,7 +3238,6 @@ void CDecor::BlupiStep (bool bFirst)
|
||||
m_time ++; // avance le temps absolu global
|
||||
}
|
||||
|
||||
|
||||
// Retourne le rectangle occupé par un blupi,
|
||||
// pour les sélections (pas exact).
|
||||
|
||||
@ -3276,7 +3259,6 @@ void CDecor::BlupiGetRect (Sint32 rank, RECT &rect)
|
||||
|
||||
Sint32 CDecor::GetTargetBlupi (POINT pos)
|
||||
{
|
||||
#if 1
|
||||
Sint32 rank, found, prof;
|
||||
POINT test, rel, cel;
|
||||
|
||||
@ -3321,61 +3303,7 @@ Sint32 CDecor::GetTargetBlupi (POINT pos)
|
||||
}
|
||||
|
||||
return found;
|
||||
#else
|
||||
Sint32 rank, found, prof;
|
||||
RECT rect;
|
||||
POINT cel;
|
||||
|
||||
found = -1;
|
||||
prof = 0;
|
||||
for (rank = 0 ; rank < MAXBLUPI ; rank++)
|
||||
{
|
||||
if (m_blupi[rank].bExist &&
|
||||
(m_blupi[rank].perso == 0 || // blupi ?
|
||||
m_blupi[rank].perso == 8)) // disciple ?
|
||||
{
|
||||
BlupiGetRect (rank, rect);
|
||||
|
||||
if (pos.x >= rect.left &&
|
||||
pos.x <= rect.right &&
|
||||
pos.y >= rect.top &&
|
||||
pos.y <= rect.bottom)
|
||||
{
|
||||
if (found != -1 &&
|
||||
rect.top < prof)
|
||||
continue;
|
||||
|
||||
found = rank;
|
||||
prof = rect.top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found != -1)
|
||||
return found;
|
||||
|
||||
cel = ConvPosToCel (pos);
|
||||
|
||||
for (rank = 0 ; rank < MAXBLUPI ; rank++)
|
||||
{
|
||||
if (m_blupi[rank].bExist &&
|
||||
(m_blupi[rank].perso == 0 || // blupi ?
|
||||
m_blupi[rank].perso == 8)) // disciple ?
|
||||
{
|
||||
if (cel.x == m_blupi[rank].cel.x &&
|
||||
cel.y == m_blupi[rank].cel.y)
|
||||
return rank;
|
||||
|
||||
if (cel.x == m_blupi[rank].destCel.x &&
|
||||
cel.y == m_blupi[rank].destCel.y)
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Déslectionne tous les blupi.
|
||||
|
||||
@ -3465,7 +3393,7 @@ void CDecor::BlupiHiliDown (POINT pos, bool bAdd)
|
||||
|
||||
// Sélectionne un blupi lorsque la souris est déplacée.
|
||||
|
||||
void CDecor::BlupiHiliMove (POINT pos, bool bAdd)
|
||||
void CDecor::BlupiHiliMove (POINT pos)
|
||||
{
|
||||
if (m_bHiliRect) // rectangle de sélection existe ?
|
||||
{
|
||||
@ -3477,7 +3405,7 @@ void CDecor::BlupiHiliMove (POINT pos, bool bAdd)
|
||||
// Sélectionne un blupi lorsque le bouton est relâché.
|
||||
// Retourne false si la sélection n'a pas changé !
|
||||
|
||||
void CDecor::BlupiHiliUp (POINT pos, bool bAdd)
|
||||
void CDecor::BlupiHiliUp (POINT pos)
|
||||
{
|
||||
Sint32 rank, r, nb, sound;
|
||||
bool bEnerve = false;
|
||||
@ -3761,7 +3689,6 @@ void CDecor::BlupiDrawHili()
|
||||
m_shiftHili += 3;
|
||||
}
|
||||
|
||||
|
||||
// Retourne le bouton par défaut à un endroit donné.
|
||||
// Est utilisé pour trouver que faire lors d'un clic
|
||||
// avec le bouton de droite.
|
||||
@ -3780,6 +3707,7 @@ Sint32 CDecor::GetDefButton (POINT cel)
|
||||
return -1;
|
||||
if (m_nbBlupiHili > 1)
|
||||
return BUTTON_GO;
|
||||
|
||||
rank = m_rankBlupiHili;
|
||||
|
||||
button = BUTTON_GO;
|
||||
|
@ -285,8 +285,8 @@ public:
|
||||
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 BlupiHiliMove (POINT pos);
|
||||
void BlupiHiliUp (POINT pos);
|
||||
void BlupiDrawHili();
|
||||
Sint32 GetDefButton (POINT cel);
|
||||
bool BlupiGoal (Sint32 rank, Sint32 button, POINT cel, POINT cMem);
|
||||
@ -550,4 +550,4 @@ POINT GetCel (POINT cel, Sint32 x, Sint32 y);
|
||||
bool IsValid (POINT cel);
|
||||
POINT GetVector (Sint32 direct);
|
||||
extern Sint32 table_multi_goal[];
|
||||
extern Sint16 table_actions[];
|
||||
extern const Sint16 table_actions[];
|
||||
|
@ -3367,7 +3367,7 @@ bool CEvent::PlayMove (POINT pos, Uint16 mod)
|
||||
if (m_bMouseDown) // bouton souris pressé ?
|
||||
{
|
||||
if (m_bHili)
|
||||
m_pDecor->BlupiHiliMove (pos, !! (mod & KMOD_SHIFT));
|
||||
m_pDecor->BlupiHiliMove (pos);
|
||||
else
|
||||
m_pDecor->CelHili (pos, 0);
|
||||
}
|
||||
@ -3393,7 +3393,7 @@ bool CEvent::PlayUp (POINT pos, Uint16 mod)
|
||||
if (m_bMouseDown) // bouton souris pressé ?
|
||||
{
|
||||
if (m_bHili)
|
||||
m_pDecor->BlupiHiliUp (pos, !! (mod & KMOD_SHIFT));
|
||||
m_pDecor->BlupiHiliUp (pos);
|
||||
else
|
||||
{
|
||||
m_pDecor->BlupiGetButtons (pos, m_menuNb, m_menuButtons,
|
||||
|
Loading…
x
Reference in New Issue
Block a user