From 2d617c017f47805e2b2678e26276610aa2df3cf6 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 22 Feb 2016 20:04:18 +0100 Subject: [PATCH] [BROKEN] Segguint treballant en els credits --- jdraw8.cpp | 14 ++++++- jdraw8.h | 2 + modulesequence.cpp | 102 ++++++++++++++++----------------------------- 3 files changed, 51 insertions(+), 67 deletions(-) diff --git a/jdraw8.cpp b/jdraw8.cpp index e128a0c..1a6e0a1 100755 --- a/jdraw8.cpp +++ b/jdraw8.cpp @@ -121,7 +121,19 @@ void JD8_BlitCK(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int s } } -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_BlitCKCut(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, Uint8 colorkey) { + int src_pointer = sx + (sy * 320); + 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]; + } + src_pointer += 320; + dst_pointer += 320; + } +} + +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); for( int j = 0; j < sh; j++ ) { diff --git a/jdraw8.h b/jdraw8.h index 38730fe..d42438c 100755 --- a/jdraw8.h +++ b/jdraw8.h @@ -32,6 +32,8 @@ void JD8_BlitToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw void JD8_BlitCK(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, Uint8 colorkey ); +void JD8_BlitCKCut(int x, int y, JD8_Surface surface, int sx, int sy, int sw, 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(); diff --git a/modulesequence.cpp b/modulesequence.cpp index ec5d70e..921c970 100755 --- a/modulesequence.cpp +++ b/modulesequence.cpp @@ -56,7 +56,8 @@ int ModuleSequence::Go() { this->info->num_piramide = 0; return 1; } else if( this->info->num_piramide == 0 ) { - 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; @@ -632,9 +633,12 @@ void ModuleSequence::doMenu() { void ModuleSequence::doSlides() { JG_SetUpdateTicks(20); + const char* arxiu; if( this->info->num_piramide == 7 ) { - if( this->info->diners < 200 ) { + JS_LoadMusic("00000005.xm"); + JS_PlayMusic(1); + if (this->info->diners < 200) { arxiu = "intro2.gif"; } else { arxiu = "intro3.gif"; @@ -694,7 +698,7 @@ void ModuleSequence::doSlides() { step++; break; case 8: - JS_FadeOutMusic(); + if (this->info->num_piramide != 7) JS_FadeOutMusic(); exit = true; break; } @@ -841,77 +845,43 @@ void ModuleSequence::doSecreta() { void ModuleSequence::doCredits() { + JD8_ClearScreen(0); + JD8_Surface vaddr2 = JD8_LoadSurface("final.gif"); + JD8_Surface vaddr3 = JD8_LoadSurface("finals.gif"); + JD8_Palette pal = JD8_LoadPalette("final.gif"); + JD8_SetScreenPalette(pal); + int contador = 0; - procedure final_del_joc(num:byte); - var contador_final : word; -fich: file of byte; temp: byte; - begin - - final_de_la_partida : = true; - - fadedown(0, 0, 0, 1); - - espera_VGA; - cls(0, VGA); - - ini_midi(musica_final_joc); - if midi then Playmidi; - - intro(vaddr3, vaddr, num); - - load_mif(pcx_finals, vaddr3); - load_mif(pcx_final, vaddr2); - - cls(0, vaddr); -contador_final: = 0; - repeat - - inc(contador_final); - cls(0, vaddr); - - if contador_final<2000 then Put_Sprite_ICE_baix(vaddr2, vaddr, 0, 0, 80, 200, 115, 200 - (contador_final div 10)) - else if contador_final<2750 then Put_Sprite_ICE_dalt(vaddr2, vaddr, 0, 0, 80, 200, 115, 200 - (contador_final div 10)); - - if (contador_final>2000) and(contador_final<3800) then - Put_Sprite_ICE_baix(vaddr2, vaddr, 85, 0, 120, 140, 100, 200 - ((contador_final - 2000) div 10)) - else if contador_final >= 3750 then Put_Sprite_ICE_baix(vaddr2, vaddr, 85, 0, 120, 140, 100, 20); - - If tomba_secreta then - begin - scroll_final_joc(vaddr3, vaddr, contador_final); - Put_Sprite(vaddr2, vaddr, frames_coche[(contador_final div velocitat_coche)mod n_frames_coche], ample_coche, alt_coche, 100, 50); - end - else begin - Put_Sprite(vaddr3, vaddr, 0, 320, 50, 0, 50); - Put_Sprite(vaddr3, vaddr, 16000, 320, 50, 0, 50); - end; - - For i : = 0 to 16319 do mem[vaddr:i] : = 0; - For i : = 32000 to 35200 do mem[vaddr:i] : = 0; - - espera_VGA; - volcar32(vaddr, vga); - - until(TeclaPuls(KeyESC)) or(contador_final = 7000); - - if num = final_bo then - begin - Assign(fich, 'datos\graf.mif'); - Reset(fich); - seek(fich, FileSize(fich) - 1); -temp: = truco_on; - write(fich, temp); - Close(fich); - end; - - end; + bool exit = false; + int step = 0; + contador = 1; + while (!exit && !JG_Quitting()) { + if (JG_ShouldUpdate()) { + JI_Update(); + if (JI_AnyKey()) { + exit = true; + } + if (contador < 2750) { + JD8_BlitCKCut(115, 200 - (contador / 10), vaddr2, 0, 0, 80, 200, 255); + } + 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); + } + JD8_Flip(); + contador++; + } + } + JD8_FreeSurface(vaddr3); + JD8_FreeSurface(vaddr2); } void ModuleSequence::doMort() {