- [NEW] Módul "info"retocat
This commit is contained in:
7
bola.cpp
7
bola.cpp
@@ -2,8 +2,7 @@
|
|||||||
#include "jgame.h"
|
#include "jgame.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Bola::Bola( JD8_Surface gfx, Info* info, Prota* sam ) : Sprite( gfx ) {
|
Bola::Bola( JD8_Surface gfx, Prota* sam ) : Sprite( gfx ) {
|
||||||
this->info = info;
|
|
||||||
this->sam = sam;
|
this->sam = sam;
|
||||||
|
|
||||||
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
|
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
|
||||||
@@ -58,8 +57,8 @@ void Bola::update() {
|
|||||||
// Comprovem si ha tocat a Sam
|
// Comprovem si ha tocat a Sam
|
||||||
if( this->x > ( this->sam->x - 7 ) && this->x < ( this->sam->x + 7 ) && this->y > ( this->sam->y - 7 ) && this->y < ( this->sam->y + 7 ) ) {
|
if( this->x > ( this->sam->x - 7 ) && this->x < ( this->sam->x + 7 ) && this->y > ( this->sam->y - 7 ) && this->y < ( this->sam->y + 7 ) ) {
|
||||||
this->contador = 200;
|
this->contador = 200;
|
||||||
this->info->vida--;
|
info::vida--;
|
||||||
if( this->info->vida == 0 ) this->sam->o = 5;
|
if( info::vida == 0 ) this->sam->o = 5;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->contador--;
|
this->contador--;
|
||||||
|
|||||||
3
bola.h
3
bola.h
@@ -8,7 +8,7 @@ class Bola : public Sprite {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Bola( JD8_Surface gfx, Info* info, Prota* sam );
|
Bola( JD8_Surface gfx, Prota* sam );
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
void update();
|
void update();
|
||||||
@@ -18,6 +18,5 @@ protected:
|
|||||||
|
|
||||||
Uint8 contador;
|
Uint8 contador;
|
||||||
Prota* sam;
|
Prota* sam;
|
||||||
Info* info;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
14
info.cpp
Normal file
14
info.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include "info.h"
|
||||||
|
|
||||||
|
namespace info
|
||||||
|
{
|
||||||
|
int num_piramide;
|
||||||
|
int num_habitacio;
|
||||||
|
int diners;
|
||||||
|
int diamants;
|
||||||
|
int vida;
|
||||||
|
int momies;
|
||||||
|
int engendros;
|
||||||
|
bool nou_personatge;
|
||||||
|
bool pepe_activat;
|
||||||
|
};
|
||||||
21
info.h
21
info.h
@@ -1,13 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct Info {
|
namespace info
|
||||||
int num_piramide;
|
{
|
||||||
int num_habitacio;
|
extern int num_piramide;
|
||||||
int diners;
|
extern int num_habitacio;
|
||||||
int diamants;
|
extern int diners;
|
||||||
int vida;
|
extern int diamants;
|
||||||
int momies;
|
extern int vida;
|
||||||
int engendros;
|
extern int momies;
|
||||||
bool nou_personatge;
|
extern int engendros;
|
||||||
bool pepe_activat;
|
extern bool nou_personatge;
|
||||||
|
extern bool pepe_activat;
|
||||||
};
|
};
|
||||||
|
|||||||
23
main.cpp
23
main.cpp
@@ -37,19 +37,18 @@ int main( int argc, char* args[] ) {
|
|||||||
JD8_Init("Aventures En Egipte");
|
JD8_Init("Aventures En Egipte");
|
||||||
JA_Init(48000, SDL_AUDIO_S16, 2);
|
JA_Init(48000, SDL_AUDIO_S16, 2);
|
||||||
|
|
||||||
Info info;
|
info::num_habitacio = 1;
|
||||||
info.num_habitacio = 1;
|
info::num_piramide = 255;
|
||||||
info.num_piramide = 255;
|
info::diners = 0;
|
||||||
info.diners = 0;
|
info::diamants = 0;
|
||||||
info.diamants = 0;
|
info::vida = 5;
|
||||||
info.vida = 5;
|
info::momies = 0;
|
||||||
info.momies = 0;
|
info::nou_personatge = false;
|
||||||
info.nou_personatge = false;
|
info::pepe_activat = false;
|
||||||
info.pepe_activat = false;
|
|
||||||
|
|
||||||
FILE* ini = fopen("trick.ini", "rb");
|
FILE* ini = fopen("trick.ini", "rb");
|
||||||
if (ini != NULL) {
|
if (ini != NULL) {
|
||||||
info.nou_personatge = true;
|
info::nou_personatge = true;
|
||||||
fclose(ini);
|
fclose(ini);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,13 +58,13 @@ int main( int argc, char* args[] ) {
|
|||||||
switch (gameState) {
|
switch (gameState) {
|
||||||
case 0:
|
case 0:
|
||||||
ModuleGame* moduleGame;
|
ModuleGame* moduleGame;
|
||||||
moduleGame = new ModuleGame( &info );
|
moduleGame = new ModuleGame();
|
||||||
gameState = moduleGame->Go();
|
gameState = moduleGame->Go();
|
||||||
delete moduleGame;
|
delete moduleGame;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ModuleSequence* moduleSequence;
|
ModuleSequence* moduleSequence;
|
||||||
moduleSequence = new ModuleSequence( &info );
|
moduleSequence = new ModuleSequence();
|
||||||
gameState = moduleSequence->Go();
|
gameState = moduleSequence->Go();
|
||||||
delete moduleSequence;
|
delete moduleSequence;
|
||||||
break;
|
break;
|
||||||
|
|||||||
29
mapa.cpp
29
mapa.cpp
@@ -4,10 +4,9 @@
|
|||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Mapa::Mapa( JD8_Surface gfx, Info* info, Prota* sam ) {
|
Mapa::Mapa( JD8_Surface gfx, Prota* sam ) {
|
||||||
|
|
||||||
this->gfx = gfx;
|
this->gfx = gfx;
|
||||||
this->info = info;
|
|
||||||
this->sam = sam;
|
this->sam = sam;
|
||||||
|
|
||||||
this->preparaFondoEstatic();
|
this->preparaFondoEstatic();
|
||||||
@@ -31,7 +30,7 @@ Mapa::~Mapa(void) {
|
|||||||
|
|
||||||
void Mapa::draw() {
|
void Mapa::draw() {
|
||||||
|
|
||||||
if( this->info->num_piramide != 4 ) {
|
if( info::num_piramide != 4 ) {
|
||||||
switch( sam->o ) {
|
switch( sam->o ) {
|
||||||
case 0: // Down
|
case 0: // Down
|
||||||
JD8_BlitCKToSurface( sam->x, sam->y, this->gfx, 15, 125 + sam->frame_pejades, 15, 1, this->fondo, 255 );
|
JD8_BlitCKToSurface( sam->x, sam->y, this->gfx, 15, 125 + sam->frame_pejades, 15, 1, this->fondo, 255 );
|
||||||
@@ -97,7 +96,7 @@ void Mapa::preparaFondoEstatic() {
|
|||||||
|
|
||||||
// Prepara el fondo est<73>tic de l'habitaci<63>
|
// Prepara el fondo est<73>tic de l'habitaci<63>
|
||||||
this->fondo = JD8_NewSurface();
|
this->fondo = JD8_NewSurface();
|
||||||
if (info->num_piramide == 6) {
|
if (info::num_piramide == 6) {
|
||||||
JD8_BlitToSurface(9, 2, this->gfx, 227, 185, 92, 7, this->fondo); // Text "SECRETA"
|
JD8_BlitToSurface(9, 2, this->gfx, 227, 185, 92, 7, this->fondo); // Text "SECRETA"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -106,12 +105,12 @@ void Mapa::preparaFondoEstatic() {
|
|||||||
}
|
}
|
||||||
JD8_BlitToSurface(130, 2, this->gfx, 225, 192, 19, 8, this->fondo); // Montonet de monedes + signe '='
|
JD8_BlitToSurface(130, 2, this->gfx, 225, 192, 19, 8, this->fondo); // Montonet de monedes + signe '='
|
||||||
JD8_BlitToSurface(220, 2, this->gfx, 160, 185, 48, 7, this->fondo); // Text "ENERGIA"
|
JD8_BlitToSurface(220, 2, this->gfx, 160, 185, 48, 7, this->fondo); // Text "ENERGIA"
|
||||||
if (this->info->diners >= 200) JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
|
if (info::diners >= 200) JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
|
||||||
|
|
||||||
// Pinta taulells
|
// Pinta taulells
|
||||||
for( int y = 0; y < 11; y++ ) {
|
for( int y = 0; y < 11; y++ ) {
|
||||||
for( int x = 0; x < 19; x++ ) {
|
for( int x = 0; x < 19; x++ ) {
|
||||||
switch( info->num_piramide ) {
|
switch( info::num_piramide ) {
|
||||||
case 1:
|
case 1:
|
||||||
JD8_BlitToSurface( 20+(x*15), 30+(y*15), this->gfx, 0, 80, 15, 15, this->fondo );
|
JD8_BlitToSurface( 20+(x*15), 30+(y*15), this->gfx, 0, 80, 15, 15, this->fondo );
|
||||||
break;
|
break;
|
||||||
@@ -156,7 +155,7 @@ void Mapa::preparaFondoEstatic() {
|
|||||||
// Pinta la porta
|
// Pinta la porta
|
||||||
JD8_BlitCKToSurface( 150, 18, this->gfx, 0, 143, 15, 12, this->fondo, 255 );
|
JD8_BlitCKToSurface( 150, 18, this->gfx, 0, 143, 15, 12, this->fondo, 255 );
|
||||||
|
|
||||||
if( info->num_piramide == 2 ) {
|
if( info::num_piramide == 2 ) {
|
||||||
JD8_BlitToSurface( 5, 100, this->gfx, 30, 140, 15, 15, this->fondo );
|
JD8_BlitToSurface( 5, 100, this->gfx, 30, 140, 15, 15, this->fondo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,9 +167,9 @@ void swap( Uint8& a, Uint8& b ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mapa::preparaTombes() {
|
void Mapa::preparaTombes() {
|
||||||
const Uint8 contingut = this->info->num_piramide == 6 ? CONTE_DIAMANT : CONTE_RES;
|
const Uint8 contingut = info::num_piramide == 6 ? CONTE_DIAMANT : CONTE_RES;
|
||||||
int cx = this->info->num_piramide == 6 ? 270 : 0;
|
int cx = info::num_piramide == 6 ? 270 : 0;
|
||||||
int cy = this->info->num_piramide == 6 ? 50 : 0;
|
int cy = info::num_piramide == 6 ? 50 : 0;
|
||||||
|
|
||||||
for( int i = 0; i < 16; i++ ) {
|
for( int i = 0; i < 16; i++ ) {
|
||||||
this->tombes[i].contingut = contingut;
|
this->tombes[i].contingut = contingut;
|
||||||
@@ -182,7 +181,7 @@ void Mapa::preparaTombes() {
|
|||||||
this->tombes[i].x = cx;
|
this->tombes[i].x = cx;
|
||||||
this->tombes[i].y = cy;
|
this->tombes[i].y = cy;
|
||||||
}
|
}
|
||||||
if (this->info->num_piramide == 6) return;
|
if (info::num_piramide == 6) return;
|
||||||
this->tombes[0].contingut = CONTE_FARAO;
|
this->tombes[0].contingut = CONTE_FARAO;
|
||||||
this->tombes[1].contingut = CONTE_CLAU;
|
this->tombes[1].contingut = CONTE_CLAU;
|
||||||
this->tombes[2].contingut = CONTE_PERGAMI;
|
this->tombes[2].contingut = CONTE_PERGAMI;
|
||||||
@@ -254,7 +253,7 @@ void Mapa::comprovaCaixa( Uint8 num )
|
|||||||
break;
|
break;
|
||||||
case CONTE_TRESOR:
|
case CONTE_TRESOR:
|
||||||
this->tombes[num].x = 100;
|
this->tombes[num].x = 100;
|
||||||
info->diners++;
|
info::diners++;
|
||||||
break;
|
break;
|
||||||
case CONTE_FARAO:
|
case CONTE_FARAO:
|
||||||
this->tombes[num].x = 150;
|
this->tombes[num].x = 150;
|
||||||
@@ -274,9 +273,9 @@ void Mapa::comprovaCaixa( Uint8 num )
|
|||||||
break;
|
break;
|
||||||
case CONTE_DIAMANT:
|
case CONTE_DIAMANT:
|
||||||
this->tombes[num].y = 70;
|
this->tombes[num].y = 70;
|
||||||
info->diamants++;
|
info::diamants++;
|
||||||
info->diners += VALOR_DIAMANT;
|
info::diners += VALOR_DIAMANT;
|
||||||
if (info->diamants == 16) this->farao = this->clau = true;
|
if (info::diamants == 16) this->farao = this->clau = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
mapa.h
3
mapa.h
@@ -30,7 +30,7 @@ class Mapa {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Mapa( JD8_Surface gfx, Info* info, Prota* sam );
|
Mapa( JD8_Surface gfx, Prota* sam );
|
||||||
~Mapa(void);
|
~Mapa(void);
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
@@ -52,7 +52,6 @@ protected:
|
|||||||
JD8_Surface fondo;
|
JD8_Surface fondo;
|
||||||
Vertex vertex;
|
Vertex vertex;
|
||||||
Vertex ultim_vertex;
|
Vertex ultim_vertex;
|
||||||
Info* info;
|
|
||||||
Uint8 frame_torxes;
|
Uint8 frame_torxes;
|
||||||
|
|
||||||
Prota* sam;
|
Prota* sam;
|
||||||
|
|||||||
20
marcador.cpp
20
marcador.cpp
@@ -1,11 +1,9 @@
|
|||||||
#include "marcador.h"
|
#include "marcador.h"
|
||||||
|
|
||||||
Marcador::Marcador( JD8_Surface gfx, Info* info, Prota* sam ) {
|
Marcador::Marcador( JD8_Surface gfx, Prota* sam ) {
|
||||||
|
|
||||||
this->gfx = gfx;
|
this->gfx = gfx;
|
||||||
this->info = info;
|
|
||||||
this->sam = sam;
|
this->sam = sam;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Marcador::~Marcador(void) {
|
Marcador::~Marcador(void) {
|
||||||
@@ -13,19 +11,19 @@ Marcador::~Marcador(void) {
|
|||||||
|
|
||||||
void Marcador::draw() {
|
void Marcador::draw() {
|
||||||
|
|
||||||
if (this->info->num_piramide < 6) {
|
if (info::num_piramide < 6) {
|
||||||
this->pintaNumero(55, 2, this->info->num_piramide);
|
this->pintaNumero(55, 2, info::num_piramide);
|
||||||
this->pintaNumero(80, 2, this->info->num_habitacio);
|
this->pintaNumero(80, 2, info::num_habitacio);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->pintaNumero( 149, 2, this->info->diners / 100 );
|
this->pintaNumero( 149, 2, info::diners / 100 );
|
||||||
this->pintaNumero( 156, 2, ( this->info->diners % 100 ) / 10 );
|
this->pintaNumero( 156, 2, ( info::diners % 100 ) / 10 );
|
||||||
this->pintaNumero( 163, 2, this->info->diners % 10 );
|
this->pintaNumero( 163, 2, info::diners % 10 );
|
||||||
|
|
||||||
if( this->sam->pergami ) JD8_BlitCK( 190, 1, this->gfx, 209, 185, 15, 14, 255 );
|
if( this->sam->pergami ) JD8_BlitCK( 190, 1, this->gfx, 209, 185, 15, 14, 255 );
|
||||||
|
|
||||||
JD8_BlitCK( 271, 1, this->gfx, 0, 20, 15, this->info->vida*3, 255 );
|
JD8_BlitCK( 271, 1, this->gfx, 0, 20, 15, info::vida*3, 255 );
|
||||||
if( this->info->vida < 5 ) JD8_BlitCK( 271, 1+(this->info->vida*3), this->gfx, 75, 20, 15, 15-(this->info->vida*3), 255 );
|
if( info::vida < 5 ) JD8_BlitCK( 271, 1+(info::vida*3), this->gfx, 75, 20, 15, 15-(info::vida*3), 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Marcador::pintaNumero( Uint16 x, Uint16 y, Uint8 num ) {
|
void Marcador::pintaNumero( Uint16 x, Uint16 y, Uint8 num ) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class Marcador {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Marcador( JD8_Surface gfx, Info* info, Prota* sam );
|
Marcador( JD8_Surface gfx, Prota* sam );
|
||||||
~Marcador(void);
|
~Marcador(void);
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
@@ -18,7 +18,6 @@ protected:
|
|||||||
void pintaNumero( Uint16 x, Uint16 y, Uint8 num );
|
void pintaNumero( Uint16 x, Uint16 y, Uint8 num );
|
||||||
|
|
||||||
JD8_Surface gfx;
|
JD8_Surface gfx;
|
||||||
Info* info;
|
|
||||||
Prota* sam;
|
Prota* sam;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,18 +6,16 @@
|
|||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
#include "jfile.h"
|
#include "jfile.h"
|
||||||
|
|
||||||
ModuleGame::ModuleGame( Info* info ) {
|
ModuleGame::ModuleGame() {
|
||||||
|
|
||||||
this->info = info;
|
this->gfx = JD8_LoadSurface( info::pepe_activat ? "frames2.gif" : "frames.gif" );
|
||||||
|
|
||||||
this->gfx = JD8_LoadSurface( this->info->pepe_activat ? "frames2.gif" : "frames.gif" );
|
|
||||||
JG_SetUpdateTicks(10);
|
JG_SetUpdateTicks(10);
|
||||||
|
|
||||||
this->sam = new Prota( this->gfx, this->info );
|
this->sam = new Prota( this->gfx );
|
||||||
this->mapa = new Mapa( this->gfx, this->info, this->sam );
|
this->mapa = new Mapa( this->gfx, this->sam );
|
||||||
this->marcador = new Marcador( this->gfx, this->info, this->sam );
|
this->marcador = new Marcador( this->gfx, this->sam );
|
||||||
if( this->info->num_piramide == 2 ) {
|
if( info::num_piramide == 2 ) {
|
||||||
this->bola = new Bola( this->gfx, this->info, this->sam );
|
this->bola = new Bola( this->gfx, this->sam );
|
||||||
} else {
|
} else {
|
||||||
this->bola = NULL;
|
this->bola = NULL;
|
||||||
}
|
}
|
||||||
@@ -49,7 +47,7 @@ int ModuleGame::Go() {
|
|||||||
|
|
||||||
this->Draw();
|
this->Draw();
|
||||||
|
|
||||||
const char* music = this->info->num_piramide == 3 ? "00000008.ogg" : (this->info->num_piramide == 2 ? "00000007.ogg" : (this->info->num_piramide == 6 ? "00000002.ogg" : "00000006.ogg"));
|
const char* music = info::num_piramide == 3 ? "00000008.ogg" : (info::num_piramide == 2 ? "00000007.ogg" : (info::num_piramide == 6 ? "00000002.ogg" : "00000006.ogg"));
|
||||||
const char *current_music = JA_GetMusicFilename();
|
const char *current_music = JA_GetMusicFilename();
|
||||||
if ( (JA_GetMusicState()!=JA_MUSIC_PLAYING) || !(strcmp(music, current_music) == 0)) {
|
if ( (JA_GetMusicState()!=JA_MUSIC_PLAYING) || !(strcmp(music, current_music) == 0)) {
|
||||||
int size;
|
int size;
|
||||||
@@ -57,7 +55,7 @@ int ModuleGame::Go() {
|
|||||||
JA_PlayMusic(JA_LoadMusic((Uint8*)buffer, size, music));
|
JA_PlayMusic(JA_LoadMusic((Uint8*)buffer, size, music));
|
||||||
}
|
}
|
||||||
|
|
||||||
JD8_FadeToPal( JD8_LoadPalette(this->info->pepe_activat ? "frames2.gif" : "frames.gif") );
|
JD8_FadeToPal( JD8_LoadPalette(info::pepe_activat ? "frames2.gif" : "frames.gif") );
|
||||||
|
|
||||||
while (this->final == 0 && !JG_Quitting()) {
|
while (this->final == 0 && !JG_Quitting()) {
|
||||||
|
|
||||||
@@ -68,20 +66,20 @@ int ModuleGame::Go() {
|
|||||||
//JS_FadeOutMusic();
|
//JS_FadeOutMusic();
|
||||||
|
|
||||||
if( this->final == 1 ) {
|
if( this->final == 1 ) {
|
||||||
this->info->num_habitacio++;
|
info::num_habitacio++;
|
||||||
if( this->info->num_habitacio == 6 ) {
|
if( info::num_habitacio == 6 ) {
|
||||||
this->info->num_habitacio = 1;
|
info::num_habitacio = 1;
|
||||||
this->info->num_piramide++;
|
info::num_piramide++;
|
||||||
}
|
}
|
||||||
if (this->info->num_piramide == 6 && this->info->num_habitacio == 2) this->info->num_piramide++;
|
if (info::num_piramide == 6 && info::num_habitacio == 2) info::num_piramide++;
|
||||||
} else if (this->final == 2) {
|
} else if (this->final == 2) {
|
||||||
this->info->num_piramide = 100;
|
info::num_piramide = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( JG_Quitting() ) {
|
if( JG_Quitting() ) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if (this->info->num_habitacio == 1 || this->info->num_piramide == 100 || this->info->num_piramide == 7) {
|
if (info::num_habitacio == 1 || info::num_piramide == 100 || info::num_piramide == 7) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -109,27 +107,27 @@ void ModuleGame::Update() {
|
|||||||
Momia* seguent = this->momies->next;
|
Momia* seguent = this->momies->next;
|
||||||
delete this->momies;
|
delete this->momies;
|
||||||
this->momies = seguent;
|
this->momies = seguent;
|
||||||
this->info->momies--;
|
info::momies--;
|
||||||
}
|
}
|
||||||
if( this->bola != NULL ) this->bola->update();
|
if( this->bola != NULL ) this->bola->update();
|
||||||
this->mapa->update();
|
this->mapa->update();
|
||||||
if( this->mapa->novaMomia() ) {
|
if( this->mapa->novaMomia() ) {
|
||||||
if( this->momies != NULL ) {
|
if( this->momies != NULL ) {
|
||||||
this->momies->insertar( new Momia( this->gfx, this->info, true, 0, 0, this->sam ) );
|
this->momies->insertar( new Momia( this->gfx, true, 0, 0, this->sam ) );
|
||||||
this->info->momies++;
|
info::momies++;
|
||||||
} else {
|
} else {
|
||||||
this->momies = new Momia( this->gfx, this->info, true, 0, 0, this->sam );
|
this->momies = new Momia( this->gfx, true, 0, 0, this->sam );
|
||||||
this->info->momies++;
|
info::momies++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( JI_CheatActivated( "reviu" ) ) this->info->vida = 5;
|
if( JI_CheatActivated( "reviu" ) ) info::vida = 5;
|
||||||
if( JI_CheatActivated( "alone" ) ) {
|
if( JI_CheatActivated( "alone" ) ) {
|
||||||
if( this->momies != NULL ) {
|
if( this->momies != NULL ) {
|
||||||
this->momies->clear();
|
this->momies->clear();
|
||||||
delete this->momies;
|
delete this->momies;
|
||||||
this->momies = NULL;
|
this->momies = NULL;
|
||||||
this->info->momies = 0;
|
info::momies = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( JI_CheatActivated( "obert" ) ) {
|
if( JI_CheatActivated( "obert" ) ) {
|
||||||
@@ -150,17 +148,17 @@ void ModuleGame::Update() {
|
|||||||
|
|
||||||
void ModuleGame::iniciarMomies() {
|
void ModuleGame::iniciarMomies() {
|
||||||
|
|
||||||
if( this->info->num_habitacio == 1 ) { this->info->momies = 1; } else { this->info->momies++; }
|
if( info::num_habitacio == 1 ) { info::momies = 1; } else { info::momies++; }
|
||||||
if (this->info->num_piramide == 6) this->info->momies = 8;
|
if (info::num_piramide == 6) info::momies = 8;
|
||||||
|
|
||||||
int x = 20;
|
int x = 20;
|
||||||
int y = 170;
|
int y = 170;
|
||||||
bool dimonis = this->info->num_piramide == 6;
|
bool dimonis = info::num_piramide == 6;
|
||||||
for( int i = 0; i < info->momies; i++ ) {
|
for( int i = 0; i < info::momies; i++ ) {
|
||||||
if( this->momies == NULL) {
|
if( this->momies == NULL) {
|
||||||
this->momies = new Momia( this->gfx, this->info, dimonis, x, y, this->sam );
|
this->momies = new Momia( this->gfx, dimonis, x, y, this->sam );
|
||||||
} else {
|
} else {
|
||||||
this->momies->insertar( new Momia( this->gfx, this->info, dimonis, x, y, this->sam ) );
|
this->momies->insertar( new Momia( this->gfx, dimonis, x, y, this->sam ) );
|
||||||
}
|
}
|
||||||
x += 65;
|
x += 65;
|
||||||
if( x == 345 ) { x = 20; y -= 35; }
|
if( x == 345 ) { x = 20; y -= 35; }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ModuleGame {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ModuleGame( Info* info );
|
ModuleGame();
|
||||||
~ModuleGame(void);
|
~ModuleGame(void);
|
||||||
|
|
||||||
int Go();
|
int Go();
|
||||||
@@ -24,7 +24,6 @@ private:
|
|||||||
void iniciarMomies();
|
void iniciarMomies();
|
||||||
|
|
||||||
Uint8 final;
|
Uint8 final;
|
||||||
Info* info;
|
|
||||||
JD8_Surface gfx;
|
JD8_Surface gfx;
|
||||||
|
|
||||||
Mapa* mapa;
|
Mapa* mapa;
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
ModuleSequence::ModuleSequence( Info* info ) {
|
ModuleSequence::ModuleSequence() {
|
||||||
this->info = info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleSequence::~ModuleSequence(void) {
|
ModuleSequence::~ModuleSequence(void) {
|
||||||
@@ -17,9 +16,9 @@ ModuleSequence::~ModuleSequence(void) {
|
|||||||
|
|
||||||
int ModuleSequence::Go() {
|
int ModuleSequence::Go() {
|
||||||
|
|
||||||
if( this->info->num_piramide == 6 && this->info->diners < 200 ) this->info->num_piramide = 7;
|
if( info::num_piramide == 6 && info::diners < 200 ) info::num_piramide = 7;
|
||||||
|
|
||||||
switch( this->info->num_piramide ) {
|
switch( info::num_piramide ) {
|
||||||
case 255: // Intro
|
case 255: // Intro
|
||||||
doIntro();
|
doIntro();
|
||||||
break;
|
break;
|
||||||
@@ -52,22 +51,22 @@ int ModuleSequence::Go() {
|
|||||||
if( JG_Quitting() ) {
|
if( JG_Quitting() ) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if( this->info->num_piramide == 255 ) {
|
if( info::num_piramide == 255 ) {
|
||||||
this->info->num_piramide = 0;
|
info::num_piramide = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else if( this->info->num_piramide == 0 ) {
|
} else if( info::num_piramide == 0 ) {
|
||||||
this->info->num_piramide = 1;
|
info::num_piramide = 1;
|
||||||
//this->info->num_piramide = 6;
|
//info::num_piramide = 6;
|
||||||
//this->info->diners = 200;
|
//info::diners = 200;
|
||||||
return 1;
|
return 1;
|
||||||
} else if( this->info->num_piramide == 7 ) {
|
} else if( info::num_piramide == 7 ) {
|
||||||
this->info->num_piramide = 8;
|
info::num_piramide = 8;
|
||||||
return 1;
|
return 1;
|
||||||
} else if( this->info->num_piramide == 8 ) {
|
} else if( info::num_piramide == 8 ) {
|
||||||
this->info->num_piramide = 255;
|
info::num_piramide = 255;
|
||||||
return 1;
|
return 1;
|
||||||
} else if( this->info->num_piramide == 100 ) {
|
} else if( info::num_piramide == 100 ) {
|
||||||
this->info->num_piramide = 0;
|
info::num_piramide = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -620,7 +619,7 @@ void ModuleSequence::doMenu() {
|
|||||||
JD8_BlitCK( 303, 193, gfx, 305, 143, 15, 5, 255 ); // versio
|
JD8_BlitCK( 303, 193, gfx, 305, 143, 15, 5, 255 ); // versio
|
||||||
|
|
||||||
if( contador%100 > 30 ) JD8_BlitCK( 98, 130, gfx, 161, 92, 127, 9, 255 ); // pulsa tecla...
|
if( contador%100 > 30 ) JD8_BlitCK( 98, 130, gfx, 161, 92, 127, 9, 255 ); // pulsa tecla...
|
||||||
if ((contador % 100 > 30) && this->info->nou_personatge) JD8_BlitCK(68, 141, gfx, 128, 105, 189, 9, 255); // 'p' per a personatge nou...
|
if ((contador % 100 > 30) && info::nou_personatge) JD8_BlitCK(68, 141, gfx, 128, 105, 189, 9, 255); // 'p' per a personatge nou...
|
||||||
|
|
||||||
JD8_Flip();
|
JD8_Flip();
|
||||||
|
|
||||||
@@ -632,7 +631,7 @@ void ModuleSequence::doMenu() {
|
|||||||
JI_Update();
|
JI_Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->info->pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
|
info::pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
|
||||||
JI_DisableKeyboard(60);
|
JI_DisableKeyboard(60);
|
||||||
JD8_FreeSurface( fondo );
|
JD8_FreeSurface( fondo );
|
||||||
JD8_FreeSurface( gfx );
|
JD8_FreeSurface( gfx );
|
||||||
@@ -644,9 +643,9 @@ void ModuleSequence::doSlides() {
|
|||||||
|
|
||||||
|
|
||||||
const char* arxiu;
|
const char* arxiu;
|
||||||
if( this->info->num_piramide == 7 ) {
|
if( info::num_piramide == 7 ) {
|
||||||
play_music("00000005.ogg", 1);
|
play_music("00000005.ogg", 1);
|
||||||
if (this->info->diners < 200) {
|
if (info::diners < 200) {
|
||||||
arxiu = "intro2.gif";
|
arxiu = "intro2.gif";
|
||||||
} else {
|
} else {
|
||||||
arxiu = "intro3.gif";
|
arxiu = "intro3.gif";
|
||||||
@@ -706,7 +705,7 @@ void ModuleSequence::doSlides() {
|
|||||||
step++;
|
step++;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (this->info->num_piramide != 7) JA_FadeOutMusic(250);
|
if (info::num_piramide != 7) JA_FadeOutMusic(250);
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -730,7 +729,7 @@ void ModuleSequence::doBanner() {
|
|||||||
JD8_Blit( 81, 24, gfx, 81, 155, 168, 21 );
|
JD8_Blit( 81, 24, gfx, 81, 155, 168, 21 );
|
||||||
JD8_Blit( 39, 150, gfx, 39, 175, 248, 20 );
|
JD8_Blit( 39, 150, gfx, 39, 175, 248, 20 );
|
||||||
|
|
||||||
switch( this->info->num_piramide ) {
|
switch( info::num_piramide ) {
|
||||||
case 2:
|
case 2:
|
||||||
JD8_Blit( 82, 60, gfx, 0, 0, 160, 75 );
|
JD8_Blit( 82, 60, gfx, 0, 0, 160, 75 );
|
||||||
break;
|
break;
|
||||||
@@ -885,7 +884,7 @@ void ModuleSequence::doCredits() {
|
|||||||
JD8_BlitCK(100, 20, vaddr2, 85, 0, 120, 140, 0);
|
JD8_BlitCK(100, 20, vaddr2, 85, 0, 120, 140, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->info->diamants == 16) {
|
if (info::diamants == 16) {
|
||||||
//scroll_final_joc(vaddr3, vaddr, contador_final);
|
//scroll_final_joc(vaddr3, vaddr, contador_final);
|
||||||
JD8_BlitCKScroll(50, vaddr3, ((contador >> 3) % 320) + 1, 0, 50, 255);
|
JD8_BlitCKScroll(50, vaddr3, ((contador >> 3) % 320) + 1, 0, 50, 255);
|
||||||
JD8_BlitCKScroll(50, vaddr3, ((contador >> 2) % 320) + 1, 50, 50, 255);
|
JD8_BlitCKScroll(50, vaddr3, ((contador >> 2) % 320) + 1, 50, 50, 255);
|
||||||
@@ -909,7 +908,7 @@ void ModuleSequence::doCredits() {
|
|||||||
FILE* ini = fopen("trick.ini", "wb");
|
FILE* ini = fopen("trick.ini", "wb");
|
||||||
fwrite("1", 1, 1, ini);
|
fwrite("1", 1, 1, ini);
|
||||||
fclose(ini);
|
fclose(ini);
|
||||||
this->info->nou_personatge = true;
|
info::nou_personatge = true;
|
||||||
|
|
||||||
JD8_FreeSurface(vaddr3);
|
JD8_FreeSurface(vaddr3);
|
||||||
JD8_FreeSurface(vaddr2);
|
JD8_FreeSurface(vaddr2);
|
||||||
@@ -920,7 +919,7 @@ void ModuleSequence::doMort() {
|
|||||||
|
|
||||||
JI_DisableKeyboard(60);
|
JI_DisableKeyboard(60);
|
||||||
|
|
||||||
this->info->vida = 5;
|
info::vida = 5;
|
||||||
this->contador = 1000;
|
this->contador = 1000;
|
||||||
|
|
||||||
JD8_Surface gfx = JD8_LoadSurface( "gameover.gif" );
|
JD8_Surface gfx = JD8_LoadSurface( "gameover.gif" );
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class ModuleSequence {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ModuleSequence( Info* info );
|
ModuleSequence();
|
||||||
~ModuleSequence(void);
|
~ModuleSequence(void);
|
||||||
|
|
||||||
int Go();
|
int Go();
|
||||||
@@ -21,6 +21,5 @@ private:
|
|||||||
void doCredits();
|
void doCredits();
|
||||||
void doMort();
|
void doMort();
|
||||||
|
|
||||||
Info* info;
|
|
||||||
int contador;
|
int contador;
|
||||||
};
|
};
|
||||||
|
|||||||
15
momia.cpp
15
momia.cpp
@@ -2,8 +2,7 @@
|
|||||||
#include "jgame.h"
|
#include "jgame.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Momia::Momia( JD8_Surface gfx, Info* info, bool dimoni, Uint16 x, Uint16 y, Prota* sam ) : Sprite( gfx ) {
|
Momia::Momia( JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam ) : Sprite( gfx ) {
|
||||||
this->info = info;
|
|
||||||
this->dimoni = dimoni;
|
this->dimoni = dimoni;
|
||||||
this->sam = sam;
|
this->sam = sam;
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ Momia::Momia( JD8_Surface gfx, Info* info, bool dimoni, Uint16 x, Uint16 y, Prot
|
|||||||
for( int x = 0; x < 5; x++ ) {
|
for( int x = 0; x < 5; x++ ) {
|
||||||
this->entitat->frames[frame].w = 15;
|
this->entitat->frames[frame].w = 15;
|
||||||
this->entitat->frames[frame].h = 15;
|
this->entitat->frames[frame].h = 15;
|
||||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||||
this->entitat->frames[frame].x = (x*15)+75;
|
this->entitat->frames[frame].x = (x*15)+75;
|
||||||
if( this->dimoni ) this->entitat->frames[frame].x += 75;
|
if( this->dimoni ) this->entitat->frames[frame].x += 75;
|
||||||
this->entitat->frames[frame].y = 20+(y*15);
|
this->entitat->frames[frame].y = 20+(y*15);
|
||||||
@@ -83,7 +82,7 @@ void Momia::draw() {
|
|||||||
|
|
||||||
Sprite::draw();
|
Sprite::draw();
|
||||||
|
|
||||||
if( this->info->num_piramide == 4 ) {
|
if( info::num_piramide == 4 ) {
|
||||||
if( ( JG_GetCycleCounter() % 40 ) < 20 ) {
|
if( ( JG_GetCycleCounter() % 40 ) < 20 ) {
|
||||||
JD8_BlitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255 );
|
JD8_BlitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255 );
|
||||||
} else {
|
} else {
|
||||||
@@ -104,7 +103,7 @@ bool Momia::update() {
|
|||||||
this->engendro = NULL;
|
this->engendro = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( this->sam->o < 4 && ( this->dimoni || this->info->num_piramide == 5 || JG_GetCycleCounter()%2 == 0 ) ) {
|
if( this->sam->o < 4 && ( this->dimoni || info::num_piramide == 5 || JG_GetCycleCounter()%2 == 0 ) ) {
|
||||||
|
|
||||||
if( ( this->x - 20 ) % 65 == 0 && ( this->y - 30 ) % 35 == 0 ) {
|
if( ( this->x - 20 ) % 65 == 0 && ( this->y - 30 ) % 35 == 0 ) {
|
||||||
if( this->dimoni ) {
|
if( this->dimoni ) {
|
||||||
@@ -149,8 +148,8 @@ bool Momia::update() {
|
|||||||
if( this->sam->pergami ) {
|
if( this->sam->pergami ) {
|
||||||
this->sam->pergami = false;
|
this->sam->pergami = false;
|
||||||
} else {
|
} else {
|
||||||
this->info->vida--;
|
info::vida--;
|
||||||
if( this->info->vida == 0 ) this->sam->o = 5;
|
if( info::vida == 0 ) this->sam->o = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,7 +160,7 @@ bool Momia::update() {
|
|||||||
Momia* seguent = this->next->next;
|
Momia* seguent = this->next->next;
|
||||||
delete this->next;
|
delete this->next;
|
||||||
this->next = seguent;
|
this->next = seguent;
|
||||||
this->info->momies--;
|
info::momies--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
momia.h
3
momia.h
@@ -9,7 +9,7 @@ class Momia : public Sprite {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Momia( JD8_Surface gfx, Info* info, bool dimoni, Uint16 x, Uint16 y, Prota* sam );
|
Momia( JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam );
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void draw();
|
void draw();
|
||||||
@@ -22,7 +22,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
Prota* sam;
|
Prota* sam;
|
||||||
Info* info;
|
|
||||||
Engendro* engendro;
|
Engendro* engendro;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
11
prota.cpp
11
prota.cpp
@@ -3,8 +3,7 @@
|
|||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
Prota::Prota( JD8_Surface gfx ) : Sprite( gfx ) {
|
||||||
this->info = info;
|
|
||||||
|
|
||||||
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
|
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
|
||||||
this->entitat->num_frames = 82;
|
this->entitat->num_frames = 82;
|
||||||
@@ -14,7 +13,7 @@ Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
|||||||
for( int x = 0; x < 5; x++ ) {
|
for( int x = 0; x < 5; x++ ) {
|
||||||
this->entitat->frames[frame].w = 15;
|
this->entitat->frames[frame].w = 15;
|
||||||
this->entitat->frames[frame].h = 15;
|
this->entitat->frames[frame].h = 15;
|
||||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||||
this->entitat->frames[frame].x = x*15;
|
this->entitat->frames[frame].x = x*15;
|
||||||
this->entitat->frames[frame].y = 20+(y*15);
|
this->entitat->frames[frame].y = 20+(y*15);
|
||||||
frame++;
|
frame++;
|
||||||
@@ -26,7 +25,7 @@ Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
|||||||
if( x != 300 || y != 155 ) {
|
if( x != 300 || y != 155 ) {
|
||||||
this->entitat->frames[frame].w = 15;
|
this->entitat->frames[frame].w = 15;
|
||||||
this->entitat->frames[frame].h = 30;
|
this->entitat->frames[frame].h = 30;
|
||||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||||
this->entitat->frames[frame].x = x;
|
this->entitat->frames[frame].x = x;
|
||||||
this->entitat->frames[frame].y = y;
|
this->entitat->frames[frame].y = y;
|
||||||
frame++;
|
frame++;
|
||||||
@@ -37,7 +36,7 @@ Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
|||||||
for( int x = 225; x < 315; x+=15 ) {
|
for( int x = 225; x < 315; x+=15 ) {
|
||||||
this->entitat->frames[frame].w = 15;
|
this->entitat->frames[frame].w = 15;
|
||||||
this->entitat->frames[frame].h = 15;
|
this->entitat->frames[frame].h = 15;
|
||||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||||
this->entitat->frames[frame].x = x;
|
this->entitat->frames[frame].x = x;
|
||||||
this->entitat->frames[frame].y = y;
|
this->entitat->frames[frame].y = y;
|
||||||
frame++;
|
frame++;
|
||||||
@@ -80,7 +79,7 @@ void Prota::draw() {
|
|||||||
|
|
||||||
Sprite::draw();
|
Sprite::draw();
|
||||||
|
|
||||||
if( this->info->num_piramide == 4 && this->o != 4) {
|
if( info::num_piramide == 4 && this->o != 4) {
|
||||||
if( ( JG_GetCycleCounter() % 40 ) < 20 ) {
|
if( ( JG_GetCycleCounter() % 40 ) < 20 ) {
|
||||||
JD8_BlitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255 );
|
JD8_BlitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255 );
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user