finals fets. Credits fets. Personatge secret fet
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -19,13 +19,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
||||
2
info.h
2
info.h
@@ -8,4 +8,6 @@ struct Info {
|
||||
int vida;
|
||||
int momies;
|
||||
int engendros;
|
||||
bool nou_personatge;
|
||||
bool pepe_activat;
|
||||
};
|
||||
|
||||
19
jdraw8.cpp
19
jdraw8.cpp
@@ -85,6 +85,12 @@ void JD8_SetScreenPalette(JD8_Palette palette) {
|
||||
main_palette = palette;
|
||||
}
|
||||
|
||||
void JD8_FillSquare(int ini, int height, Uint8 color) {
|
||||
const int offset = ini * 320;
|
||||
const int size = height * 320;
|
||||
memset(&screen[offset], color, size);
|
||||
}
|
||||
|
||||
void JD8_Blit(JD8_Surface surface) {
|
||||
memcpy( screen, surface, 64000 );
|
||||
}
|
||||
@@ -126,13 +132,24 @@ void JD8_BlitCKCut(int x, int y, JD8_Surface surface, int sx, int sy, int sw, in
|
||||
int dst_pointer = x + (y * 320);
|
||||
for (int j = 0; j < sh; j++) {
|
||||
for (int i = 0; i < sw; i++) {
|
||||
if (surface[src_pointer + i] != colorkey && (x+i >= 0) && (y+j >= 0) && (x+i < 320) && (y+i < 200)) screen[dst_pointer + i] = surface[src_pointer + i];
|
||||
if (surface[src_pointer + i] != colorkey && (x+i >= 0) && (y+j >= 0) && (x+i < 320) && (y+j < 200)) screen[dst_pointer + i] = surface[src_pointer + i];
|
||||
}
|
||||
src_pointer += 320;
|
||||
dst_pointer += 320;
|
||||
}
|
||||
}
|
||||
|
||||
void JD8_BlitCKScroll(int y, JD8_Surface surface, int sx, int sy, int sh, Uint8 colorkey) {
|
||||
int dst_pointer = y * 320;
|
||||
for (int j = sy; j < sy+sh; j++) {
|
||||
for (int i = 0; i < 320; i++) {
|
||||
int x = (i+sx) % 320;
|
||||
if (surface[x + j*320] != colorkey) screen[dst_pointer] = surface[x + j * 320];
|
||||
dst_pointer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JD8_BlitCKToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, JD8_Surface dest, Uint8 colorkey) {
|
||||
int src_pointer = sx + (sy*320);
|
||||
int dst_pointer = x + (y*320);
|
||||
|
||||
4
jdraw8.h
4
jdraw8.h
@@ -24,6 +24,8 @@ JD8_Palette JD8_LoadPalette(const char *file);
|
||||
|
||||
void JD8_SetScreenPalette(JD8_Palette palette);
|
||||
|
||||
void JD8_FillSquare(int ini, int height, Uint8 color);
|
||||
|
||||
void JD8_Blit(JD8_Surface surface);
|
||||
|
||||
void JD8_Blit(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh);
|
||||
@@ -34,6 +36,8 @@ void JD8_BlitCK(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int s
|
||||
|
||||
void JD8_BlitCKCut(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
||||
|
||||
void JD8_BlitCKScroll(int y, JD8_Surface surface, int sx, int sy, int sh, Uint8 colorkey);
|
||||
|
||||
void JD8_BlitCKToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, JD8_Surface dest, Uint8 colorkey );
|
||||
|
||||
void JD8_Flip();
|
||||
|
||||
8
main.cpp
8
main.cpp
@@ -41,6 +41,14 @@ int main( int argc, char* args[] ) {
|
||||
info.diamants = 0;
|
||||
info.vida = 5;
|
||||
info.momies = 0;
|
||||
info.nou_personatge = false;
|
||||
info.pepe_activat = false;
|
||||
|
||||
FILE* ini = fopen("trick.ini", "rb");
|
||||
if (ini != NULL) {
|
||||
info.nou_personatge = true;
|
||||
fclose(ini);
|
||||
}
|
||||
|
||||
int gameState = 1;
|
||||
|
||||
|
||||
@@ -10,10 +10,7 @@ ModuleGame::ModuleGame( Info* info ) {
|
||||
|
||||
this->info = info;
|
||||
|
||||
//this->info->num_piramide = 6;
|
||||
//this->info->diners = 200;
|
||||
|
||||
this->gfx = JD8_LoadSurface( "frames.gif" );
|
||||
this->gfx = JD8_LoadSurface( this->info->pepe_activat ? "frames2.gif" : "frames.gif" );
|
||||
JG_SetUpdateTicks(10);
|
||||
|
||||
this->sam = new Prota( this->gfx, this->info );
|
||||
@@ -58,7 +55,7 @@ int ModuleGame::Go() {
|
||||
JS_PlayMusic(-1);
|
||||
}
|
||||
|
||||
JD8_FadeToPal( JD8_LoadPalette( "frames.gif" ) );
|
||||
JD8_FadeToPal( JD8_LoadPalette(this->info->pepe_activat ? "frames2.gif" : "frames.gif") );
|
||||
|
||||
while (this->final == 0 && !JG_Quitting()) {
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ int ModuleSequence::Go() {
|
||||
break;
|
||||
case 1: // Slides
|
||||
case 7:
|
||||
//doSecreta();
|
||||
doSlides();
|
||||
break;
|
||||
case 2: // Pre-pir<69>mide
|
||||
@@ -56,8 +55,9 @@ int ModuleSequence::Go() {
|
||||
this->info->num_piramide = 0;
|
||||
return 1;
|
||||
} else if( this->info->num_piramide == 0 ) {
|
||||
this->info->num_piramide = 6;
|
||||
this->info->diners = 200;
|
||||
this->info->num_piramide = 1;
|
||||
//this->info->num_piramide = 6;
|
||||
//this->info->diners = 200;
|
||||
return 1;
|
||||
} else if( this->info->num_piramide == 7 ) {
|
||||
this->info->num_piramide = 8;
|
||||
@@ -596,7 +596,7 @@ void ModuleSequence::doMenu() {
|
||||
int camello = 0;
|
||||
|
||||
JI_Update();
|
||||
while( !JI_AnyKey() && !JG_Quitting() ) {
|
||||
while( !JI_AnyKey() && !JG_Quitting() && !JI_KeyPressed(SDL_SCANCODE_P)) {
|
||||
|
||||
JD8_Blit( 0, 0, fondo, 0, 0, 320, 100 ); // fondo sol estatic
|
||||
|
||||
@@ -613,6 +613,7 @@ void ModuleSequence::doMenu() {
|
||||
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) && this->info->nou_personatge) JD8_BlitCK(68, 141, gfx, 128, 105, 189, 9, 255); // 'p' per a personatge nou...
|
||||
|
||||
JD8_Flip();
|
||||
|
||||
@@ -624,7 +625,8 @@ void ModuleSequence::doMenu() {
|
||||
JI_Update();
|
||||
}
|
||||
}
|
||||
|
||||
this->info->pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
|
||||
JI_DisableKeyboard(60);
|
||||
JD8_FreeSurface( fondo );
|
||||
JD8_FreeSurface( gfx );
|
||||
free( pal );
|
||||
@@ -688,7 +690,7 @@ void ModuleSequence::doSlides() {
|
||||
case 4:
|
||||
case 7:
|
||||
contador--;
|
||||
if( contador == 1 ) step++;
|
||||
if (contador == -150) { contador = 0; step++; }
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
@@ -845,7 +847,9 @@ void ModuleSequence::doSecreta() {
|
||||
|
||||
void ModuleSequence::doCredits() {
|
||||
|
||||
JD8_ClearScreen(0);
|
||||
struct { Uint16 x, y; } frames_coche[8] = { { 214, 152 }, { 214, 104 }, { 214, 56 }, { 214, 104 }, { 214, 152 }, { 214, 8 }, { 108, 152 }, { 214, 8 } };
|
||||
const Uint32 n_frames_coche = 8;
|
||||
const Uint32 velocitat_coche = 3;
|
||||
|
||||
JD8_Surface vaddr2 = JD8_LoadSurface("final.gif");
|
||||
JD8_Surface vaddr3 = JD8_LoadSurface("finals.gif");
|
||||
@@ -861,25 +865,48 @@ void ModuleSequence::doCredits() {
|
||||
if (JG_ShouldUpdate()) {
|
||||
JI_Update();
|
||||
|
||||
if (JI_AnyKey()) {
|
||||
if (JI_AnyKey() || contador >= 3100) {
|
||||
exit = true;
|
||||
}
|
||||
|
||||
JD8_ClearScreen(255);
|
||||
|
||||
if (contador < 2750) {
|
||||
JD8_BlitCKCut(115, 200 - (contador / 10), vaddr2, 0, 0, 80, 200, 255);
|
||||
JD8_BlitCKCut(115, 200 - (contador / 6), vaddr2, 0, 0, 80, 200, 0);
|
||||
}
|
||||
|
||||
if ((contador > 2000) && (contador < 3800)) {
|
||||
JD8_BlitCKCut(100, 200 - ((contador-2000) / 10), vaddr2, 85, 0, 120, 140, 255);
|
||||
} else if (contador >= 3750) {
|
||||
JD8_BlitCK(100, 20, vaddr2, 85, 0, 120, 140, 255);
|
||||
if ((contador > 1200) && (contador < 2280)) {
|
||||
JD8_BlitCKCut(100, 200 - ((contador-1200) / 6), vaddr2, 85, 0, 120, 140, 0);
|
||||
} else if (contador >= 2250) {
|
||||
JD8_BlitCK(100, 20, vaddr2, 85, 0, 120, 140, 0);
|
||||
}
|
||||
|
||||
if (this->info->diamants == 16) {
|
||||
//scroll_final_joc(vaddr3, vaddr, contador_final);
|
||||
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 >> 1) % 320) + 1, 100, 50, 255);
|
||||
JD8_BlitCKScroll(50, vaddr3, (contador % 320) + 1, 150, 50, 255);
|
||||
|
||||
JD8_BlitCK(100, 50, vaddr2, frames_coche[(contador / velocitat_coche) % n_frames_coche].x, frames_coche[(contador / velocitat_coche) % n_frames_coche].y, 106, 48, 255);
|
||||
} else {
|
||||
JD8_BlitCK(0, 50, vaddr3, 0, 0, 320, 50, 255);
|
||||
JD8_BlitCK(0, 50, vaddr3, 0, 50, 320, 50, 255);
|
||||
}
|
||||
|
||||
JD8_FillSquare(0, 50, 255);
|
||||
JD8_FillSquare(100, 10, 255);
|
||||
|
||||
JD8_Flip();
|
||||
contador++;
|
||||
}
|
||||
}
|
||||
|
||||
FILE* ini = fopen("trick.ini", "wb");
|
||||
fwrite("1", 1, 1, ini);
|
||||
fclose(ini);
|
||||
this->info->nou_personatge = true;
|
||||
|
||||
JD8_FreeSurface(vaddr3);
|
||||
JD8_FreeSurface(vaddr2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user