mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Remove windows headers
This commit is contained in:
parent
c3d9dd6e48
commit
350f31f17a
2
action.h
2
action.h
@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "blupi.h"
|
||||
|
||||
extern
|
||||
bool Action(short action, short direct,
|
||||
short &phase, short &step,
|
||||
|
13
blupi.cpp
13
blupi.cpp
@ -40,7 +40,7 @@ int g_mouseType = MOUSETYPEGRA;
|
||||
bool g_bActive = true; // is application active ?
|
||||
bool g_bTermInit = false; // initialisation en cours
|
||||
|
||||
UINT g_lastPhase = 999;
|
||||
unsigned int g_lastPhase = 999;
|
||||
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ bool ReadConfig(int argc, char *argv[])
|
||||
void UpdateFrame(void)
|
||||
{
|
||||
RECT clip, rcRect;
|
||||
UINT phase;
|
||||
unsigned int phase;
|
||||
POINT posMouse;
|
||||
int i, term, speed;
|
||||
|
||||
@ -360,7 +360,6 @@ void WindowProc2 (const SDL_Event &event)
|
||||
{
|
||||
switch (event.user.code)
|
||||
{
|
||||
case WM_TIMER:
|
||||
case WM_UPDATE:
|
||||
if (!g_pEvent->IsMovie ()) // pas de film en cours ?
|
||||
{
|
||||
@ -423,13 +422,7 @@ static bool DoInit(int argc, char *argv[])
|
||||
// Create a window.
|
||||
if ( g_bFullScreen )
|
||||
{
|
||||
g_window = SDL_CreateWindow (
|
||||
NAME,
|
||||
0, 0,
|
||||
GetSystemMetrics (SM_CXSCREEN),
|
||||
GetSystemMetrics (SM_CYSCREEN),
|
||||
SDL_WINDOW_FULLSCREEN
|
||||
);
|
||||
g_window = SDL_CreateWindow (NAME, 0, 0, LXIMAGE, LYIMAGE, SDL_WINDOW_FULLSCREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
43
blupi.h
43
blupi.h
@ -5,3 +5,46 @@
|
||||
|
||||
extern SDL_Window *g_window;
|
||||
extern SDL_Renderer *g_renderer;
|
||||
|
||||
struct POINT
|
||||
{
|
||||
long x;
|
||||
long y;
|
||||
};
|
||||
|
||||
struct RECT
|
||||
{
|
||||
long left;
|
||||
long top;
|
||||
long right;
|
||||
long bottom;
|
||||
};
|
||||
|
||||
typedef unsigned long COLORREF;
|
||||
|
||||
#if defined(_WIN64)
|
||||
typedef unsigned __int64 WPARAM;
|
||||
typedef __int64 LPARAM;
|
||||
#else
|
||||
typedef unsigned int WPARAM;
|
||||
typedef long LPARAM;
|
||||
#endif
|
||||
|
||||
#define LOWORD(l) ((unsigned short)(((unsigned long)(l)) & 0xffff))
|
||||
#define HIWORD(l) ((unsigned short)((((unsigned long)(l)) >> 16) & 0xffff))
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
#define VK_END 0x23
|
||||
#define VK_LEFT 0x25
|
||||
#define VK_UP 0x26
|
||||
#define VK_RIGHT 0x27
|
||||
#define VK_DOWN 0x28
|
||||
|
||||
#define WM_KEYDOWN 0x0100
|
||||
#define WM_KEYUP 0x0101
|
||||
#define WM_MOUSEMOVE 0x0200
|
||||
#define WM_LBUTTONDOWN 0x0201
|
||||
#define WM_LBUTTONUP 0x0202
|
||||
#define WM_RBUTTONDOWN 0x0204
|
||||
#define WM_RBUTTONUP 0x0205
|
||||
|
@ -45,7 +45,7 @@ bool CButton::Create(CPixmap *pPixmap, CSound *pSound,
|
||||
POINT pos, int type, bool bMinimizeRedraw,
|
||||
int *pMenu, int nbMenu,
|
||||
const char **pToolTips,
|
||||
int region, UINT message)
|
||||
int region, unsigned int message)
|
||||
{
|
||||
POINT iconDim;
|
||||
int i, icon;
|
||||
|
4
button.h
4
button.h
@ -16,7 +16,7 @@ public:
|
||||
POINT pos, int type, bool bMinimizeRedraw,
|
||||
int *pMenu, int nbMenu,
|
||||
const char **pToolTips,
|
||||
int region, UINT message);
|
||||
int region, unsigned int message);
|
||||
void Draw();
|
||||
void Redraw();
|
||||
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
int m_type; // type de bouton
|
||||
bool m_bEnable; // true si bouton actif
|
||||
bool m_bHide; // true si bouton caché
|
||||
UINT m_message; // message envoyé si bouton actionné
|
||||
unsigned int 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é
|
||||
|
@ -286,7 +286,7 @@ bool CDecor::CheminCherche(int rank, int &action)
|
||||
return false;
|
||||
}
|
||||
|
||||
memset(m_cheminWork, 0, (BYTE)MAXCELX*(BYTE)MAXCELY);
|
||||
memset(m_cheminWork, 0, (Uint8)MAXCELX*(Uint8)MAXCELY);
|
||||
CheminMemPos(rank);
|
||||
|
||||
// fait un remplissage du map de travail
|
||||
|
@ -483,7 +483,6 @@ void CDecor::MapPutCel(POINT pos)
|
||||
|
||||
bool CDecor::GenerateMap()
|
||||
{
|
||||
HBITMAP hbm;
|
||||
POINT dim, pos, cel;
|
||||
int dx, rank, i;
|
||||
|
||||
@ -535,11 +534,6 @@ bool CDecor::GenerateMap()
|
||||
g_map32_bits[i][pos.x+MAPCADREX] = m_colors[MAP_CADRE];
|
||||
}
|
||||
|
||||
|
||||
hbm = CreateBitmap(DIMMAPX, DIMMAPY, 1, 32, g_map32_bits);
|
||||
|
||||
if ( hbm == nullptr ) return false;
|
||||
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(g_map32_bits, DIMMAPX, DIMMAPY, 32, 4 * DIMMAPX, 0, 0, 0, 0);
|
||||
|
||||
dim.x = DIMMAPX;
|
||||
@ -550,7 +544,7 @@ bool CDecor::GenerateMap()
|
||||
pos.y = POSMAPY;
|
||||
m_pPixmap->DrawIcon(-1, CHMAP, 0, pos);
|
||||
|
||||
DeleteObject(hbm);
|
||||
SDL_FreeSurface (surface);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
2
decor.h
2
decor.h
@ -516,7 +516,7 @@ protected:
|
||||
int m_infoHeight;
|
||||
POINT m_memoPos[4];
|
||||
|
||||
BYTE m_cheminWork[MAXCELX*MAXCELY];
|
||||
Uint8 m_cheminWork[MAXCELX*MAXCELY];
|
||||
int m_cheminNbPos;
|
||||
POINT m_cheminPos[MAXBLUPI*2];
|
||||
int m_cheminRank[MAXBLUPI*2];
|
||||
|
4
def.h
4
def.h
@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#define _INTRO false // true si images d'introduction
|
||||
|
||||
|
||||
@ -370,7 +368,7 @@ enum MouseSprites
|
||||
};
|
||||
|
||||
|
||||
// User define message
|
||||
#define WM_USER 0x0400
|
||||
|
||||
#define WM_UPDATE (WM_USER+1)
|
||||
|
||||
|
29
event.cpp
29
event.cpp
@ -1573,7 +1573,7 @@ int CEvent::GetButtonIndex(int button)
|
||||
|
||||
while ( table[m_index].buttons[i].message != 0 )
|
||||
{
|
||||
if ( (UINT)button == table[m_index].buttons[i].message )
|
||||
if ( (unsigned int) button == table[m_index].buttons[i].message )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -1753,7 +1753,7 @@ void AddCheatCode(char *pDst, char *pSrc)
|
||||
j = strlen(pDst);
|
||||
while ( pSrc[i] != 0 )
|
||||
{
|
||||
pDst[j++] = tolower(pSrc[i++]);
|
||||
pDst[j++] = pSrc[i++];
|
||||
}
|
||||
pDst[j] = 0;
|
||||
}
|
||||
@ -2689,7 +2689,7 @@ bool CEvent::MouseOnButton(POINT pos)
|
||||
|
||||
// Retourne l'index dans table pour une phase donnée.
|
||||
|
||||
int CEvent::SearchPhase(UINT phase)
|
||||
int CEvent::SearchPhase(unsigned int phase)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
@ -2747,7 +2747,7 @@ bool CEvent::IsHelpHide()
|
||||
|
||||
// Change de phase.
|
||||
|
||||
bool CEvent::ChangePhase(UINT phase)
|
||||
bool CEvent::ChangePhase(unsigned int phase)
|
||||
{
|
||||
int index, world, time, total, music, i, max;
|
||||
POINT totalDim, iconDim;
|
||||
@ -3151,7 +3151,7 @@ bool CEvent::ChangePhase(UINT phase)
|
||||
|
||||
// Retourne la phase en cours.
|
||||
|
||||
UINT CEvent::GetPhase()
|
||||
unsigned int CEvent::GetPhase()
|
||||
{
|
||||
return m_phase;
|
||||
}
|
||||
@ -4349,7 +4349,7 @@ void CEvent::DemoRecStop()
|
||||
|
||||
if ( m_pDemoBuffer != nullptr )
|
||||
{
|
||||
DeleteFile("data\\demo.blp");
|
||||
_unlink ("data\\demo.blp");
|
||||
file = fopen("data\\demo.blp", "wb");
|
||||
if ( file != nullptr )
|
||||
{
|
||||
@ -4442,12 +4442,12 @@ void CEvent::DemoPlayStop()
|
||||
ChangePhase(WM_PHASE_INIT);
|
||||
}
|
||||
|
||||
void CEvent::WinToSDLEvent (UINT msg, WPARAM wParam, LPARAM lParam, SDL_Event &event)
|
||||
void CEvent::WinToSDLEvent (unsigned int 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))
|
||||
|
||||
static const std::unordered_map<UINT, SDL_Keysym> keycodes = {
|
||||
static const std::unordered_map<unsigned int, 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 } },
|
||||
@ -4539,7 +4539,7 @@ void CEvent::WinToSDLEvent (UINT msg, WPARAM wParam, LPARAM lParam, SDL_Event &e
|
||||
void CEvent::DemoStep()
|
||||
{
|
||||
int time;
|
||||
UINT message;
|
||||
unsigned int message;
|
||||
WPARAM wParam;
|
||||
LPARAM lParam;
|
||||
|
||||
@ -4593,7 +4593,7 @@ void CEvent::DemoStep()
|
||||
|
||||
// Mémorise un événement.
|
||||
|
||||
void CEvent::DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
void CEvent::DemoRecEvent(unsigned int message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if ( m_bDemoRec && m_pDemoBuffer != nullptr &&
|
||||
(message == WM_KEYDOWN ||
|
||||
@ -4609,15 +4609,15 @@ void CEvent::DemoRecEvent(UINT 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<UINT> (wParam);
|
||||
m_pDemoBuffer[m_demoIndex-1].lParam = static_cast<UINT> (lParam);
|
||||
m_pDemoBuffer[m_demoIndex-1].wParam = static_cast<unsigned int> (wParam);
|
||||
m_pDemoBuffer[m_demoIndex-1].lParam = static_cast<unsigned int> (lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pDemoBuffer[m_demoIndex].time = m_demoTime;
|
||||
m_pDemoBuffer[m_demoIndex].message = message;
|
||||
m_pDemoBuffer[m_demoIndex].wParam = static_cast<UINT> (wParam);
|
||||
m_pDemoBuffer[m_demoIndex].lParam = static_cast<UINT> (lParam);
|
||||
m_pDemoBuffer[m_demoIndex].wParam = static_cast<unsigned int> (wParam);
|
||||
m_pDemoBuffer[m_demoIndex].lParam = static_cast<unsigned int> (lParam);
|
||||
|
||||
m_demoIndex ++;
|
||||
if ( m_demoIndex >= MAXDEMO )
|
||||
@ -4992,7 +4992,6 @@ bool CEvent::TreatEventBase(const SDL_Event &event)
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
m_keymod &= ~KMOD_CTRL;
|
||||
OutputDebugString ("CTRL: UP");
|
||||
m_bFillMouse = false;
|
||||
MouseSprite(GetMousePos());
|
||||
return true;
|
||||
|
21
event.h
21
event.h
@ -4,6 +4,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "blupi.h"
|
||||
#include "jauge.h"
|
||||
#include "menu.h"
|
||||
#include "button.h"
|
||||
@ -14,7 +15,7 @@ class CMovie;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT message;
|
||||
unsigned int message;
|
||||
int type;
|
||||
int iconMenu[20];
|
||||
int x, y;
|
||||
@ -24,7 +25,7 @@ Button;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT phase;
|
||||
unsigned int phase;
|
||||
char backName[20];
|
||||
int bCDrom;
|
||||
Button buttons[MAXBUTTON];
|
||||
@ -47,9 +48,9 @@ DemoHeader;
|
||||
typedef struct
|
||||
{
|
||||
int time;
|
||||
UINT message;
|
||||
UINT wParam; // WPARAM
|
||||
UINT lParam; // LPARAM
|
||||
unsigned int message;
|
||||
unsigned int wParam; // WPARAM
|
||||
unsigned int lParam; // LPARAM
|
||||
}
|
||||
DemoEvent;
|
||||
|
||||
@ -68,9 +69,9 @@ public:
|
||||
int GetPhysicalWorld();
|
||||
int GetImageWorld();
|
||||
bool IsHelpHide();
|
||||
bool ChangePhase(UINT phase);
|
||||
bool ChangePhase(unsigned int phase);
|
||||
void MovieToStart();
|
||||
UINT GetPhase();
|
||||
unsigned int GetPhase();
|
||||
void TryInsert();
|
||||
void RestoreGame();
|
||||
|
||||
@ -119,7 +120,7 @@ protected:
|
||||
bool CreateButtons();
|
||||
bool EventButtons(const SDL_Event &event, POINT pos);
|
||||
bool MouseOnButton(POINT pos);
|
||||
int SearchPhase(UINT phase);
|
||||
int SearchPhase(unsigned int phase);
|
||||
void DecorShift(int dx, int dy);
|
||||
|
||||
bool PlayDown(POINT pos, const SDL_Event &event);
|
||||
@ -142,8 +143,8 @@ protected:
|
||||
void DemoRecStop();
|
||||
bool DemoPlayStart();
|
||||
void DemoPlayStop();
|
||||
static void WinToSDLEvent (UINT msg, WPARAM wParam, LPARAM lParam, SDL_Event &event);
|
||||
void DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
static void WinToSDLEvent (unsigned int msg, WPARAM wParam, LPARAM lParam, SDL_Event &event);
|
||||
void DemoRecEvent(unsigned int message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
protected:
|
||||
int m_speed;
|
||||
|
2
menu.h
2
menu.h
@ -47,7 +47,7 @@ protected:
|
||||
int m_buttons[MAXBUTTON];
|
||||
int m_errors[MAXBUTTON];
|
||||
std::unordered_map<int, const char *> m_texts;
|
||||
UINT m_messages[MAXBUTTON];
|
||||
unsigned int m_messages[MAXBUTTON];
|
||||
int m_selRank;
|
||||
};
|
||||
|
||||
|
40
misc.cpp
40
misc.cpp
@ -1,12 +1,15 @@
|
||||
// misc.cpp
|
||||
//
|
||||
|
||||
#include <SDL_log.h>
|
||||
#include <SDL_mouse.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <direct.h>
|
||||
#include "blupi.h"
|
||||
#include "def.h"
|
||||
|
||||
|
||||
// Variables globales
|
||||
|
||||
extern bool g_bFullScreen; // false si mode de test
|
||||
@ -17,9 +20,7 @@ extern int g_mouseType;
|
||||
|
||||
void OutputDebug(char *pMessage)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString(pMessage);
|
||||
#endif
|
||||
SDL_LogDebug (SDL_LOG_CATEGORY_APPLICATION, "%s", pMessage);
|
||||
}
|
||||
|
||||
// Conversion de la position de la souris.
|
||||
@ -65,18 +66,13 @@ int Random(int min, int max)
|
||||
|
||||
void GetCurrentDir(char *pName, size_t lg)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
strncpy(pName, _pgmptr, lg-1);
|
||||
char *basePath = SDL_GetBasePath ();
|
||||
strncpy(pName, basePath, lg-1);
|
||||
pName[lg-1] = 0;
|
||||
|
||||
lg = strlen(pName);
|
||||
if ( lg == 0 ) return;
|
||||
|
||||
for ( i=0 ; i<lg ; i++ )
|
||||
{
|
||||
pName[i] = tolower(pName[i]);
|
||||
}
|
||||
if (lg == 0)
|
||||
goto out;
|
||||
|
||||
while ( lg > 0 )
|
||||
{
|
||||
@ -88,10 +84,13 @@ void GetCurrentDir(char *pName, size_t lg)
|
||||
}
|
||||
}
|
||||
|
||||
if ( lg > 6 && strcmp(pName+lg-6, "\\debug\\") == 0 )
|
||||
if ( lg > 6 && strcmp(pName+lg-6, "\\Debug\\") == 0 )
|
||||
{
|
||||
pName[lg-5] = 0; // ignore le dossier \debug !
|
||||
}
|
||||
|
||||
out:
|
||||
SDL_free (basePath);
|
||||
}
|
||||
|
||||
// Ajoute le chemin permettant de lire un fichier
|
||||
@ -99,18 +98,12 @@ void GetCurrentDir(char *pName, size_t lg)
|
||||
|
||||
void AddUserPath(char *pFilename)
|
||||
{
|
||||
char temp[MAX_PATH];
|
||||
char *temp;
|
||||
char* pText;
|
||||
size_t pos;
|
||||
char last;
|
||||
SECURITY_ATTRIBUTES att;
|
||||
|
||||
strcpy(temp, "c:\\Planète Blupi\\");
|
||||
|
||||
att.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
att.lpSecurityDescriptor = nullptr;
|
||||
att.bInheritHandle = false;
|
||||
CreateDirectory(temp, &att);
|
||||
temp = SDL_GetPrefPath ("Epsitec SA", "Planet Blupi");
|
||||
|
||||
pText = strstr(pFilename, "\\");
|
||||
if ( pText != nullptr )
|
||||
@ -119,7 +112,7 @@ void AddUserPath(char *pFilename)
|
||||
strcat(temp, pFilename);
|
||||
last = temp[pos];
|
||||
temp[pos] = 0;
|
||||
CreateDirectory(temp, &att);
|
||||
_mkdir (temp);
|
||||
temp[pos] = last;
|
||||
}
|
||||
else
|
||||
@ -128,4 +121,5 @@ void AddUserPath(char *pFilename)
|
||||
}
|
||||
|
||||
strcpy(pFilename, temp);
|
||||
SDL_free (temp);
|
||||
}
|
||||
|
2
misc.h
2
misc.h
@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include "blupi.h"
|
||||
|
||||
extern void OutputDebug(char *pMessage);
|
||||
|
||||
|
2
pixmap.h
2
pixmap.h
@ -4,7 +4,7 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include "blupi.h"
|
||||
|
||||
#define MAXIMAGE 100
|
||||
#define MAXCURSORS 14
|
||||
|
@ -266,7 +266,7 @@ bool CSound::PlayImage(int channel, POINT pos, int rank)
|
||||
// Uses MCI to play a MIDI file. The window procedure
|
||||
// is notified when playback is complete.
|
||||
|
||||
bool CSound::PlayMusic(LPSTR lpszMIDIFilename)
|
||||
bool CSound::PlayMusic(const char *lpszMIDIFilename)
|
||||
{
|
||||
char string[MAX_PATH];
|
||||
|
||||
|
5
sound.h
5
sound.h
@ -4,9 +4,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
#include <SDL_mixer.h>
|
||||
|
||||
#include "blupi.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -35,7 +34,7 @@ public:
|
||||
|
||||
bool Play(int channel, int volume=0, Uint8 panLeft = 255, Uint8 panRight = 255);
|
||||
bool PlayImage(int channel, POINT pos, int rank=-1);
|
||||
bool PlayMusic(LPSTR lpszMIDIFilename);
|
||||
bool PlayMusic(const char *lpszMIDIFilename);
|
||||
bool RestartMusic();
|
||||
void SuspendMusic();
|
||||
void StopMusic();
|
||||
|
Loading…
x
Reference in New Issue
Block a user