Still working on the BIG FUCKING CONVERSION...
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.vscode/*
|
||||
*.exe
|
||||
@@ -24,14 +24,9 @@ bool AppController::Init(void)
|
||||
|
||||
drawManager = new DrawManager(gameInfo->modeGrafic);
|
||||
inputManager = new InputManager(gameInfo);
|
||||
musicManager = new MusicManager();
|
||||
|
||||
if ( !drawManager->Init() ) { return false; }
|
||||
musicManager->Init();
|
||||
|
||||
SDL_WM_SetCaption( APPLICATION_NAME, NULL );
|
||||
|
||||
SDL_ShowCursor(0);
|
||||
music_init();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -44,43 +39,43 @@ void AppController::Go()
|
||||
switch ( gameInfo->estado ) {
|
||||
case ESTADO_SEQUENCIA:
|
||||
SequenceController *sequenceController;
|
||||
sequenceController = new SequenceController(drawManager, inputManager, musicManager);
|
||||
sequenceController = new SequenceController(drawManager, inputManager);
|
||||
sequenceController->Go(gameInfo);
|
||||
delete sequenceController;
|
||||
break;
|
||||
case ESTADO_MENU:
|
||||
MenuController *menuController;
|
||||
menuController = new MenuController(drawManager, inputManager, musicManager);
|
||||
menuController = new MenuController(drawManager, inputManager);
|
||||
menuController->Go(gameInfo);
|
||||
delete menuController;
|
||||
break;
|
||||
case ESTADO_PASSWORD:
|
||||
PasswordController *passwordController;
|
||||
passwordController = new PasswordController(drawManager, inputManager, musicManager);
|
||||
passwordController = new PasswordController(drawManager, inputManager);
|
||||
passwordController->Go(gameInfo);
|
||||
delete passwordController;
|
||||
break;
|
||||
case ESTADO_PREFASE:
|
||||
PrefaseController *prefaseController;
|
||||
prefaseController = new PrefaseController(drawManager, inputManager, musicManager);
|
||||
prefaseController = new PrefaseController(drawManager, inputManager);
|
||||
prefaseController->Go(gameInfo);
|
||||
delete prefaseController;
|
||||
break;
|
||||
case ESTADO_JUEGO:
|
||||
GameController *gameController;
|
||||
gameController = new GameController(drawManager, inputManager, musicManager);
|
||||
gameController = new GameController(drawManager, inputManager);
|
||||
gameController->Go(gameInfo);
|
||||
delete gameController;
|
||||
break;
|
||||
case ESTADO_POSTFASE:
|
||||
PostfaseController *postfaseController;
|
||||
postfaseController = new PostfaseController(drawManager, inputManager, musicManager);
|
||||
postfaseController = new PostfaseController(drawManager, inputManager);
|
||||
postfaseController->Go(gameInfo);
|
||||
delete postfaseController;
|
||||
break;
|
||||
case ESTADO_MORT:
|
||||
MortController *mortController;
|
||||
mortController = new MortController(drawManager, inputManager, musicManager);
|
||||
mortController = new MortController(drawManager, inputManager);
|
||||
mortController->Go(gameInfo);
|
||||
delete mortController;
|
||||
break;
|
||||
@@ -94,7 +89,6 @@ void AppController::Finalize(void)
|
||||
{
|
||||
delete drawManager;
|
||||
delete inputManager;
|
||||
delete musicManager;
|
||||
delete gameInfo;
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
@@ -19,7 +19,6 @@ private:
|
||||
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
GameInfo *gameInfo;
|
||||
|
||||
};
|
||||
|
||||
@@ -816,3 +816,40 @@ void ArounderProcesor::put_pixel( int x, int y, Uint32 pixel )
|
||||
{
|
||||
pixels[ ( y * mapa->w ) + x ] = pixel;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
#define COLOR 0xFFFFFFFF;
|
||||
|
||||
void vline(const int x, const int y1, const int y2) {
|
||||
if (x < 0 || x > 319) return;
|
||||
const int yy1 = y1 < 0 ? 0 : y1 > 239 ? 239 : y1;
|
||||
const int yy2 = y2 < 0 ? 0 : y2 > 239 ? 239 : y2;
|
||||
for (int y=yy1;y<=yy2;y++) pixels[x+y*pitch] = COLOR;
|
||||
}
|
||||
|
||||
void hline(const int x1, const int x2, const int y) {
|
||||
if (y < 0 || y > 239) return;
|
||||
const int yy = y*pitch;
|
||||
const int xx1 = x1 < 0 ? 0 : x1 > 319 ? 319 : x1;
|
||||
const int xx2 = x2 < 0 ? 0 : x2 > 319 ? 319 : x2;
|
||||
for (int x=xx1;x<=xx2;x++) pixels[x+yy] = COLOR;
|
||||
}
|
||||
|
||||
void circle(const int x, const int y) {
|
||||
hline(x+9, x+9+7, y+0); hline(x+9, x+9+7, y+24);
|
||||
hline(x+7, x+7+11, y+1); hline(x+7, x+7+11, y+23);
|
||||
hline(x+5, x+5+15, y+2); hline(x+5, x+5+15, y+22);
|
||||
hline(x+4, x+4+17, y+3); hline(x+4, x+4+17, y+21);
|
||||
hline(x+3, x+3+19, y+4); hline(x+3, x+3+19, y+20);
|
||||
hline(x+2, x+2+21, y+5); hline(x+2, x+2+21, y+19);
|
||||
hline(x+2, x+2+21, y+6); hline(x+2, x+2+21, y+18);
|
||||
hline(x+1, x+1+23, y+7); hline(x+1, x+1+23, y+17);
|
||||
hline(x+1, x+1+23, y+8); hline(x+1, x+1+23, y+16);
|
||||
hline(x, x+25, y+9); hline(x, x+25, y+15);
|
||||
hline(x, x+25, y+10); hline(x, x+25, y+14);
|
||||
hline(x, x+25, y+11); hline(x, x+25, y+13);
|
||||
hline(x, x+25, y+12);
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -4,38 +4,31 @@
|
||||
#include "SDL2/SDL_image.h"
|
||||
|
||||
|
||||
SDL_Window *sdlWindow = NULL;
|
||||
SDL_Renderer *sdlRenderer = NULL;
|
||||
|
||||
DrawManager::DrawManager(int pMode)
|
||||
{
|
||||
DrawManager::DrawManager(int pMode) {
|
||||
mode = pMode;
|
||||
screen = NULL;
|
||||
screenBig = NULL;
|
||||
}
|
||||
|
||||
DrawManager::~DrawManager(void)
|
||||
{
|
||||
DrawManager::~DrawManager(void) {
|
||||
SDL_FreeSurface(temp);
|
||||
SDL_FreeSurface(black);
|
||||
SDL_FreeSurface(faded);
|
||||
|
||||
SDL_DestroyRenderer(sdlRenderer);
|
||||
SDL_DestroyWindow(sdlWindow);
|
||||
}
|
||||
|
||||
bool DrawManager::Init(void)
|
||||
{
|
||||
switch (mode) {
|
||||
case 1:
|
||||
screenBig = SDL_SetVideoMode( SCREEN_WIDTH<<1, SCREEN_HEIGHT<<1, SCREEN_BPP, SDL_SWSURFACE );
|
||||
if( screenBig == NULL ) { return false; }
|
||||
screen = LoadBitmap("black.gif");
|
||||
break;
|
||||
case 2:
|
||||
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_FULLSCREEN );
|
||||
if( screen == NULL ) { return false; }
|
||||
break;
|
||||
default:
|
||||
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
|
||||
if( screen == NULL ) { return false; }
|
||||
break;
|
||||
}
|
||||
bool DrawManager::Init(void) {
|
||||
|
||||
sdlWindow = SDL_CreateWindow(APPLICATION_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
||||
SDL_RenderSetLogicalSize(sdlRenderer, 320, 240);
|
||||
|
||||
SDL_ShowCursor(0);
|
||||
|
||||
color_blanco = -1;
|
||||
color_rojo = SDL_MapRGB( screen->format, 255, 0, 0 );
|
||||
color_verde = SDL_MapRGB( screen->format, 0, 255, 0 );
|
||||
@@ -50,34 +43,15 @@ bool DrawManager::Init(void)
|
||||
|
||||
bool DrawManager::Flip(void)
|
||||
{
|
||||
if (mode == 1) {
|
||||
for (int x=0; x<320; x++) {
|
||||
for (int y=0; y<200; y++) {
|
||||
put_pixel32(screenBig, x<<1 , y<<1 , get_pixel32(screen, x, y));
|
||||
put_pixel32(screenBig, (x<<1)+1, y<<1 , get_pixel32(screen, x, y));
|
||||
put_pixel32(screenBig, x<<1 , (y<<1)+1, get_pixel32(screen, x, y));
|
||||
put_pixel32(screenBig, (x<<1)+1, (y<<1)+1, get_pixel32(screen, x, y));
|
||||
}
|
||||
}
|
||||
if (SDL_Flip( screenBig ) == -1 ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (SDL_Flip( screen ) == -1 ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
return true;
|
||||
}
|
||||
|
||||
SDL_Surface *DrawManager::LoadBitmap(char *bitmapfilename, bool doColorKey)
|
||||
SDL_Surface *DrawManager::LoadBitmap(const char *bitmapfilename, const bool doColorKey)
|
||||
{
|
||||
//Get the bitmap's buffer and size from the resource file
|
||||
int filesize = 0;
|
||||
char *buffer = GetBufferFromResource(bitmapfilename, &filesize);
|
||||
const char *buffer = file_getBufferFromResource(bitmapfilename, filesize);
|
||||
|
||||
//Load the buffer into a surface using RWops
|
||||
SDL_RWops *rw = SDL_RWFromMem(buffer, filesize);
|
||||
@@ -111,11 +85,11 @@ SDL_Surface *DrawManager::LoadBitmap(char *bitmapfilename, bool doColorKey)
|
||||
}
|
||||
|
||||
|
||||
SDL_Surface *DrawManager::LoadMask(char *bitmapfilename)
|
||||
SDL_Surface *DrawManager::LoadMask(const char *bitmapfilename)
|
||||
{
|
||||
//Get the bitmap's buffer and size from the resource file
|
||||
int filesize = 0;
|
||||
char *buffer = GetBufferFromResource(bitmapfilename, &filesize);
|
||||
const char *buffer = file_getBufferFromResource(bitmapfilename, filesize);
|
||||
|
||||
//Load the buffer into a surface using RWops
|
||||
SDL_RWops *rw = SDL_RWFromMem(buffer, filesize);
|
||||
@@ -162,7 +136,7 @@ void DrawManager::Blit( int x, int y, SDL_Surface* source, SDL_Rect* clip )
|
||||
apply_surface(x, y, source, screen, clip);
|
||||
}
|
||||
|
||||
void DrawManager::Print( int x, int y, SDL_Surface* source, int w, int h, char *text, SDL_Surface *dest ) {
|
||||
void DrawManager::Print( int x, int y, SDL_Surface* source, int w, int h, const char *text, SDL_Surface *dest ) {
|
||||
int index = 0;
|
||||
SDL_Rect clip;
|
||||
|
||||
@@ -273,7 +247,7 @@ void DrawManager::DrawFadedBack() {
|
||||
Blit(0,0, faded);
|
||||
}
|
||||
|
||||
SDL_Surface *DrawManager::LoadFont(char *bitmapfilename, Uint32 color)
|
||||
SDL_Surface *DrawManager::LoadFont(const char *bitmapfilename, const Uint32 color)
|
||||
{
|
||||
if (color == 0xFFFFFFFF) {
|
||||
return LoadBitmap(bitmapfilename, true);
|
||||
|
||||
@@ -10,17 +10,17 @@ public:
|
||||
bool Init(void);
|
||||
bool Flip(void);
|
||||
|
||||
SDL_Surface *LoadBitmap(char *bitmapfilename, bool doColorKey = false);
|
||||
SDL_Surface *LoadMask(char *bitmapfilename);
|
||||
SDL_Surface *LoadBitmap(const char *bitmapfilename, const bool doColorKey = false);
|
||||
SDL_Surface *LoadMask(const char *bitmapfilename);
|
||||
void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL );
|
||||
void Blit( int x, int y, SDL_Surface* source, SDL_Rect* clip = NULL );
|
||||
void Print( int x, int y, SDL_Surface* source, int w, int h, char *text, SDL_Surface* dest = NULL );
|
||||
void Print( int x, int y, SDL_Surface* source, int w, int h, const char *text, SDL_Surface* dest = NULL );
|
||||
void FadeOut();
|
||||
void FadeIn();
|
||||
void FadeOutGray();
|
||||
void FadeInGray();
|
||||
void DrawFadedBack();
|
||||
SDL_Surface *LoadFont(char *bitmapfilename, Uint32 color = 0xFFFFFFFF);
|
||||
SDL_Surface *LoadFont(const char *bitmapfilename, const Uint32 color = 0xFFFFFFFF);
|
||||
|
||||
int mode;
|
||||
|
||||
@@ -30,7 +30,6 @@ public:
|
||||
Uint32 color_azul;
|
||||
private:
|
||||
SDL_Surface *screen;
|
||||
SDL_Surface *screenBig;
|
||||
SDL_Surface *black;
|
||||
SDL_Surface *temp;
|
||||
SDL_Surface *faded;
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
#include "const.h"
|
||||
#include "fileManager.h"
|
||||
|
||||
GameController::GameController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
GameController::GameController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
GameController::~GameController(void) {
|
||||
GameController::~GameController() {
|
||||
}
|
||||
|
||||
bool GameController::Init()
|
||||
@@ -33,9 +32,9 @@ bool GameController::Init()
|
||||
arounderSeleccionat = primerArounder;
|
||||
|
||||
if ( ((gameInfo->fase+1) % 5) == 0) {
|
||||
musicManager->Load( "mus6.mp3");
|
||||
music_load( "mus6.mp3");
|
||||
} else {
|
||||
musicManager->Load( "mus4.mp3");
|
||||
music_load( "mus4.mp3");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -53,7 +52,7 @@ void GameController::Go(GameInfo *pGameInfo)
|
||||
|
||||
if ( !Init() ) { salir = true; gameInfo->estado = ESTADO_SALIR; }
|
||||
|
||||
musicManager->Play(-1);
|
||||
music_play(-1);
|
||||
drawManager->Blit(0,0, fondo);
|
||||
drawManager->Blit(0,0, mapa);
|
||||
drawManager->FadeIn();
|
||||
@@ -183,7 +182,7 @@ void GameController::Go(GameInfo *pGameInfo)
|
||||
|
||||
}
|
||||
|
||||
musicManager->FadeOut();
|
||||
music_fadeOut();
|
||||
drawManager->FadeOut();
|
||||
|
||||
Finalize();
|
||||
@@ -253,7 +252,7 @@ bool GameController::Pausa() {
|
||||
return salirJuego;
|
||||
}
|
||||
|
||||
bool GameController::Menu(bool bypass) {
|
||||
bool GameController::Menu(const bool bypass) {
|
||||
|
||||
if (!bypass) {
|
||||
PintarEscena();
|
||||
@@ -312,10 +311,10 @@ bool GameController::Menu(bool bypass) {
|
||||
return salirJuego;
|
||||
}
|
||||
|
||||
void GameController::CarregarMapa(int numMapa)
|
||||
void GameController::CarregarMapa(const int numMapa)
|
||||
{
|
||||
int filesize = 0;
|
||||
char *buffer = GetBufferFromResource("MAPES.BAL", &filesize);
|
||||
const char *buffer = file_getBufferFromResource("MAPES.BAL", filesize);
|
||||
|
||||
int punter = numMapa * 212;
|
||||
|
||||
@@ -404,7 +403,7 @@ void GameController::Finalize(void)
|
||||
}
|
||||
}
|
||||
|
||||
char *GameController::formatejar(int numero) {
|
||||
const char *GameController::formatejar(const int numero) {
|
||||
char *resultat;
|
||||
resultat = (char *) malloc(3);
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
class GameController
|
||||
{
|
||||
public:
|
||||
GameController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
~GameController(void);
|
||||
GameController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~GameController();
|
||||
|
||||
bool Init();
|
||||
void Go(GameInfo *pGameInfo);
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
private:
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
AiguaProcesor *aiguaProcesor;
|
||||
MarcadorProcesor *marcadorProcesor;
|
||||
|
||||
@@ -51,8 +50,8 @@ private:
|
||||
void PintarEscena();
|
||||
void PintarCursor();
|
||||
bool Pausa();
|
||||
bool Menu(bool bypass = false);
|
||||
void CarregarMapa(int numMapa);
|
||||
char *formatejar(int numero);
|
||||
bool Menu(const bool bypass = false);
|
||||
void CarregarMapa(const int numMapa);
|
||||
const char *formatejar(const int numero);
|
||||
|
||||
};
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include "MenuController.h"
|
||||
#include "const.h"
|
||||
|
||||
MenuController::MenuController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
MenuController::MenuController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
MenuController::~MenuController(void) {
|
||||
@@ -13,9 +12,9 @@ MenuController::~MenuController(void) {
|
||||
bool MenuController::Init() {
|
||||
fondo = drawManager->LoadBitmap("menuprin.gif");
|
||||
cursor = drawManager->LoadFont("cursor.gif");
|
||||
if (!musicManager->Sonant()) {
|
||||
musicManager->Load( "mus3.mp3");
|
||||
musicManager->Play(-1);
|
||||
if (!music_sonant()) {
|
||||
music_load("mus3.mp3");
|
||||
music_play(-1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -66,7 +65,7 @@ void MenuController::Go(GameInfo *gameInfo) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gameInfo->estado == ESTADO_SALIR) musicManager->FadeOut();
|
||||
if (gameInfo->estado == ESTADO_SALIR) music_fadeOut();
|
||||
drawManager->FadeOut();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class MenuController
|
||||
{
|
||||
public:
|
||||
MenuController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
MenuController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~MenuController(void);
|
||||
|
||||
bool Init();
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
private:
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
|
||||
SDL_Surface *fondo;
|
||||
SDL_Surface *cursor;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include "MortController.h"
|
||||
#include "const.h"
|
||||
|
||||
MortController::MortController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
MortController::MortController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
MortController::~MortController(void) {
|
||||
@@ -13,7 +12,7 @@ MortController::~MortController(void) {
|
||||
bool MortController::Init() {
|
||||
fondo = drawManager->LoadBitmap("mort.gif");
|
||||
cursor = drawManager->LoadFont("cursor.gif");
|
||||
musicManager->Load( "mus5.mp3");
|
||||
music_load( "mus5.mp3");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -23,7 +22,7 @@ void MortController::Go(GameInfo *gameInfo) {
|
||||
|
||||
if ( !Init() ) { salir = true; gameInfo->estado = ESTADO_SALIR; }
|
||||
|
||||
musicManager->Play(-1);
|
||||
music_play(-1);
|
||||
drawManager->Blit(0,0, fondo);
|
||||
drawManager->FadeIn();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class MortController
|
||||
{
|
||||
public:
|
||||
MortController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
MortController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~MortController(void);
|
||||
|
||||
bool Init();
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
private:
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
|
||||
SDL_Surface *fondo;
|
||||
SDL_Surface *cursor;
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
#include "const.h"
|
||||
#include "fileManager.h"
|
||||
|
||||
PasswordController::PasswordController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
PasswordController::PasswordController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
PasswordController::~PasswordController(void) {
|
||||
@@ -82,7 +81,7 @@ char PasswordController::ObtenerTecla() {
|
||||
|
||||
int PasswordController::ObtenerFaseDePassword(char *password) {
|
||||
int filesize = 0;
|
||||
char *buffer = GetBufferFromResource("offsets.bal", &filesize);
|
||||
const char *buffer = file_getBufferFromResource("offsets.bal", filesize);
|
||||
|
||||
int punter = 0;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class PasswordController
|
||||
{
|
||||
public:
|
||||
PasswordController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
PasswordController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~PasswordController(void);
|
||||
|
||||
bool Init();
|
||||
@@ -21,7 +21,6 @@ private:
|
||||
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
|
||||
SDL_Surface *fondo;
|
||||
SDL_Surface *cursor;
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
#include "const.h"
|
||||
#include "fileManager.h"
|
||||
|
||||
PostfaseController::PostfaseController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
PostfaseController::PostfaseController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
PostfaseController::~PostfaseController(void) {
|
||||
@@ -25,8 +24,8 @@ void PostfaseController::Go(GameInfo *gameInfo) {
|
||||
gameInfo->estado = ESTADO_SEQUENCIA;
|
||||
return;
|
||||
} else {
|
||||
musicManager->Load( "mus3.mp3");
|
||||
musicManager->Play(-1);
|
||||
music_load( "mus3.mp3");
|
||||
music_play(-1);
|
||||
}
|
||||
|
||||
if (gameInfo->fase % 5 == 0 && gameInfo->fase != 30) {
|
||||
@@ -67,7 +66,7 @@ void PostfaseController::Go(GameInfo *gameInfo) {
|
||||
|
||||
char *PostfaseController::ObtenerPasswordDeFase(int fase) {
|
||||
int filesize = 0;
|
||||
char *buffer = GetBufferFromResource("offsets.bal", &filesize);
|
||||
const char *buffer = file_getBufferFromResource("offsets.bal", filesize);
|
||||
|
||||
int punter = (fase-1)*11;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class PostfaseController
|
||||
{
|
||||
public:
|
||||
PostfaseController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
PostfaseController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~PostfaseController(void);
|
||||
|
||||
bool Init();
|
||||
@@ -21,7 +21,6 @@ private:
|
||||
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
|
||||
SDL_Surface *fondo;
|
||||
SDL_Surface *font;
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
#include "const.h"
|
||||
#include "fileManager.h"
|
||||
|
||||
PrefaseController::PrefaseController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
PrefaseController::PrefaseController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
PrefaseController::~PrefaseController(void) {
|
||||
@@ -64,7 +63,7 @@ void PrefaseController::Go(GameInfo *gameInfo) {
|
||||
salir = true;
|
||||
}
|
||||
}
|
||||
musicManager->FadeOut();
|
||||
music_fadeOut();
|
||||
drawManager->FadeOut();
|
||||
}
|
||||
|
||||
@@ -74,10 +73,10 @@ void PrefaseController::Finalize(void) {
|
||||
SDL_FreeSurface(font);
|
||||
}
|
||||
|
||||
void PrefaseController::CarregarMapa(int numMapa)
|
||||
void PrefaseController::CarregarMapa(const int numMapa)
|
||||
{
|
||||
int filesize = 0;
|
||||
char *buffer = GetBufferFromResource("MAPES.BAL", &filesize);
|
||||
const char *buffer = file_getBufferFromResource("MAPES.BAL", filesize);
|
||||
|
||||
int punter = numMapa * 212;
|
||||
|
||||
@@ -87,7 +86,7 @@ void PrefaseController::CarregarMapa(int numMapa)
|
||||
aroundersNec = buffer[punter++];
|
||||
}
|
||||
|
||||
char *PrefaseController::formatejar(int numero) {
|
||||
const char *PrefaseController::formatejar(const int numero) {
|
||||
char *resultat;
|
||||
resultat = (char *) malloc(3);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class PrefaseController
|
||||
{
|
||||
public:
|
||||
PrefaseController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
PrefaseController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~PrefaseController(void);
|
||||
|
||||
bool Init();
|
||||
@@ -16,12 +16,11 @@ public:
|
||||
void Finalize(void);
|
||||
|
||||
private:
|
||||
char *formatejar(int numero);
|
||||
void CarregarMapa(int numMapa);
|
||||
const char *formatejar(const int numero);
|
||||
void CarregarMapa(const int numMapa);
|
||||
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
|
||||
SDL_Surface *fondo;
|
||||
SDL_Surface *cursor;
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
#include "const.h"
|
||||
#include "fileManager.h"
|
||||
|
||||
SequenceController::SequenceController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager) {
|
||||
SequenceController::SequenceController(DrawManager *p_drawManager, InputManager *p_inputManager) {
|
||||
drawManager = p_drawManager;
|
||||
inputManager = p_inputManager;
|
||||
musicManager = p_musicManager;
|
||||
}
|
||||
|
||||
SequenceController::~SequenceController(void) {
|
||||
@@ -18,7 +17,7 @@ bool SequenceController::Init() {
|
||||
void SequenceController::Go(GameInfo *pGameInfo) {
|
||||
bool salir = false;
|
||||
int pantalla = 0;
|
||||
char *file;
|
||||
const char *file;
|
||||
int filesize;
|
||||
|
||||
gameInfo = pGameInfo;
|
||||
@@ -26,28 +25,28 @@ void SequenceController::Go(GameInfo *pGameInfo) {
|
||||
if (gameInfo->fase % 5 == 0 || gameInfo->fase < 0) {
|
||||
switch (gameInfo->fase) {
|
||||
case -1:
|
||||
file = GetBufferFromResource("seqIN.seq", &filesize);
|
||||
file = file_getBufferFromResource("seqIN.seq", filesize);
|
||||
break;
|
||||
case 0:
|
||||
file = GetBufferFromResource("seq00.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq00.seq", filesize);
|
||||
break;
|
||||
case 5:
|
||||
file = GetBufferFromResource("seq05.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq05.seq", filesize);
|
||||
break;
|
||||
case 10:
|
||||
file = GetBufferFromResource("seq10.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq10.seq", filesize);
|
||||
break;
|
||||
case 15:
|
||||
file = GetBufferFromResource("seq15.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq15.seq", filesize);
|
||||
break;
|
||||
case 20:
|
||||
file = GetBufferFromResource("seq20.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq20.seq", filesize);
|
||||
break;
|
||||
case 25:
|
||||
file = GetBufferFromResource("seq25.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq25.seq", filesize);
|
||||
break;
|
||||
case 30:
|
||||
file = GetBufferFromResource("seq30.seq", &filesize);
|
||||
file = file_getBufferFromResource("seq30.seq", filesize);
|
||||
break;
|
||||
}
|
||||
ProcesarSecuencia(file);
|
||||
@@ -61,7 +60,7 @@ void SequenceController::Go(GameInfo *pGameInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
void SequenceController::ProcesarSecuencia(char *file) {
|
||||
void SequenceController::ProcesarSecuencia(const char *file) {
|
||||
char numDiapositives = (char)file[0];
|
||||
int punter = 1;
|
||||
char *filename;
|
||||
@@ -201,12 +200,12 @@ void SequenceController::FadeOut() {
|
||||
|
||||
void SequenceController::FadeOutWithMusic() {
|
||||
drawManager->FadeOut();
|
||||
musicManager->FadeOut();
|
||||
music_fadeOut();
|
||||
}
|
||||
|
||||
void SequenceController::Musica(char *archivo, int loop) {
|
||||
musicManager->Load(archivo);
|
||||
musicManager->Play(loop);
|
||||
music_load(archivo);
|
||||
music_play(loop);
|
||||
}
|
||||
|
||||
void SequenceController::Finalize(void) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class SequenceController
|
||||
{
|
||||
public:
|
||||
SequenceController(DrawManager *p_drawManager, InputManager *p_inputManager, MusicManager *p_musicManager);
|
||||
SequenceController(DrawManager *p_drawManager, InputManager *p_inputManager);
|
||||
~SequenceController(void);
|
||||
|
||||
bool Init();
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
void Finalize(void);
|
||||
|
||||
private:
|
||||
void ProcesarSecuencia(char *file);
|
||||
void ProcesarSecuencia(const char *file);
|
||||
|
||||
bool Esperar(Uint32 temps);
|
||||
void FadeIn(char *archivo);
|
||||
@@ -28,7 +28,6 @@ private:
|
||||
|
||||
DrawManager *drawManager;
|
||||
InputManager *inputManager;
|
||||
MusicManager *musicManager;
|
||||
GameInfo *gameInfo;
|
||||
|
||||
SDL_Surface *fondo;
|
||||
|
||||
6
main.cpp
6
main.cpp
@@ -5,14 +5,14 @@
|
||||
int main( int argc, char* args[] )
|
||||
{
|
||||
int modeGrafic = MODE_ZOOMX2;
|
||||
char *porDefecto = "data.jrf";
|
||||
setResourceFile(porDefecto);
|
||||
const char *porDefecto = "data.jrf";
|
||||
file_setResourceFile(porDefecto);
|
||||
|
||||
if (argc > 1) {
|
||||
for (int i=1;i<argc;i++) {
|
||||
if (!strcmp(args[i], "normal")) modeGrafic = MODE_NORMAL;
|
||||
if (!strcmp(args[i], "fullscreen")) modeGrafic = MODE_FULLSCREEN;
|
||||
if (args[i][4] == '.') setResourceFile(args[i]);
|
||||
if (args[i][4] == '.') file_setResourceFile(args[i]);
|
||||
}
|
||||
}
|
||||
AppController *appController;
|
||||
|
||||
Reference in New Issue
Block a user