diff --git a/examples/dogmole/dev/setenv.bat b/examples/dogmole/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/dogmole/dev/setenv.bat +++ b/examples/dogmole/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/dogmole_ci/dev/setenv.bat b/examples/dogmole_ci/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/dogmole_ci/dev/setenv.bat +++ b/examples/dogmole_ci/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/goddess/dev/setenv.bat b/examples/goddess/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/goddess/dev/setenv.bat +++ b/examples/goddess/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/goddess/dev/wyzplayer.h b/examples/goddess/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/examples/goddess/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/examples/goku_mal/dev/setenv.bat b/examples/goku_mal/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/goku_mal/dev/setenv.bat +++ b/examples/goku_mal/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/goku_mal/dev/wyzplayer.h b/examples/goku_mal/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/examples/goku_mal/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/examples/helmet/dev/setenv.bat b/examples/helmet/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/examples/helmet/dev/setenv.bat +++ b/examples/helmet/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/examples/helmet/dev/wyzplayer.h b/examples/helmet/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/examples/helmet/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/trash/6baddies/dev/lala_beta.tap b/trash/6baddies/dev/6baddies.tap similarity index 61% rename from trash/6baddies/dev/lala_beta.tap rename to trash/6baddies/dev/6baddies.tap index b0bef175..bec8da72 100644 Binary files a/trash/6baddies/dev/lala_beta.tap and b/trash/6baddies/dev/6baddies.tap differ diff --git a/trash/6baddies/dev/assets/levels.h b/trash/6baddies/dev/assets/levels.h index f2e45409..bd29b455 100644 --- a/trash/6baddies/dev/assets/levels.h +++ b/trash/6baddies/dev/assets/levels.h @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm diff --git a/trash/6baddies/dev/compile.bat b/trash/6baddies/dev/compile.bat index c170d20d..12afcaa0 100644 --- a/trash/6baddies/dev/compile.bat +++ b/trash/6baddies/dev/compile.bat @@ -2,7 +2,7 @@ if [%1]==[help] goto :help -set game=lala_beta +set game=6baddies if [%1]==[justcompile] goto :compile if [%1]==[clean] goto :clean @@ -66,7 +66,8 @@ rem cd ..\dev :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\utils\printsize.exe %game%.bin ..\utils\printsize.exe scripts.bin diff --git a/trash/6baddies/dev/crt.asm b/trash/6baddies/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/trash/6baddies/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/trash/6baddies/dev/definitions.h b/trash/6baddies/dev/definitions.h index 4203e824..38f3bd82 100644 --- a/trash/6baddies/dev/definitions.h +++ b/trash/6baddies/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -56,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -118,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; diff --git a/trash/6baddies/dev/engine/c_levels.h b/trash/6baddies/dev/engine/c_levels.h index 18b118a1..cbbaf91a 100644 --- a/trash/6baddies/dev/engine/c_levels.h +++ b/trash/6baddies/dev/engine/c_levels.h @@ -10,8 +10,8 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING @@ -27,8 +27,8 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels [level].map_w; - level_data->map_h = levels [level].map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/trash/6baddies/dev/engine/player.h b/trash/6baddies/dev/engine/player.h index 608bf647..59844d68 100644 --- a/trash/6baddies/dev/engine/player.h +++ b/trash/6baddies/dev/engine/player.h @@ -725,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -745,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } diff --git a/trash/6baddies/dev/mainloop.h b/trash/6baddies/dev/mainloop.h index 0fb64d7c..9875ead0 100644 --- a/trash/6baddies/dev/mainloop.h +++ b/trash/6baddies/dev/mainloop.h @@ -11,7 +11,7 @@ void main (void) { #asm di #endasm - + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); @@ -21,13 +21,14 @@ void main (void) { ei #endasm #endif - + #ifdef MODE_128K #ifdef USE_ARKOS_PLAYER arkos_stop(); #else wyz_init (); #endif + #endif cortina (); @@ -84,7 +85,7 @@ void main (void) { #ifdef MASKED_BULLETS sp_bullets [gpit] = sp_CreateSpr (sp_MASK_SPRITE, 2, sprite_19_a); #else - sp_bullets [gpit] = sp_CreateSpr (NO_MASKS, 2, sprite_19_a); + sp_bullets [gpit] = sp_CreateSpr (sp_OR_SPRITE, 2, sprite_19_a); #endif sp_AddColSpr (sp_bullets [gpit], sprite_19_a+32); } @@ -95,7 +96,7 @@ void main (void) { #ifdef MASKED_BULLETS sp_cocos [gpit] = sp_CreateSpr (sp_MASK_SPRITE, 2, sprite_19_a); #else - sp_cocos [gpit] = sp_CreateSpr (NO_MASKS, 2, sprite_19_a); + sp_cocos [gpit] = sp_CreateSpr (sp_OR_SPRITE, 2, sprite_19_a); #endif sp_AddColSpr (sp_cocos [gpit], sprite_19_a+32); } @@ -160,7 +161,7 @@ void main (void) { } silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY diff --git a/trash/6baddies/dev/mainloop/flick_screen.h b/trash/6baddies/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/trash/6baddies/dev/mainloop/flick_screen.h +++ b/trash/6baddies/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/trash/6baddies/dev/mainloop/game_loop.h b/trash/6baddies/dev/mainloop/game_loop.h index 1752797a..3f59e563 100644 --- a/trash/6baddies/dev/mainloop/game_loop.h +++ b/trash/6baddies/dev/mainloop/game_loop.h @@ -76,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif diff --git a/trash/6baddies/dev/my/fixed_screens.h b/trash/6baddies/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/trash/6baddies/dev/my/fixed_screens.h +++ b/trash/6baddies/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/trash/6baddies/dev/setenv.bat b/trash/6baddies/dev/setenv.bat index e034d8d5..a543b050 100644 --- a/trash/6baddies/dev/setenv.bat +++ b/trash/6baddies/dev/setenv.bat @@ -1,6 +1,5 @@ @echo off -set Z88DK_PATH=c:\z88dk10 -set PATH=%Z88DK_PATH%\bin;%PATH% +set Z88DK_PATH=c:\z88dk +set PATH=%Z88DK_PATH%\bin.x86;%PATH% set Z80_OZFILES=%Z88DK_PATH%\Lib\ set ZCCCFG=%Z88DK_PATH%\Lib\Config\ -zcc diff --git a/trash/6baddies/dev/zcc_opt.def b/trash/6baddies/dev/zcc_opt.def deleted file mode 100644 index 4548b859..00000000 --- a/trash/6baddies/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/trash/blip_blep/bin/ending.bin b/trash/blip_blep/bin/ending.bin new file mode 100644 index 00000000..e52dd56a Binary files /dev/null and b/trash/blip_blep/bin/ending.bin differ diff --git a/trash/blip_blep/bin/marco.bin b/trash/blip_blep/bin/marco.bin new file mode 100644 index 00000000..62123e85 Binary files /dev/null and b/trash/blip_blep/bin/marco.bin differ diff --git a/trash/blip_blep/bin/title.bin b/trash/blip_blep/bin/title.bin new file mode 100644 index 00000000..1c062e8b Binary files /dev/null and b/trash/blip_blep/bin/title.bin differ diff --git a/trash/blip_blep/dev/128k.h b/trash/blip_blep/dev/128k.h index 2f4b4b97..317fd7a2 100644 --- a/trash/blip_blep/dev/128k.h +++ b/trash/blip_blep/dev/128k.h @@ -6,99 +6,19 @@ void SetRAMBank(void) { #asm .SetRAMBank + ld a, b + or a + jp z, restISR + xor a + ld i, a + jp keepGoing + .restISR + ld a, $f0 + ld i, a + .keepGoing ld a, 16 or b ld bc, $7ffd out (C), a #endasm } -/* -// Esto lo empecé pero por ahora lo dejo aparcado :-/ -#ifdef MOVE_STUFF_TO_RAM_6 -typedef struct { - int x, y; - unsigned char x1, y1, x2, y2; - char mx, my; - char t; - unsigned char life; -} MALOTE; - -MALOTE malotes [3]; -MALOTE *malote_copy; - -void ram6_to_ram (void) { - // This function copies current screen data from RAM 6 to low RAM (new screen) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Map screen -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + (n_pant * 150); -#else - map_pointer = 0xc000 + (n_pant * 75); -#endif - for (gpit = 0; gpit < 150; gpit ++) { -#ifdef UNPACKED_MAP - // Mapa tipo UNPACKED - gpd = *map_pointer ++; - map_buff [gpit] = gpd; -#else - // Mapa tipo PACKED - if (!(gpit & 1)) { - gpc = *map_pointer ++; - gpd = gpc >> 4; - } else { - gpd = gpc & 15; - } - map_buff [gpit] = gpd; -#endif - } - - // Enems - enoffs = n_pant * 3; -#ifdef UNPACKED_MAP - map_pointer = 0xc000 + MAP_W * MAP_H * 150 + 12 * enoffs; -#else - map_pointer = 0xc000 + MAP_W * MAP_H * 75 + 12 * enoffs; -#endif - malote_copy = malotes; - for (gpit = 0; gpit < 36; gpit ++) { - *malote_copy ++ = *map_pointer ++; - } - enoffs = 0; - - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} - -void ram_to_ram6 (void) { - // This function copies current screen data from low RAM to RAM 6 (update) - #asm - di - ld b, 6 - call SetRAMBank - #endasm - - // Enems - // Hotspots - // Bolts - - // Get back - #asm - di - ld b, 0 - call SetRAMBank - #endasm -} -#endif -*/ \ No newline at end of file diff --git a/trash/blip_blep/dev/aplib.h b/trash/blip_blep/dev/aplib.h index 88a31fda..11441f46 100644 --- a/trash/blip_blep/dev/aplib.h +++ b/trash/blip_blep/dev/aplib.h @@ -1,13 +1,6 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -unsigned int ram_address; -unsigned int ram_destination; - -#ifdef MODE_128K - unsigned char ram_page; -#endif - #asm ; aPPack decompressor diff --git a/trash/blip_blep/dev/assets/ay_fx_numbers.h b/trash/blip_blep/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/trash/blip_blep/dev/assets/ay_fx_numbers.h +++ b/trash/blip_blep/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/trash/blip_blep/dev/assets/levels.h b/trash/blip_blep/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/trash/blip_blep/dev/assets/levels.h +++ b/trash/blip_blep/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/trash/blip_blep/dev/blip_blep.tap b/trash/blip_blep/dev/blip_blep.tap index e7f513a6..dfddf103 100644 Binary files a/trash/blip_blep/dev/blip_blep.tap and b/trash/blip_blep/dev/blip_blep.tap differ diff --git a/trash/blip_blep/dev/compile.bat b/trash/blip_blep/dev/compile.bat index 82ece3d4..621a995a 100644 --- a/trash/blip_blep/dev/compile.bat +++ b/trash/blip_blep/dev/compile.bat @@ -38,24 +38,65 @@ echo Importando GFX ..\..\..\src\utils\png2scr.exe ..\gfx\marco.png ..\gfx\marco.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\ending.png ..\gfx\ending.scr > nul ..\..\..\src\utils\png2scr.exe ..\gfx\loading.png loading.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\title.scr title.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\marco.scr marco.bin > nul -..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ending.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\title.scr ..\bin\title.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\marco.scr ..\bin\marco.bin > nul +..\..\..\src\utils\apultra.exe ..\gfx\ending.scr ..\bin\ending.bin > nul if [%1]==[justassets] goto :end +rem echo Running The Librarian +rem ..\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul + +rem *** Música AY: Descomenta el player que vayas a usar (Wyz o Arkos) *** + +rem echo Compilando musica 128k - Wyz Player +rem cd ..\mus +rem ..\utils\apultra.exe menu.mus menu.bin +rem ..\utils\apultra.exe level1.mus level1.bin +rem ..\utils\pasmo WYZproPlay47aZXc.ASM ..\bin\RAM1.bin +rem cd ..\dev + +rem echo Compilando musica 128k - Arkos Player +rem cd ..\mus_arkos +rem if [%1]==[nomus] goto :nomus +rem ..\utils\build_mus_bin.exe ram1.bin > nul +rem :nomus +rem copy ram1.bin ..\bin +rem copy arkos-addresses.h ..\dev\sound +rem cd ..\dev + :compile echo Compilando guego -zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe scripts.bin +rem *** Tipo de cargador *** + echo Construyendo cinta rem cambia LOADER por el nombre que quieres que salga en Program: ..\..\..\src\utils\bas2tap -a10 -sBLIP_BLEP loader\loader.bas loader.tap > nul ..\..\..\src\utils\bin2tap -o screen.tap -a 16384 loading.bin > nul ..\..\..\src\utils\bin2tap -o main.tap -a 24000 %game%.bin > nul copy /b loader.tap + screen.tap + main.tap %game%.tap > nul +rem echo Construyendo cinta 128k +rem ..\..\..\src\utils\imanol.exe ^ +rem in=loader\loaderzx.asm-orig ^ +rem out=loader\loader.asm ^ +rem ram1_length=?..\bin\RAM1.bin ^ +rem ram3_length=?..\bin\RAM3.bin ^ +rem mb_length=?%game%.bin > nul + +rem ..\utils\pasmo.exe loader\loader.asm ..\bin\loader.bin loader.txt + +rem cambia LOADER por el nombre que quieres que salga en Program: +rem ..\..\..\src\utils\GenTape.exe %game%.tap ^ +rem basic 'LOADER' 10 ..\bin\loader.bin ^ +rem data loading.bin ^ +rem data ..\bin\RAM1.bin ^ +rem data ..\bin\RAM3.bin ^ +rem data %game%.bin if [%1]==[justcompile] goto :end if [%1]==[noclean] goto :end diff --git a/trash/blip_blep/dev/crt.asm b/trash/blip_blep/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/trash/blip_blep/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/trash/blip_blep/dev/definitions.h b/trash/blip_blep/dev/definitions.h index a15cd13b..38f3bd82 100644 --- a/trash/blip_blep/dev/definitions.h +++ b/trash/blip_blep/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -31,8 +32,15 @@ void *u_free = sp_FreeBlock; // Safe stuff in low(est) RAM -unsigned char safe_byte @ 23296; +unsigned char safe_byte @ 23296; +unsigned int ram_address @ 23297; +unsigned int ram_destination @ 23299; + +#ifdef MODE_128K + unsigned char ram_page @ 23301; +#endif + // Globales muy globalizadas struct sp_SS *sp_player; @@ -49,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -111,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -173,7 +181,7 @@ unsigned char map_attr [150]; unsigned char map_buff [150] @ FREEPOOL; // Breakable walls/etc #ifdef BREAKABLE_WALLS - unsigned char brk_buff [150] @ 23297; + unsigned char brk_buff [150] @ 23296+16; #endif // posición del objeto (hotspot). Para no objeto, @@ -187,7 +195,7 @@ unsigned char hotspot_destroy; #ifndef MAX_FLAGS #define MAX_FLAGS 16 #endif -unsigned char flags[MAX_FLAGS]; +unsigned char flags[MAX_FLAGS]; // Globalized unsigned char o_pant; @@ -219,7 +227,7 @@ unsigned char maincounter; // Engine globals (for speed) & size! -unsigned char gpx, gpox, gpy, gpd, gpc, gpt; +unsigned char gpx, gpox, gpy, gpd, gpc; unsigned char gpxx, gpyy, gpcx, gpcy; unsigned char possee, hit_v, hit_h, hit, wall_h, wall_v; unsigned char gpen_x, gpen_y, gpen_cx, gpen_cy, gpaux; @@ -230,7 +238,7 @@ unsigned char *map_pointer; #ifdef PLAYER_CAN_FIRE unsigned char blx, bly; #endif -unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn; +unsigned char rdx, rdy, rda, rdb, rdc, rdd, rdn, rdt; // More stuff @@ -251,6 +259,7 @@ unsigned char objs_old, keys_old, life_old, killed_old; #ifdef COMPRESSED_LEVELS unsigned char *level_str = "LEVEL 0X"; + unsigned char silent_level = 0; #endif #ifdef GET_X_MORE @@ -271,12 +280,24 @@ unsigned char x0, y0, x1, y1; unsigned char ptx1, pty1, ptx2, pty2; unsigned char *_gp_gen; +#ifdef ENABLE_TILANIMS + unsigned char tait; + unsigned char max_tilanims; + unsigned char tacount; + unsigned char tilanims_xy [MAX_TILANIMS]; + unsigned char tilanims_ft [MAX_TILANIMS]; +#endif + +#if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS || defined ENABLE_TILANIMS + unsigned char xx, yy; +#endif + #if defined USE_AUTO_TILE_SHADOWS || defined USE_AUTO_SHADOWS unsigned char c1, c2, c3, c4; unsigned char t1, t2, t3, t4; unsigned char nocast, _ta; - unsigned char xx, yy; #endif + #ifdef USE_AUTO_TILE_SHADOWS unsigned a1, a2, a3; unsigned char *gen_pt_alt; @@ -291,4 +312,7 @@ unsigned char *_gp_gen; #ifdef MODE_128K unsigned char song_playing = 0; + unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/trash/blip_blep/dev/engine.h b/trash/blip_blep/dev/engine.h index e89eb1a9..bbbbfb9f 100644 --- a/trash/blip_blep/dev/engine.h +++ b/trash/blip_blep/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -290,6 +290,7 @@ void draw_scr_background (void) { add hl, bc ld (hl), a + #ifdef PACKED_MAP_ALT_TILE ld a, (__t) or a jr nz, _draw_scr_packed_noalt @@ -305,10 +306,12 @@ void draw_scr_background (void) { jr _draw_scr_packed_noalt ._draw_scr_packed_alt_subst - ld a, 19 + ld a, PACKED_MAP_ALT_TILE ld (__t), a ._draw_scr_packed_noalt + #endif + ld hl, _map_buff add hl, bc @@ -326,15 +329,15 @@ void draw_scr_background (void) { #endasm #endif - draw_coloured_tile (); - - #if defined ENABLE_TILANIMS && defined UNPACKED_MAP - // Detect tilanims + #ifdef ENABLE_TILANIMS if (_t >= ENABLE_TILANIMS) { - add_tilanim ((_x - VIEWPORT_X) >> 1, (_y - VIEWPORT_Y) >> 1, _t); + _n = (((_x - VIEWPORT_X) << 3) & 0xf0) | ((_y - VIEWPORT_Y) >> 1); + tilanims_add (); } #endif - + + draw_coloured_tile (); + //_x += 2; if (_x == VIEWPORT_X + 30) { _x = VIEWPORT_X; _y += 2; } #asm ld a, (__x) @@ -355,34 +358,7 @@ void draw_scr_background (void) { #endif } -void draw_scr (void) { - is_rendering = 1; - - #ifdef ENABLE_TILANIMS - max_tilanims = 0; - #endif - - #ifdef ENABLE_FIRE_ZONE - f_zone_ac = 0; - #endif - - draw_scr_background (); - - // Object setup - - enems_load (); - - #ifdef ACTIVATE_SCRIPTING - #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE - _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); - #endif - // Ejecutamos los scripts de entrar en pantalla: - run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY - run_script (n_pant << 1); // ENTERING SCREEN n - #endif - - #include "my/ci/entering_screen.h" - +void draw_scr_hotspots_locks (void) { /* hotspot_y = 240; rdx = (hotspots [n_pant].xy >> 4); @@ -534,6 +510,14 @@ void draw_scr (void) { cp c jr nz, _open_locks_done + // Remove x=y=np=0 pseudobug in multilevel games + #ifdef COMPRESSED_LEVELS + ld a, b + or d + or e + jr z, _open_locks_done + #endif + ._open_locks_do ld a, d ld (__x), a @@ -573,6 +557,37 @@ void draw_scr (void) { jr nz, _open_locks_loop #endasm #endif +} + +void draw_scr (void) { + is_rendering = 1; + + #ifdef ENABLE_TILANIMS + tilanims_reset (); + #endif + + #ifdef ENABLE_FIRE_ZONE + f_zone_ac = 0; + #endif + + draw_scr_background (); + + // Object setup + + enems_load (); + + #ifdef ACTIVATE_SCRIPTING + #if defined LINE_OF_TEXT && !defined LINE_OF_TEXT_NO_AUTOERASE + _x = LINE_OF_TEXT_X; _y = LINE_OF_TEXT; _t = LINE_OF_TEXT_ATTR; _gp_gen = " "; print_str (); + #endif + // Ejecutamos los scripts de entrar en pantalla: + run_script (2 * MAP_W * MAP_H + 1); // ENTERING ANY + run_script (n_pant << 1); // ENTERING SCREEN n + #endif + + #include "my/ci/entering_screen.h" + + draw_scr_hotspots_locks (); #ifdef PLAYER_CAN_FIRE bullets_init (); @@ -609,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/trash/blip_blep/dev/engine/breakable.h b/trash/blip_blep/dev/engine/breakable.h index 81e191c1..01e9423f 100644 --- a/trash/blip_blep/dev/engine/breakable.h +++ b/trash/blip_blep/dev/engine/breakable.h @@ -16,14 +16,14 @@ void break_wall (void) { } else { _n = _t = 0; update_tile (); #ifdef MODE_128K - gpix = SFX_BREAKABLE_BREAK + gpit = SFX_BREAKABLE_BREAK; #else gpit = 0; #endif #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/trash/blip_blep/dev/engine/bullets.h b/trash/blip_blep/dev/engine/bullets.h index 4dda4259..2278b516 100644 --- a/trash/blip_blep/dev/engine/bullets.h +++ b/trash/blip_blep/dev/engine/bullets.h @@ -54,10 +54,11 @@ void bullets_fire (void) { #ifdef PLAYER_CAN_FIRE_FLAG if (flags [PLAYER_CAN_FIRE_FLAG] == 0) return; #endif + #ifdef MAX_AMMO if (!p_ammo) return; - -- p_ammo; #endif + // Buscamos una bala libre for (b_it = 0; b_it < MAX_BULLETS; ++ b_it) { if (bullets_estado [b_it] == 0) { @@ -165,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif @@ -180,8 +181,12 @@ void bullets_fire (void) { #include "my/ci/on_player_fires.h" - bullets_update (); + bullets_update (); + #ifdef MAX_AMMO + -- p_ammo; + #endif + break; } } diff --git a/trash/blip_blep/dev/engine/c_levels.h b/trash/blip_blep/dev/engine/c_levels.h index 0a76ee0c..cbbaf91a 100644 --- a/trash/blip_blep/dev/engine/c_levels.h +++ b/trash/blip_blep/dev/engine/c_levels.h @@ -10,12 +10,12 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING - main_script_offset = levels [level]->script_offset; + main_script_offset = levels [level].script_offset; #endif #else unpack ((unsigned int) levels [level].c_map_bolts, (unsigned int) (mapa)); @@ -24,11 +24,11 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_behs, (unsigned int) (behs)); #ifdef PER_LEVEL_SPRITESET - unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites)); + unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels.map_w; - level_data->map_h = levels.map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h index 7cd62b19..601aa01f 100644 --- a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h +++ b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers.h @@ -9,8 +9,8 @@ _en_x = _en_x1; _en_y = _en_y1; en_an_alive [enit] = 1; - en_an_rawv [enit] = 1 << (rand () % 5); - if (en_an_rawv [enit] > 4) en_an_rawv [enit] = 2; + en_an_rawv [enit] = 1 << (rand () & 3); + if (en_an_rawv [enit] > PURSUERS_MAX_V) en_an_rawv [enit] = 2; en_an_dead_row [enit] = 11 + (rand () & 7); #if defined(PLAYER_STEPS_ON_ENEMIES) || defined(PLAYER_CAN_FIRE) _en_life = ENEMIES_LIFE_GAUGE; diff --git a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h index 6980b4b1..6ce2cc20 100644 --- a/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h +++ b/trash/blip_blep/dev/engine/enem_mods/enem_type_pursuers_asm.h @@ -34,19 +34,21 @@ ld a, 1 ld (hl), a - // en_an_rawv [enit] = 1 << (rand () % 5); + // en_an_rawv [enit] = 1 << (rand () & 3); push bc call _rand // rand -> L - ld de, 5 - ex de, hl - call l_div // l_div :: DE / HL -> HL = cociente; DE = resto - ex de, hl // HL = resto + + ld a, l + and 3 + ld l, a + ld h, 0 + ld de, 1 call l_asl // l_asl :: DE << HL -> HL ld a, l pop bc - cp 5 + cp PURSUERS_MAX_V+1 jr c, _eij_rawv_set ld a, 2 diff --git a/trash/blip_blep/dev/engine/enengine.h b/trash/blip_blep/dev/engine/enengine.h index 17dddc2c..4acb013d 100644 --- a/trash/blip_blep/dev/engine/enengine.h +++ b/trash/blip_blep/dev/engine/enengine.h @@ -14,8 +14,8 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { - malotes [enit].t = malotes [enit].t & 15; + while (enit < MAP_W * MAP_H * MAX_ENEMS) { + malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; #endif @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -141,6 +141,10 @@ void enems_load (void) { #endif #endif + #include "my/ci/enems_custom_respawn.h" + + en_an_next_frame [enit] = sprite_18_a; + switch (malotes [enoffsmasi].t & 0x1f) { case 1: case 2: @@ -184,13 +188,8 @@ void enems_load (void) { #endif #include "my/ci/enems_load.h" - - default: - en_an_next_frame [enit] = sprite_18_a; } - malotes [enoffsmasi].t &= 0x1f; - #include "my/ci/enems_extra_mods.h" } } @@ -227,7 +226,7 @@ void enems_move (void) { ld hl, (_enoffsmasi) ld h, 0 - #ifdef PLAYER_CAN_FIRE + #if defined PLAYER_CAN_FIRE || defined COMPRESSED_LEVELS add hl, hl // x2 ld d, h ld e, l // DE = x2 @@ -284,6 +283,8 @@ void enems_move (void) { ld a, (hl) ld (__en_t), a + and 0x1f + ld (_rdt), a #ifdef PLAYER_CAN_FIRE inc hl @@ -316,7 +317,7 @@ void enems_move (void) { #endif #endif - switch (_en_t) { + switch (rdt) { case 1: case 2: case 3: @@ -326,7 +327,7 @@ void enems_move (void) { #endif #include "engine/enem_mods/enem_type_lineal.h" #ifdef ENABLE_ORTHOSHOOTERS - if (_en_t == 5) { + if (rdt == 5) { #include "engine/enem_mods/enem_type_orthoshooters.h" } #endif @@ -443,13 +444,13 @@ void enems_move (void) { // Step over enemy #ifdef PLAYER_CAN_STEP_ON_FLAG if (flags [PLAYER_CAN_STEP_ON_FLAG] != 0 && - gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #else - if (gpy < _en_y - 2 && p_vy >= 0 && _en_t >= PLAYER_MIN_KILLABLE) + if (gpy < _en_y - 2 && p_vy >= 0 && rdt >= PLAYER_MIN_KILLABLE) #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -519,7 +520,7 @@ void enems_move (void) { #ifdef PLAYER_CAN_FIRE // Collide with bullets #ifdef FIRE_MIN_KILLABLE - if (_en_t >= FIRE_MIN_KILLABLE) + if (rdt >= FIRE_MIN_KILLABLE) #endif { for (gpjt = 0; gpjt < MAX_BULLETS; gpjt ++) { @@ -548,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -562,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/trash/blip_blep/dev/engine/hotspots.h b/trash/blip_blep/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/trash/blip_blep/dev/engine/hotspots.h +++ b/trash/blip_blep/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/trash/blip_blep/dev/engine/isr.h b/trash/blip_blep/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/trash/blip_blep/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/trash/blip_blep/dev/engine/player.h b/trash/blip_blep/dev/engine/player.h index 7256df57..59844d68 100644 --- a/trash/blip_blep/dev/engine/player.h +++ b/trash/blip_blep/dev/engine/player.h @@ -28,17 +28,20 @@ void player_init (void) { #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) p_life = PLAYER_LIFE; #endif - p_objs = 0; - p_keys = 0; - p_killed = 0; p_disparando = 0; - #ifdef MAX_AMMO - #ifdef INITIAL_AMMO - p_ammo = INITIAL_AMMO; - #else - p_ammo = MAX_AMMO; + + #ifndef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif #endif - #endif + #endif #ifdef TIMER_ENABLE timer_count = 0; @@ -283,6 +286,7 @@ unsigned char player_move (void) { // Collision, may set possee, hit_v + // Velocity positive (going downwards) player_calc_bounding_box (); hit_v = 0; @@ -400,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -426,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -446,43 +450,47 @@ unsigned char player_move (void) { // MOVEMENT IN THE HORIZONTAL AXIS // *************************************************************************** - if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { - #ifdef PLAYER_GENITAL - p_facing_h = 0xff; - #endif - if (p_vx > 0) { - p_vx -= PLAYER_RX; - if (p_vx < 0) p_vx = 0; - } else if (p_vx < 0) { - p_vx += PLAYER_RX; - if (p_vx > 0) p_vx = 0; + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; } - wall_h = 0; - } - if ((pad0 & sp_LEFT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_LEFT; - #endif - if (p_vx > -PLAYER_MAX_VX) { - #ifndef PLAYER_GENITAL - p_facing = 0; + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; #endif - p_vx -= PLAYER_AX; + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } } - } - if ((pad0 & sp_RIGHT) == 0) { - #ifdef PLAYER_GENITAL - p_facing_h = FACING_RIGHT; - #endif - if (p_vx < PLAYER_MAX_VX) { - p_vx += PLAYER_AX; - #ifndef PLAYER_GENITAL - p_facing = 1; + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } } - } + #endif + + #include "my/ci/custom_heng.h" p_x = p_x + p_vx; #ifndef PLAYER_GENITAL @@ -606,7 +614,7 @@ unsigned char player_move (void) { #elif defined (BOUNDING_BOX_8_CENTERED) cy1 = (gpy + 3) >> 4; #else - cy1 = gpy >> 3; + cy1 = (gpy - 1) >> 3; #endif if (attr (cx1, cy1) == 10) { @@ -636,7 +644,7 @@ unsigned char player_move (void) { #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) cx1 = (gpx + 3) >> 4; #else - cx1 = gpx >> 4; + cx1 = (gpx - 1) >> 4; #endif if (attr (cx1, cy1) == 10) { @@ -717,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -737,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -752,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/trash/blip_blep/dev/engine/player_wip.h b/trash/blip_blep/dev/engine/player_wip.h new file mode 100644 index 00000000..815761a3 --- /dev/null +++ b/trash/blip_blep/dev/engine/player_wip.h @@ -0,0 +1,884 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// player.h + +void player_init (void) { + // Inicializa player con los valores iniciales + // (de ahí lo de inicializar). + + #ifndef COMPRESSED_LEVELS + gpx = PLAYER_INI_X << 4; p_x = gpx << 6; + gpy = PLAYER_INI_Y << 4; p_y = gpy << 6; + #endif + p_vy = 0; + p_vx = 0; + p_cont_salto = 1; + p_saltando = 0; + p_frame = 0; + p_subframe = 0; + #ifdef PLAYER_GENITAL + p_facing = FACING_DOWN; + p_facing_v = p_facing_h = 0xff; + #else + p_facing = 1; + #endif + p_estado = EST_NORMAL; + p_ct_estado = 0; + #if !defined(COMPRESSED_LEVELS) || defined(REFILL_ME) + p_life = PLAYER_LIFE; + #endif + p_objs = 0; + p_keys = 0; + p_killed = 0; + p_disparando = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + + #ifdef TIMER_ENABLE + timer_count = 0; + timer_zero = 0; + #ifdef TIMER_LAPSE + timer_frames = TIMER_LAPSE; + #endif + #ifdef TIMER_INITIAL + timer_t = TIMER_INITIAL; + #endif + #ifdef TIMER_START + timer_on = 1; + #else + timer_on = 0; + #endif + #endif +} + +void player_calc_bounding_box (void) { + #if defined (BOUNDING_BOX_8_BOTTOM) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 8 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #elif defined (BOUNDING_BOX_8_CENTERED) + #asm + ld a, (_gpx) + add 4 + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 11 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + add 4 + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 11 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #else + #asm + ld a, (_gpx) + srl a + srl a + srl a + srl a + ld (_ptx1), a + ld a, (_gpx) + add 15 + srl a + srl a + srl a + srl a + ld (_ptx2), a + ld a, (_gpy) + srl a + srl a + srl a + srl a + ld (_pty1), a + ld a, (_gpy) + add 15 + srl a + srl a + srl a + srl a + ld (_pty2), a + #endasm + #endif +} + +unsigned char player_move (void) { + + // *************************************************************************** + // MOVEMENT IN THE VERTICAL AXIS + // *************************************************************************** + + #if !defined PLAYER_GENITAL || defined VENG_SELECTOR + + #if !defined PLAYER_DISABLE_GRAVITY + #if defined VENG_SELECTOR && defined PLAYER_VKEYS + if (veng_selector != VENG_KEYS) + #endif + { + // Do gravity + + #asm + ; Signed comparisons are hard + ; p_vy <= PLAYER_MAX_VY_CAYENDO - PLAYER_G + + ; We are going to take a shortcut. + ; If p_vy < 0, just add PLAYER_G. + ; If p_vy > 0, we can use unsigned comparition anyway. + + ld hl, (_p_vy) + bit 7, h + jr nz, _player_gravity_add ; < 0 + + ld de, PLAYER_MAX_VY_CAYENDO - PLAYER_G + or a + push hl + sbc hl, de + pop hl + jr nc, _player_gravity_maximum + + ._player_gravity_add + ld de, PLAYER_G + add hl, de + jr _player_gravity_vy_set + + ._player_gravity_maximum + ld hl, PLAYER_MAX_VY_CAYENDO + + ._player_gravity_vy_set + ld (_p_vy), hl + + ._player_gravity_done + + #ifdef PLAYER_CUMULATIVE_JUMP + ld a, (_p_jmp_on) + or a + jr nz, _player_gravity_p_gotten_done + #endif + + ld a, (_p_gotten) + or a + jr z, _player_gravity_p_gotten_done + + xor a + ld (_p_vy), a + + ._player_gravity_p_gotten_done + #endasm + } + #endif + #endif + + #if defined PLAYER_GENITAL || (defined VENG_SELECTOR && defined PLAYER_VKEYS) + + #if defined (VENG_SELECTOR) + if (veng_selector == VENG_KEYS ) + #endif + { + // Pad do + + if ( ! ((pad0 & sp_UP) == 0 || (pad0 & sp_DOWN) == 0)) { + p_facing_v = 0xff; + wall_v = 0; + if (p_vy > 0) { + p_vy -= PLAYER_RX; + if (p_vy < 0) p_vy = 0; + } else if (p_vy < 0) { + p_vy += PLAYER_RX; + if (p_vy > 0) p_vy = 0; + } + } + + if ((pad0 & sp_UP) == 0) { + p_facing_v = FACING_UP; + if (p_vy > -PLAYER_MAX_VX) p_vy -= PLAYER_AX; + } + + if ((pad0 & sp_DOWN) == 0) { + p_facing_v = FACING_DOWN; + if (p_vy < PLAYER_MAX_VX) p_vy += PLAYER_AX; + } + } + #endif + + #ifdef PLAYER_HAS_JETPAC + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JETPAC) + #endif + { + if ((pad0 & sp_UP) == 0) { + p_vy -= PLAYER_INCR_JETPAC; + if (p_vy < -PLAYER_MAX_VY_JETPAC) p_vy = -PLAYER_MAX_VY_JETPAC; + + #include "my/ci/on_jetpac_boost.h" + + p_jetpac_on = 1; + } else p_jetpac_on = 0; + } + #endif + + #include "my/ci/custom_veng.h" + + p_y += p_vy; + + #if !defined (PLAYER_GENITAL) + if (p_gotten) p_y += ptgmy; + #endif + + // Safe + + if (p_y < 0) p_y = 0; + if (p_y > 9216) p_y = 9216; + + gpy = p_y >> 6; + + // Collision, may set possee, hit_v + + #asm + call _player_calc_bounding_box + + xor a + ld (_hit_v), a + + ld a, (_ptx1) + ld (_cx1), a + ld a, (_ptx2) + ld (_cx2), a + + // Calculate vertical velocity + + ld a, (_p_vy) + #if !defined (PLAYER_GENITAL) + ld c, a + ld a, (_ptgmy) + add c + #endif + + // Skip if not moving in the vertical axis + + or a + jp z, _va_collision_done + + // Check sign + + bit 7, a + jr z, _va_collision_vy_positive + + ._va_collision_vy_negative + + // Velocity negative (going upwards) + + ld a, (_pty1) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_neg_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + + ._va_col_vy_neg_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty1) + inc a + sla a + sla a + sla a + sla a + + #if defined (BOUNDING_BOX_8_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 8; + sub 8 + #elif defined (BOUNDING_BOX_8_CENTERED) + // gpy = ((pty1 + 1) << 4) - 4; + sub 4 + #elif defined (BOUNDING_BOX_TINY_BOTTOM) + // gpy = ((pty1 + 1) << 4) - 14; + sub 14 + #else + // gpy = ((pty1 + 1) << 4); + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WTOP + ld (_wall_v), a + #endif + + jr _va_collision_checkevil + + ._va_collision_vy_positive + + // Velocity positive (going downwards) + ld a, (_pty2) + ld (_cy1), a + ld (_cy2), a + + call _cm_two_points + + #ifdef PLAYER_GENITAL + // if ((at1 & 8) || (at2 & 8)) { + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 8 + jr z, _va_collision_checkevil + #else + // if ((at1 & 8) || + ld a, (_at1) + and 8 + jr nz, _va_col_vy_pos_do + + // (at2 & 8) || + ld a, (_at2) + and 8 + jr nz, _va_col_vy_pos_do + + // (((gpy - 1) & 15) < 8 && + ld a, (_gpy) + dec a + and 15 + cp 8 + jr nc, _va_collision_checkevil + + // ((at1 & 4) || (at2 & 4)))) + ld a, (_at1) + and 4 + jr nz, _va_col_vy_pos_do + + ld a, (_at2) + and 4 + jr z, _va_collision_checkevil + #endif + ._va_col_vy_pos_do + + #ifdef PLAYER_BOUNCE_WITH_WALLS + ld a, (_p_vy) + sra a + neg a + #else + xor a + #endif + ld (_p_vy), a + + ld a, (_pty2) + dec a + sla a + sla a + sla a + sla a + + #ifdef BOUNDING_BOX_8_CENTERED + add 4 + #endif + + ld (_gpy), a + + // p_y = gpy << FIXBITS; 16 bits shift + ld d, 0 + ld e, a + ld l, FIXBITS + call l_asl + ld (_p_y), hl + + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + ld a, WBOTTOM + ld (_wall_v), a + #endif + + jr _va_collision_done + + ._va_collision_checkevil + + #ifndef DEACTIVATE_EVIL_TILE + #endasm + hit_v = ((at1 & 1) || (at2 & 1)); + #asm + #endif + + ._va_collision_done + #endasm + + gpxx = gpx >> 4; + gpyy = gpy >> 4; + + #ifndef PLAYER_GENITAL + cy1 = cy2 = (gpy + 16) >> 4; + cx1 = ptx1; cx2 = ptx2; + cm_two_points (); + possee = ((at1 & 12) || (at2 & 12)) && (gpy & 15) < 8; + #endif + + // Jump + + #ifdef PLAYER_HAS_JUMP + #ifdef VENG_SELECTOR + if (veng_selector == VENG_JUMP) + #endif + { + #if defined (PLAYER_CAN_FIRE) && !defined (USE_TWO_BUTTONS) + rda = (pad0 & sp_UP) == 0; + #elif defined (PLAYER_CAN_FIRE) && defined (USE_TWO_BUTTONS) + rda = isJoy ? ((pad0 & sp_UP) == 0) : (sp_KeyPressed (key_jump)); + #else + rda = (pad0 & sp_FIRE) == 0; + #endif + + if (rda) { + if (p_saltando == 0) { + if (possee || p_gotten || hit_v) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + } else { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto >> 1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 9) p_saltando = 0; + } + } else p_saltando = 0; + } + #endif + + // Bootee engine + + #ifdef PLAYER_BOOTEE + #ifdef VENG_SELECTOR + if (veng_selector == VENG_BOOTEE) + #endif + { + if ( p_saltando == 0 && (possee || p_gotten || hit_v) ) { + p_saltando = 1; + p_cont_salto = 0; + #ifdef MODE_128K + PLAY_SOUND (SFX_JUMP); + #else + beep_fx (3); + #endif + } + + if (p_saltando ) { + p_vy -= (PLAYER_VY_INICIAL_SALTO + PLAYER_INCR_SALTO - (p_cont_salto>>1)); + if (p_vy < -PLAYER_MAX_VY_SALTANDO) p_vy = -PLAYER_MAX_VY_SALTANDO; + ++ p_cont_salto; + if (p_cont_salto == 8) + p_saltando = 0; + } + } + #endif + + // *************************************************************************** + // MOVEMENT IN THE HORIZONTAL AXIS + // *************************************************************************** + + #ifndef PLAYER_DISABLE_DEFAULT_HENG + if ( ! ((pad0 & sp_LEFT) == 0 || (pad0 & sp_RIGHT) == 0)) { + #ifdef PLAYER_GENITAL + p_facing_h = 0xff; + #endif + if (p_vx > 0) { + p_vx -= PLAYER_RX; + if (p_vx < 0) p_vx = 0; + } else if (p_vx < 0) { + p_vx += PLAYER_RX; + if (p_vx > 0) p_vx = 0; + } + wall_h = 0; + } + + if ((pad0 & sp_LEFT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_LEFT; + #endif + if (p_vx > -PLAYER_MAX_VX) { + #ifndef PLAYER_GENITAL + p_facing = 0; + #endif + p_vx -= PLAYER_AX; + } + } + + if ((pad0 & sp_RIGHT) == 0) { + #ifdef PLAYER_GENITAL + p_facing_h = FACING_RIGHT; + #endif + if (p_vx < PLAYER_MAX_VX) { + p_vx += PLAYER_AX; + #ifndef PLAYER_GENITAL + p_facing = 1; + #endif + } + } + #endif + + #include "my/ci/custom_heng.h" + + p_x = p_x + p_vx; + #ifndef PLAYER_GENITAL + p_x += ptgmx; + #endif + + // Safe + + if (p_x < 0) p_x = 0; + if (p_x > 14336) p_x = 14336; + + gpox = gpx; + gpx = p_x >> 6; + + // Collision. May set hit_h + player_calc_bounding_box (); + + hit_h = 0; + cy1 = pty1; cy2 = pty2; + + #if defined (PLAYER_GENITAL) + if (p_vx < 0) + #else + if (p_vx + ptgmx < 0) + #endif + { + cx1 = cx2 = ptx1; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_left.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = ((ptx1 + 1) << 4) - 4; + #else + gpx = ((ptx1 + 1) << 4); + #endif + + p_x = gpx << 6; + wall_h = WLEFT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + #if defined (PLAYER_GENITAL) + if (p_vx > 0) + #else + if (p_vx + ptgmx > 0) + #endif + { + cx1 = cx2 = ptx2; + cm_two_points (); + + if ((at1 & 8) || (at2 & 8)) { + #include "my/ci/bg_collision/obstacle_right.h" + + #ifdef PLAYER_BOUNCE_WITH_WALLS + p_vx = -(p_vx / 2); + #else + p_vx = 0; + #endif + + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) || defined (BOUNDING_BOX_TINY_BOTTOM) + gpx = (ptx1 << 4) + 4; + #else + gpx = (ptx1 << 4); + #endif + + p_x = gpx << 6; + wall_h = WRIGHT; + } + #ifndef DEACTIVATE_EVIL_TILE + else hit_h = ((at1 & 1) || (at2 & 1)); + #endif + + } + + // Priority to decide facing + + #ifdef PLAYER_GENITAL + #ifdef TOP_OVER_SIDE + if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } else if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } + #else + if (p_facing_h != 0xff) { + p_facing = p_facing_h; + } else if (p_facing_v != 0xff) { + p_facing = p_facing_v; + } + #endif + #endif + + cx1 = p_tx = (gpx + 8) >> 4; + cy1 = p_ty = (gpy + 8) >> 4; + + rdb = attr (cx1, cy1); + + // Special tiles + if (rdb & 128) { + #include "my/ci/on_special_tile.h" + } + + #if defined (PLAYER_PUSH_BOXES) || !defined (DEACTIVATE_KEYS) + #if defined PLAYER_GENITAL || defined LOCKS_CHECK_VERTICAL + if (wall_v == WTOP) { + // interact up + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 7) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 3) >> 4; + #else + cy1 = (gpy - 1) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 - 1; + process_tile (); + } + + } else if (wall_v == WBOTTOM) { + // interact down + #if defined (BOUNDING_BOX_8_BOTTOM) + cy1 = (gpy + 16) >> 4; + #elif defined (BOUNDING_BOX_8_CENTERED) + cy1 = (gpy + 12) >> 4; + #else + cy1 = (gpy + 16) >> 3; + #endif + + if (attr (cx1, cy1) == 10) { + x0 = x1 = cx1; y0 = cy1; y1 = cy1 + 1; + process_tile (); + } + } else + #endif + + if (wall_h == WLEFT) { + // interact left + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 3) >> 4; + #else + cx1 = (gpx - 1) >> 4; + #endif + + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 - 1; + process_tile (); + } + } else if (wall_h == WRIGHT) { + // interact right + #if defined (BOUNDING_BOX_8_BOTTOM) || defined (BOUNDING_BOX_8_CENTERED) + cx1 = (gpx + 12) >> 4; + #else + cx1 = (gpx + 16) >> 4; + #endif + if (attr (cx1, cy1) == 10) { + y0 = y1 = cy1; x0 = cx1; x1 = cx1 + 1; + process_tile (); + } + } + #endif + + #ifdef PLAYER_CAN_FIRE + // Disparos + if ((pad0 & sp_FIRE) == 0 && p_disparando == 0) { + p_disparando = 1; + #ifdef FIRE_TO_PUSH + //if (pushed_any == 0) + #endif + bullets_fire (); + #ifdef FIRE_TO_PUSH + //else pushed_any = 0; + #endif + } + + if ((pad0 & sp_FIRE)) + p_disparando = 0; + + #endif + + #ifndef DEACTIVATE_EVIL_TILE + // Tiles que te matan. + // hit_v tiene preferencia sobre hit_h + hit = 0; + if (hit_v) { + hit = 1; + p_vy = addsign (-p_vy, PLAYER_MAX_VX); + } else if (hit_h) { + hit = 1; + p_vx = addsign (-p_vx, PLAYER_MAX_VX); + } + + if (hit) { + #ifdef PLAYER_FLICKERS + if (p_estado == EST_NORMAL) + #endif + { + #ifdef MODE_128K + p_killme = SFX_SPIKES; + #else + p_killme = 4; + #endif + } + } + #endif + + // Select animation frame + + #ifdef PLAYER_CUSTOM_ANIMATION + #include "my/custom_animation.h" + #elif defined PLAYER_GENITAL + if (p_vx || p_vy) { + ++ p_subframe; + if (p_subframe == 4) { + p_subframe = 0; + p_frame = !p_frame; + #ifdef PLAYER_STEP_SOUND + step (); + #endif + } + } + + p_next_frame = player_cells [p_facing + p_frame]; + #elif defined PLAYER_BOOTEE + gpit = p_facing << 2; + if (p_vy == 0) { + p_next_frame = player_cells [gpit]; + } else if (p_vy < 0) { + p_next_frame = player_cells [gpit + 1]; + } else { + p_next_frame = player_cells [gpit + 2]; + } + #else + if (!possee && !p_gotten) { + p_next_frame = player_cells [8 + p_facing]; + } else { + gpit = p_facing << 2; + if (p_vx == 0) { + rda = 1; + } else { + rda = ((gpx + 4) >> 3) & 3; + } + p_next_frame = player_cells [gpit + rda]; + } + #endif +} + +void player_deplete (void) { + p_life = (p_life > p_kill_amt) ? p_life - p_kill_amt : 0; +} + +void player_kill (unsigned char sound) { + p_killme = 0; + + player_deplete (); + + #ifdef MODE_128K + PLAY_SOUND (sound); + #else + beep_fx (sound); + #endif + + #ifdef CP_RESET_WHEN_DYING + #ifdef CP_RESET_ALSO_FLAGS + mem_load (); + #else + n_pant = sg_pool [MAX_FLAGS]; + p_x = sg_pool [MAX_FLAGS + 1] << 10; + p_y = sg_pool [MAX_FLAGS + 2] << 10; + #endif + o_pant = 0xff; // Reload + #endif + + #ifdef PLAYER_FLICKERS + p_estado = EST_PARP; + p_ct_estado = 50; + #endif +} + diff --git a/trash/blip_blep/dev/engine/simple_cocos.h b/trash/blip_blep/dev/engine/simple_cocos.h index 1c33a2a5..5a4da667 100644 --- a/trash/blip_blep/dev/engine/simple_cocos.h +++ b/trash/blip_blep/dev/engine/simple_cocos.h @@ -100,7 +100,71 @@ void simple_coco_update (void) { // Check collision (player) - // Check collision (BG) + #ifdef PLAYER_FLICKERS + ld a, (_p_estado) + or a + jr nz, _simple_coco_update_continue + #endif + + // rdx + 3 >= gpx && rdx + 3 <= gpx + 15 && + // rdx + 3 >= gpx && rdx <= gpx + 12 + + // rdx + 3 >= gpx + ld a, (_gpx) + ld c, a + ld a, (_rdx) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpx + 12 >= rdx + ld a, (_rdx) + ld c, a + ld a, (_gpx) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // rdy + 3 >= gpy && rdy + 3 <= gpy + 15 + // rdy + 3 >= gpy && rdy <= gpy + 12 + + // rdy + 3 >= gpy + ld a, (_gpy) + ld c, a + ld a, (_rdy) + add 3 + cp c + jr c, _simple_coco_update_collpl_done + + // gpy + 12 >= rdy + ld a, (_rdy) + ld c, a + ld a, (_gpy) + add 12 + cp c + jr c, _simple_coco_update_collpl_done + + // Kill player + ld a, 0xff + ld (_rdy), a // This effectively marks the coco for destruction + + #ifdef MODE_128K + ld a, SFX_ENEMY_HIT + #else + ld a, 4 + #endif + ld (_p_killme), a + + jr _simple_coco_update_continue + + ._simple_coco_update_collpl_done + + #endasm + + // Check collision (BG) + if (attr ((rdx + 3) >> 4, (rdy + 3) >> 4) & 12) rdy = 0xff; + + #asm ._simple_coco_update_continue // And update arrays diff --git a/trash/blip_blep/dev/mainloop.h b/trash/blip_blep/dev/mainloop.h index 96c8fd4b..9875ead0 100644 --- a/trash/blip_blep/dev/mainloop.h +++ b/trash/blip_blep/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -98,7 +105,7 @@ void main (void) { #include "my/ci/after_load.h" while (1) { - #ifdef ACTIVATE_SCRIPTING + #if defined ACTIVATE_SCRIPTING && !defined MODE_128K main_script_offset = (int) (main_script); #endif @@ -114,7 +121,22 @@ void main (void) { #include "my/ci/before_game.h" + #ifdef NO_RESET_STATS + p_objs = 0; + p_keys = 0; + p_killed = 0; + #ifdef MAX_AMMO + #ifdef INITIAL_AMMO + p_ammo = INITIAL_AMMO; + #else + p_ammo = MAX_AMMO; + #endif + #endif + #endif + #ifdef COMPRESSED_LEVELS + silent_level = 0; + #ifdef ENABLE_CHECKPOINTS if (sg_do_load) level = sg_level; else level = 0; #endif @@ -134,9 +156,12 @@ void main (void) { { #ifdef COMPRESSED_LEVELS - #include "my/level_screen.h" + if (silent_level == 0) { + #include "my/level_screen.h" + } + silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -161,17 +186,19 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif - zone_clear (); + if (silent_level == 0) zone_clear (); #ifdef ACTIVATE_SCRIPTING if (script_result != 3) #else if (warp_to_level == 0) #endif - ++ level; + { + level ++; + } if (level >= MAX_LEVELS #ifdef ACTIVATE_SCRIPTING @@ -183,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -193,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -201,11 +228,13 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif - cortina (); + #if !defined (DIRECT_TO_PLAY) || !defined (COMPRESSED_LEVELS) + cortina (); + #endif } clear_sprites (); diff --git a/trash/blip_blep/dev/mainloop/flick_screen.h b/trash/blip_blep/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/trash/blip_blep/dev/mainloop/flick_screen.h +++ b/trash/blip_blep/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/trash/blip_blep/dev/mainloop/game_loop.h b/trash/blip_blep/dev/mainloop/game_loop.h index e5442d9e..3f59e563 100644 --- a/trash/blip_blep/dev/mainloop/game_loop.h +++ b/trash/blip_blep/dev/mainloop/game_loop.h @@ -3,9 +3,18 @@ // game_loop.h - Da game loop. + #asm + ; Makes debugging easier + ._game_loop_init + #endasm + playing = 1; player_init (); + #ifdef OBJECT_COUNT + flags [OBJECT_COUNT] = p_objs; + #endif + #ifndef COMPRESSED_LEVELS hotspots_init (); #endif @@ -35,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -67,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -86,6 +95,11 @@ o_pant = 0xff; while (playing) { + #asm + ; Makes debugging easier + ._game_loop_do + #endasm + #ifdef DEBUG_KEYS if (sp_KeyPressed (KEY_M)) { ++ p_objs; beep_fx (0); } if (sp_KeyPressed (KEY_H)) { ++ n_pant; beep_fx (0); } @@ -176,7 +190,12 @@ simple_coco_update (); #endif - if (p_killme) player_kill (p_killme); + if (p_killme) { + if (p_life) { + player_kill (p_killme); + #include "my/ci/on_player_killed.h" + } else playing = 0; + } #ifdef PLAYER_CAN_FIRE // Move bullets @@ -184,7 +203,7 @@ #endif #ifdef ENABLE_TILANIMS - do_tilanims (); + tilanims_do (); #endif // Detect fire zone @@ -200,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -223,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -258,8 +294,7 @@ if (sp_KeyPressed (KEY_H)) { sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); - wyz_play_sound (1); + player_on = 0; #endif clear_sprites (); pause_screen (); @@ -267,11 +302,7 @@ sp_WaitForNoKey (); draw_scr (); #ifdef MODE_128K - #ifdef COMPRESSED_LEVELS - //wyz_play_music (levels [level].music_id); - #else - //wyz_play_music (1); - #endif + player_on = 1; #endif } if (sp_KeyPressed (KEY_Y)) { @@ -281,7 +312,12 @@ // Flick the screen ? - #include "mainloop/flick_screen.h" + #if defined ACTIVATE_SCRIPTING && defined COMPRESSED_LEVELS + if (script_result != 3) + #endif + { + #include "mainloop/flick_screen.h" + } // Win game condition @@ -305,7 +341,8 @@ } // Game over condition - if (p_life == 0 + #if defined ACTIVATE_SCRIPTING || (defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0)) + if (0 #ifdef ACTIVATE_SCRIPTING || (script_result == 2) #endif @@ -315,14 +352,16 @@ ) { playing = 0; } + #endif #include "my/ci/extra_routines.h" } + sp_UpdateNow (); sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/trash/blip_blep/dev/mk1.c b/trash/blip_blep/dev/mk1.c index 04a9fe4f..ba5f994d 100644 --- a/trash/blip_blep/dev/mk1.c +++ b/trash/blip_blep/dev/mk1.c @@ -21,6 +21,10 @@ #define FIXBITS 6 #define MAX_ENEMS 3 +// Fiddle if you need +#define MAX_TILANIMS 16 +#define TILANIMS_PRIME 7 + /* splib2 memory map 61440 - 61696 IM2 vector table 61697 - 61936 FREEPOOL (240 bytes) @@ -55,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -73,8 +77,6 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/librarian.h" #endif -#include "my/ci/extra_vars.h" - #include "aplib.h" #include "pantallas.h" @@ -90,10 +92,19 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "assets/extrasprites.h" #endif +#include "my/ci/extra_vars.h" + #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -132,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/trash/blip_blep/dev/my/ci/custom_heng.h b/trash/blip_blep/dev/my/ci/custom_heng.h new file mode 100644 index 00000000..f2a1f4b8 --- /dev/null +++ b/trash/blip_blep/dev/my/ci/custom_heng.h @@ -0,0 +1,4 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Modify p_vx diff --git a/trash/blip_blep/dev/my/ci/enems_custom_respawn.h b/trash/blip_blep/dev/my/ci/enems_custom_respawn.h new file mode 100644 index 00000000..a06ef557 --- /dev/null +++ b/trash/blip_blep/dev/my/ci/enems_custom_respawn.h @@ -0,0 +1,5 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// deactivate RESPAWN_ON_ENTER and write your own routine here! + diff --git a/trash/blip_blep/dev/my/ci/on_player_killed.h b/trash/blip_blep/dev/my/ci/on_player_killed.h new file mode 100644 index 00000000..d6e076ee --- /dev/null +++ b/trash/blip_blep/dev/my/ci/on_player_killed.h @@ -0,0 +1,3 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + diff --git a/trash/blip_blep/dev/my/config.h b/trash/blip_blep/dev/my/config.h index 49f4ea89..585bbeb5 100644 --- a/trash/blip_blep/dev/my/config.h +++ b/trash/blip_blep/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ //#define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! #define USE_MAP_CUSTOM_DECODER @@ -25,8 +28,10 @@ #define PLAYER_LIFE 5 // Max and starting life gauge. #define PLAYER_REFILL 1 // Life recharge //#define COMPRESSED_LEVELS // use levels.h instead of mapa.h and enems.h (!) +//#define PER_LEVEL_SPRITESET // use a different spriteset for each level in 48K //#define MAX_LEVELS 2 // # of compressed levels //#define REFILL_ME // If defined, refill player on each level +//#define NO_RESET_STATS // If defined, player stats are not reset per level // ============================================================================ // II. Engine type @@ -72,6 +77,7 @@ //#define ENABLE_PURSUERS // If defined, type 7 enemies are active //#define DEATH_COUNT_AND 7 //#define DEATH_COUNT_ADD 11 // Frames to wait = ADD + (rand & AND) +//#define PURSUERS_MAX_V 2 // 1, 2, 4. //#define PURSUERS_BASE_CELL 3 // If defined, type 7 enemies are always # //#define ENABLE_FANTIES // If defined, Fanties are enabled! @@ -137,6 +143,7 @@ //#define SCRIPTING_KEY_NONE // No action key. //#define ENABLE_EXTERN_CODE // Enables custom code to be run from the script using EXTERN n //#define ENABLE_FIRE_ZONE // Allows to define a zone which auto-triggers "FIRE" +//#define SCRIPT_PAGE 3 // In MODE_128K & COMPRESSED_LEVELS // Timer // ----- @@ -182,6 +189,8 @@ //#define PLAYER_MIN_KILLABLE 3 // Only kill enemies with id >= PLAYER_MIN_KILLABLE //#define PLAYER_STEP_SOUND // Sound while walking. No effect in the BOOTEE engine. +//#define PLAYER_DISABLE_DEFAULT_HENG // To disble default horizontal engine (keyrs) + // Configure keyboard // To define different keys, the first two hex digits are the COLUMN, the next the ROW @@ -260,7 +269,8 @@ //#define USE_AUTO_SHADOWS // Automatic shadows made of darker attributes //#define USE_AUTO_TILE_SHADOWS // Automatic shadows using specially defined tiles 32-47. -#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +//#define UNPACKED_MAP // Full, uncompressed maps. Shadows settings are ignored. +#define PACKED_MAP_ALT_TILE 19 // If defined, in 16 tiles mode, alt tile (default 19) //#define NO_MASKS // Sprites are rendered using OR instead of masks. //#define MASKED_BULLETS // If needed #define PLAYER_CUSTOM_ANIMATION // Code your own animation in my/custom_animation.h diff --git a/trash/blip_blep/dev/my/custom_animation.h b/trash/blip_blep/dev/my/custom_animation.h index 238d5510..9f39c45b 100644 --- a/trash/blip_blep/dev/my/custom_animation.h +++ b/trash/blip_blep/dev/my/custom_animation.h @@ -21,4 +21,4 @@ if (fire_pressed) { } } -p_next_frame = player_cells [rda]; +p_next_frame = (unsigned char *) (player_cells [rda]); diff --git a/trash/blip_blep/dev/my/fixed_screens.h b/trash/blip_blep/dev/my/fixed_screens.h index 93e2fbe2..b5a89d98 100644 --- a/trash/blip_blep/dev/my/fixed_screens.h +++ b/trash/blip_blep/dev/my/fixed_screens.h @@ -35,9 +35,9 @@ void game_ending (void) { } void game_over (void) { - _x = 10; _y = 11; _t = 79; _gp_gen = "#''''''''''$"; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = "(GAME OVER!("; print_str (); - _x = 10; _y = 13; _t = 79; _gp_gen = "%''''''''''&"; print_str (); + _x = 10; _y = 11; _t = 79; _gp_gen = (unsigned char *)("#''''''''''$"); print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)("(GAME OVER!("); print_str (); + _x = 10; _y = 13; _t = 79; _gp_gen = (unsigned char *)("%''''''''''&"); print_str (); sp_UpdateNow (); #ifdef MODE_128K @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/trash/blip_blep/dev/my/level_screen.h b/trash/blip_blep/dev/my/level_screen.h index 0de8100f..5e779b2a 100644 --- a/trash/blip_blep/dev/my/level_screen.h +++ b/trash/blip_blep/dev/my/level_screen.h @@ -10,7 +10,7 @@ _x = 12; _y = 12; _t = 71; _gp_gen = level_str; print_str (); sp_UpdateNow (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (1); #endif diff --git a/trash/blip_blep/dev/my/levelset.h b/trash/blip_blep/dev/my/levelset.h index 8add6ae3..578decfa 100644 --- a/trash/blip_blep/dev/my/levelset.h +++ b/trash/blip_blep/dev/my/levelset.h @@ -37,12 +37,14 @@ // In 48K mode, include here your compressed binaries: -extern unsigned char my_binary [0]; +#ifndef MODE_128K + extern unsigned char my_binary [0]; -#asm - ._my_binary - BINARY "../bin/my_binary.bin" -#endasm + #asm + ._my_binary + BINARY "../bin/my_binary.bin" + #endasm +#endif // Define your level sequence array here: // map_w, map_h, scr_ini, ini_x, ini_y, max_objs, c_map_bolts, c_tileset, c_enems_hotspots, c_behs, script diff --git a/trash/blip_blep/dev/my/title_screen.h b/trash/blip_blep/dev/my/title_screen.h index 86ae601c..d4342db9 100644 --- a/trash/blip_blep/dev/my/title_screen.h +++ b/trash/blip_blep/dev/my/title_screen.h @@ -9,7 +9,7 @@ #ifdef MODE_128K get_resource (TITLE_BIN, 16384); - wyz_play_music (0); + PLAY_MUSIC (0); #else #asm ld hl, _s_title diff --git a/trash/blip_blep/dev/pantallas.h b/trash/blip_blep/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/trash/blip_blep/dev/pantallas.h +++ b/trash/blip_blep/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/trash/blip_blep/dev/printer.h b/trash/blip_blep/dev/printer.h index 12b2b499..7e05d920 100644 --- a/trash/blip_blep/dev/printer.h +++ b/trash/blip_blep/dev/printer.h @@ -4,7 +4,7 @@ // Printing functions unsigned char attr (unsigned char x, unsigned char y) { - if (x >= 14 || y >= 10) return 0; + if (x >= 15 || y >= 10) return 0; return map_attr [x + (y << 4) - y]; } @@ -12,6 +12,48 @@ unsigned char qtile (unsigned char x, unsigned char y) { return map_buff [x + (y << 4) - y]; } +#if defined (USE_AUTO_TILE_SHADOWS) || defined (USE_AUTO_SHADOWS) + unsigned char attr_mk2 (void) { + // x + 15 * y = x + (16 - 1) * y = x + 16 * y - y = x + (y << 4) - y. + // if (cx1 < 0 || cy1 < 0 || cx1 > 14 || cy1 > 9) return 0; + // return map_attr [cx1 + (cy1 << 4) - cy1]; + #asm + ld a, (_cx1) + cp 15 + jr nc, _attr_reset + + ld a, (_cy1) + cp 10 + jr c, _attr_do + + ._attr_reset + ld hl, 0 + ret + + ._attr_do + ld a, (_cy1) + ld b, a + sla a + sla a + sla a + sla a + sub b + ld b, a + ld a, (_cx1) + add b + ld e, a + ld d, 0 + ld hl, _map_attr + add hl, de + ld a, (hl) + + ld h, 0 + ld l, a + ret + #endasm + } +#endif + #ifdef COMPRESSED_LEVELS #define ATTR_OFFSET 1536 #else @@ -53,9 +95,9 @@ void draw_coloured_tile (void) { // Fill up c1, c2, c3, c4 then use them #ifdef USE_AUTO_SHADOWS - cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; - cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy - 1; rda = *gen_pt; c1 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t1 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx ; cy1 = yy - 1; rda = *gen_pt; c2 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t2 = _ta; ++ gen_pt; ++ _ta; + cx1 = xx - 1; cy1 = yy ; rda = *gen_pt; c3 = (nocast && (attr_mk2 () & 8)) ? (rda & 7) - 1 : rda; t3 = _ta; ++ gen_pt; ++ _ta; #endif #ifdef USE_AUTO_TILE_SHADOWS // Precalc @@ -79,7 +121,7 @@ void draw_coloured_tile (void) { gen_pt_alt = tileset + ATTR_OFFSET + t_alt; - // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ? yy - 1 : 0; a1 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -94,12 +136,12 @@ void draw_coloured_tile (void) { ._dct_1_set_yy ld (_cy1), a - // a1 = (nocast && (attr () & 8)); + // a1 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a1_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a1_set @@ -110,7 +152,7 @@ void draw_coloured_tile (void) { ld (_a1), a #endasm - // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr () & 8)); + // cx1 = xx ; cy1 = yy ? yy - 1 : 0; a2 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx; ld a, (_xx) @@ -124,12 +166,12 @@ void draw_coloured_tile (void) { ._dct_2_set_yy ld (_cy1), a - // a2 = (nocast && (attr () & 8)) + // a2 = (nocast && (attr_mk2 () & 8)) ld a, (_nocast) or a jr z, _dct_a2_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a2_set @@ -140,7 +182,7 @@ void draw_coloured_tile (void) { ld (_a2), a #endasm - // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr () & 8)); + // cx1 = xx - 1; cy1 = yy ; a3 = (nocast && (attr_mk2 () & 8)); #asm // cx1 = xx - 1; ld a, (_xx) @@ -151,12 +193,12 @@ void draw_coloured_tile (void) { ld a, (_yy) ld (_cy1), a - // a3 = (nocast && (attr () & 8)); + // a3 = (nocast && (attr_mk2 () & 8)); ld a, (_nocast) or a jr z, _dct_a3_set - call _attr + call _attr_mk2 ld a, l and 8 jr z, _dct_a3_set @@ -567,7 +609,8 @@ void update_tile (void) { #ifdef ENABLE_TILANIMS // Detect tilanims if (_t >= ENABLE_TILANIMS) { - add_tilanim (_x, _y, _t); + _n = (_x << 4) | _y; + tilanims_add (); } #endif diff --git a/trash/blip_blep/dev/prototypes.h b/trash/blip_blep/dev/prototypes.h index aae155dd..843aaf1a 100644 --- a/trash/blip_blep/dev/prototypes.h +++ b/trash/blip_blep/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -74,6 +86,7 @@ char player_hidden (void); void run_fire_script (void); void process_tile (void); void draw_scr_background (void); +void draw_scr_hotspots_locks (void); void draw_scr (void); void select_joyfunc (void); unsigned char mons_col_sc_x (void); @@ -108,12 +121,15 @@ void tape_load (void);// TODO! void sg_submenu (void); // tilanim.h -void add_tilanim (unsigned char x, unsigned char y, unsigned char t); -void do_tilanims (void); +void tilanims_add (void); +void tilanims_do (void); +void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/trash/blip_blep/dev/sound/arkos-addresses.h b/trash/blip_blep/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/trash/blip_blep/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/trash/blip_blep/dev/sound/arkosplayer.h b/trash/blip_blep/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/trash/blip_blep/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/trash/blip_blep/dev/beeper.h b/trash/blip_blep/dev/sound/beeper.h similarity index 100% rename from trash/blip_blep/dev/beeper.h rename to trash/blip_blep/dev/sound/beeper.h diff --git a/trash/blip_blep/dev/music.h b/trash/blip_blep/dev/sound/music.h similarity index 88% rename from trash/blip_blep/dev/music.h rename to trash/blip_blep/dev/sound/music.h index 10f2f783..db6c2b4b 100644 --- a/trash/blip_blep/dev/music.h +++ b/trash/blip_blep/dev/sound/music.h @@ -2,14 +2,14 @@ ; ***************************************************************************** ; * Phaser1 Engine, with synthesised drums ; * -; * Original code by Shiru - .http//shiru.untergrund.net/ +; * Original code by Shiru - .HTTP//shiru.UNTERGRUND.NET/ ; * Modified by Chris Cowley ; * ; * Produced by Beepola v1.05.01 ; ****************************************************************************** .musicstart - LD HL,MUSICDATA ; <- Pointer to Music Data. Change + LD HL,MUSICDATA ; <- Pointer to Music Data. change ; this to play a different song LD A,(HL) ; Get the loop start pointer LD (PATTERN_LOOP_BEGIN),A @@ -31,7 +31,7 @@ LD L,A LD (NOTE_PTR),HL ; Set the note offset (within this pattern) to 0 -.player +.PLAYER ;DI PUSH IY ;LD A,BORDER_COL @@ -54,24 +54,24 @@ ; * Select the next pattern in sequence (and handle looping if weve reached PATTERN_LOOP_END ; * Execution falls through to PLAYNOTE to play the first note from our next pattern ; ******************************************************************************************************** -.next_pattern +.NEXT_PATTERN LD A,(PATTERN_PTR) INC A INC A DEFB $FE ; CP n -.pattern_loop_end DEFB 0 +.PATTERN_LOOP_END defb 0 JR NZ,NO_PATTERN_LOOP ; Handle Pattern Looping at and of song DEFB $3E ; LD A,n -.pattern_loop_begin DEFB 0 -.no_pattern_loop LD (PATTERN_PTR),A +.PATTERN_LOOP_BEGIN defb 0 +.NO_PATTERN_LOOP ld (PATTERN_PTR),a LD HL,$0000 LD (NOTE_PTR),HL ; Start of pattern (NOTE_PTR = 0) -.main_loop +.MAIN_LOOP LD IYL,0 ; Set channel = 0 -.read_loop +.READ_LOOP LD HL,(PATTERN_ADDR) LD A,(PATTERN_PTR) LD E,A @@ -82,7 +82,7 @@ LD D,(HL) ; Now DE = Start of Pattern data LD HL,(NOTE_PTR) INC HL ; Increment the note pointer and... - LD (NOTE_PTR),HL ; ..store it + LD (NOTE_PTR),HL ; ..STORE it DEC HL ADD HL,DE ; Now HL = address of note data LD A,(HL) @@ -110,16 +110,16 @@ EX DE,HL DEFB $DD,$21 ; LD IX,nn -.current_inst +.CURRENT_INST DEFW $0000 LD A,(IX+$00) OR A JR Z,L809B ; Original code jumps into byte 2 of the DJNZ (invalid opcode FD) LD B,A -.l8098 ADD HL,HL +.L8098 add hl,hl DJNZ L8098 -.l809b LD E,(IX+$01) +.L809B ld e,(ix+$01) LD D,(IX+$02) ADD HL,DE LD (DIV_1B),HL @@ -136,7 +136,7 @@ LD (CNT_1B),HL JR READ_LOOP -.set_note2 +.SET_NOTE2 LD (DIV_2),DE LD A,IYH LD HL,OUT_2 @@ -145,7 +145,7 @@ LD (CNT_2),HL JP READ_LOOP -.set_stop +.SET_STOP LD HL,$0000 LD A,IYL OR A @@ -157,14 +157,14 @@ RES 4,(HL) LD IYL,1 JP READ_LOOP -.set_stop2 +.SET_STOP2 ; Stop channel 2 note LD (DIV_2),HL LD HL,OUT_2 RES 4,(HL) JP READ_LOOP -.other CP $3C +.OTHER cp $3c JR Z,SET_STOP ; Stop note CP $3E JR Z,SKIP_CH1 ; No changes to channel 1 @@ -177,50 +177,50 @@ LD (NOTE_PTR),DE ; Increment the note pointer DEFB $01 ; LD BC,nn -.instrum_tbl +.INSTRUM_TBL DEFW $0000 ADD HL,BC LD (CURRENT_INST),HL JP READ_LOOP -.skip_ch1 +.SKIP_CH1 LD IYL,$01 JP READ_LOOP -.exit_player +.EXIT_PLAYER LD HL,$2758 EXX POP IY ;EI RET -.render +.RENDER AND $7F ; L813A CP $76 JP NC,DRUMS LD D,A EXX DEFB $21 ; LD HL,nn -.cnt_1a DEFW $0000 +.CNT_1A defw $0000 DEFB $DD,$21 ; LD IX,nn -.cnt_1b DEFW $0000 +.CNT_1B defw $0000 DEFB $01 ; LD BC,nn -.div_1a DEFW $0000 +.DIV_1A defw $0000 DEFB $11 ; LD DE,nn -.div_1b DEFW $0000 +.DIV_1B defw $0000 DEFB $3E ; LD A,n -.out_1 DEFB $0 +.OUT_1 defb $0 EXX EX AF,AF ; beware! DEFB $21 ; LD HL,nn -.cnt_2 DEFW $0000 +.CNT_2 defw $0000 DEFB $01 ; LD BC,nn -.div_2 DEFW $0000 +.DIV_2 defw $0000 DEFB $3E ; LD A,n -.out_2 DEFB $00 +.OUT_2 defb $00 -.play_note +.PLAY_NOTE ; Read keyboard LD E,A XOR A @@ -228,94 +228,94 @@ OR $E0 INC A -.player_wait_key +.PLAYER_WAIT_KEY JR NZ,EXIT_PLAYER LD A,E LD E,0 -.l8168 EXX +.L8168 exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L8171 JR L8173 -.l8171 XOR $10 -.l8173 ADD IX,DE +.L8171 xor $10 +.L8173 add ix,de JR C,L8179 JR L817B -.l8179 XOR $10 -.l817b EX AF,AF ; beware! +.L8179 xor $10 +.L817B ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L8184 JR L8186 -.l8184 XOR $10 -.l8186 NOP +.L8184 xor $10 +.L8186 nop JP L818A -.l818a EXX +.L818A exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L8193 JR L8195 -.l8193 XOR $10 -.l8195 ADD IX,DE +.L8193 xor $10 +.L8195 add ix,de JR C,L819B JR L819D -.l819b XOR $10 -.l819d EX AF,AF ; beware! +.L819B xor $10 +.L819D ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L81A6 JR L81A8 -.l81a6 XOR $10 -.l81a8 NOP +.L81A6 xor $10 +.L81A8 nop JP L81AC -.l81ac EXX +.L81AC exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L81B5 JR L81B7 -.l81b5 XOR $10 -.l81b7 ADD IX,DE +.L81B5 xor $10 +.L81B7 add ix,de JR C,L81BD JR L81BF -.l81bd XOR $10 -.l81bf EX AF,AF ; beware! +.L81BD xor $10 +.L81BF ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L81C8 JR L81CA -.l81c8 XOR $10 -.l81ca NOP +.L81C8 xor $10 +.L81CA nop JP L81CE -.l81ce EXX +.L81CE exx EX AF,AF ; beware! ADD HL,BC OUT ($FE),A JR C,L81D7 JR L81D9 -.l81d7 XOR $10 -.l81d9 ADD IX,DE +.L81D7 xor $10 +.L81D9 add ix,de JR C,L81DF JR L81E1 -.l81df XOR $10 -.l81e1 EX AF,AF ; beware! +.L81DF xor $10 +.L81E1 ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L81EA JR L81EC -.l81ea XOR $10 +.L81EA xor $10 -.l81ec DEC E +.L81EC dec e JP NZ,L8168 EXX @@ -324,20 +324,20 @@ OUT ($FE),A JR C,L81F9 JR L81FB -.l81f9 XOR $10 -.l81fb ADD IX,DE +.L81F9 xor $10 +.L81FB add ix,de JR C,L8201 JR L8203 -.l8201 XOR $10 -.l8203 EX AF,AF ; beware! +.L8201 xor $10 +.L8203 ex af,af ; beware! OUT ($FE),A EXX ADD HL,BC JR C,L820C JR L820E -.l820c XOR $10 +.L820C xor $10 -.l820e DEC D +.L820E dec d JP NZ,PLAY_NOTE LD (CNT_2),HL @@ -352,8 +352,8 @@ ; ************************************************************ ; * DRUMS - Synthesised ; ************************************************************ -.drums - ADD A,A ; On entry A=$75+Drum number (i.e. $76 to $7E) +.DRUMS + ADD A,A ; On entry A=$75+Drum number (i.E. $76 to $7e) LD B,0 LD C,A LD HL,DRUM_TABLE - 236 @@ -364,23 +364,23 @@ EX DE,HL JP (HL) -.drum_tone1 LD L,16 +.DRUM_TONE1 ld l,16 JR DRUM_TONE -.drum_tone2 LD L,12 +.DRUM_TONE2 ld l,12 JR DRUM_TONE -.drum_tone3 LD L,8 +.DRUM_TONE3 ld l,8 JR DRUM_TONE -.drum_tone4 LD L,6 +.DRUM_TONE4 ld l,6 JR DRUM_TONE -.drum_tone5 LD L,4 +.DRUM_TONE5 ld l,4 JR DRUM_TONE -.drum_tone6 LD L,2 -.drum_tone +.DRUM_TONE6 ld l,2 +.DRUM_TONE LD DE,3700 LD BC,$0101 //LD A,BORDER_COL xor a -.dt_loop0 OUT ($FE),A +.DT_LOOP0 out ($fe),a DEC B JR NZ,DT_LOOP1 XOR 16 @@ -390,32 +390,32 @@ ADD A,L LD C,A EX AF,AF ; beware! -.dt_loop1 DEC E +.DT_LOOP1 dec e JR NZ,DT_LOOP0 DEC D JR NZ,DT_LOOP0 JP MAIN_LOOP -.drum_noise1 LD DE,2480 +.DRUM_NOISE1 ld de,2480 LD IXL,1 JR DRUM_NOISE -.drum_noise2 LD DE,1070 +.DRUM_NOISE2 ld de,1070 LD IXL,10 JR DRUM_NOISE -.drum_noise3 LD DE,365 +.DRUM_NOISE3 ld de,365 LD IXL,101 -.drum_noise +.DRUM_NOISE LD H,D LD L,E //LD A,BORDER_COL xor a LD C,A -.dn_loop0 LD A,(HL) +.DN_LOOP0 ld a,(hl) AND 16 OR C OUT ($FE),A LD B,IXL -.dn_loop1 DJNZ DN_LOOP1 +.DN_LOOP1 djnz DN_LOOP1 INC HL DEC E JR NZ,DN_LOOP0 @@ -423,14 +423,14 @@ JR NZ,DN_LOOP0 JP MAIN_LOOP -.pattern_addr DEFW $0000 -.pattern_ptr DEFB 0 -.note_ptr DEFW $0000 +.PATTERN_ADDR defw $0000 +.PATTERN_PTR defb 0 +.NOTE_PTR defw $0000 ; ************************************************************** ; * Frequency Table ; ************************************************************** -.freq_table +.FREQ_TABLE DEFW 178,189,200,212,225,238,252,267,283,300,318,337 DEFW 357,378,401,425,450,477,505,535,567,601,637,675 DEFW 715,757,802,850,901,954,1011,1071,1135,1202,1274,1350 @@ -440,12 +440,12 @@ ; ***************************************************************** ; * Synth Drum Lookup Table ; ***************************************************************** -.drum_table +.DRUM_TABLE DEFW DRUM_TONE1,DRUM_TONE2,DRUM_TONE3,DRUM_TONE4,DRUM_TONE5,DRUM_TONE6 DEFW DRUM_NOISE1,DRUM_NOISE2,DRUM_NOISE3 -.musicdata +.MUSICDATA DEFB 0 ; Pattern loop begin * 2 DEFB 6 ; Song length * 2 DEFW 4 ; Offset to start of song (length of instrument table) @@ -453,12 +453,12 @@ DEFW 0 ; Detune DEFB 0 ; Phase -.patterndata DEFW PAT0 +.PATTERNDATA defw PAT0 DEFW PAT1 DEFW PAT1 ; *** Pattern data - $00 marks the end of a pattern *** -.pat0 +.PAT0 DEFB $BD,0 DEFB 157 DEFB 145 @@ -581,7 +581,7 @@ DEFB 188 DEFB 9 DEFB $00 -.pat1 +.PAT1 DEFB 145 DEFB 180 DEFB 3 diff --git a/examples/dogmole/dev/wyzplayer.h b/trash/blip_blep/dev/sound/wyzplayer.h similarity index 60% rename from examples/dogmole/dev/wyzplayer.h rename to trash/blip_blep/dev/sound/wyzplayer.h index dea53369..b06fedd7 100644 --- a/examples/dogmole/dev/wyzplayer.h +++ b/trash/blip_blep/dev/sound/wyzplayer.h @@ -25,61 +25,67 @@ void ISR(void) { #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } void wyz_init (void) { #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank #endasm } void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei #endasm } void __FASTCALL__ wyz_play_music (unsigned char song_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei #endasm song_playing = song_number; } void wyz_stop_sound (void) { #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei #endasm } diff --git a/trash/blip_blep/dev/tilanim.h b/trash/blip_blep/dev/tilanim.h index 3e62c5a7..cfeaafaf 100644 --- a/trash/blip_blep/dev/tilanim.h +++ b/trash/blip_blep/dev/tilanim.h @@ -2,43 +2,102 @@ // Copyleft 2010-2014, 2020 by the Mojon Twins // tilanim.h -// Rutina para animar tiles. -#define MAX_TILANIMS 64 -#define UPDATE_FREQ 7 -unsigned char max_tilanims; -unsigned char tacount; +void tilanims_reset (void) { + #asm + ld hl, _tilanims_ft + ld de, _tilanims_ft + 1 + ld bc, MAX_TILANIMS - 1 + xor a + ld (hl), a + ldir + ld (_tacount), a + ld (_tait), a + ld (_max_tilanims), a + #endasm +} + +void tilanims_add (void) { + #asm + ld de, (_max_tilanims) + ld d, 0 -typedef struct { - unsigned char xy; - unsigned char ft; -} TILANIM; + ld a, (__n) + ld hl, _tilanims_xy + add hl, de + ld (hl), a -TILANIM tilanims [MAX_TILANIMS]; + ld a, (__t) + ld hl, _tilanims_ft + add hl, de + ld (hl), a -void add_tilanim (unsigned char x, unsigned char y, unsigned char t) { - tilanims [max_tilanims].xy = (x << 4) + y; - tilanims [max_tilanims].ft = t; - - ++ max_tilanims; + ld a, e + inc a + ld (_max_tilanims), a + #endasm } -unsigned char tait; -void do_tilanims (void) { - if (max_tilanims == 0) return; - - tacount = (tacount + 1) & UPDATE_FREQ; - if (!tacount) { - // Select tile - tait = rand () % max_tilanims; - - // Flip bit 7: - tilanims [tait].ft = tilanims [tait].ft ^ 128; +void tilanims_do (void) { + #asm + ld a, (_max_tilanims) + or a + ret z + + ld a, (_tait) + add TILANIMS_PRIME + cp MAX_TILANIMS + jr c, _tilanims_tait_0_skip + sub MAX_TILANIMS + ._tilanims_tait_0_skip + ld (_tait), a + + // Check counter for tilanim #tait + ld d, 0 + ld e, a + + // Check of active + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + or a + ret z + + // Flip bit 7 + ld hl, _tilanims_ft + add hl, de + ld a, (hl) + xor 128 + ld (hl), a + + // Which tile? + bit 7, a + jr z, _tilanims_no_flick + + inc a + ._tilanims_no_flick + and 127 + ld (__t), a // Draw tile - _x = tilanims [tait].xy >> 4; - _y = tilanims [tait].xy & 15; - _t = (tilanims [tait].ft & 127) + (tilanims [tait].ft >> 7); - draw_invalidate_coloured_tile_gamearea (); - } + ld hl, _tilanims_xy + add hl, de + ld a, (hl) + ld c, a + srl a + srl a + srl a + and 0xfe + add VIEWPORT_X + ld (__x), a + + ld a, c + and 15 + sla a + add VIEWPORT_Y + ld (__y), a + + call _draw_coloured_tile + call _invalidate_tile + #endasm } diff --git a/trash/blip_blep/dev/wyzplayer.h b/trash/blip_blep/dev/wyzplayer.h deleted file mode 100644 index dea53369..00000000 --- a/trash/blip_blep/dev/wyzplayer.h +++ /dev/null @@ -1,85 +0,0 @@ -// MTE MK1 (la Churrera) v5.0 -// Copyleft 2010-2014, 2020 by the Mojon Twins - -// WYZ player hook functions - -// WYZ player and songs are loaded into RAM 1 ($C000). -// In each interrupt, we just page in RAM 1, call the player, -// then page back RAM 0 and exit. - -// The player is, thus, compiled to $C000, and its addresses -// are: - -#define WYZPLAYERINIT 0xC018 // INIT_BUFFERS EQU 0C018H -#define WYZPLAYERISR 0xC000 // INICIO EQU 0C000H -#define INICIAEFECTO 0xC47E // INICIA_EFECTO EQU 0C46BH -#define CARGA_CANCION 0xC087 // CARGA_CANCION EQU 0C087H -#define SILENCIA_PLAYER 0xC062 // PLAYER_OFF EQU 0C062H - -// Start. - -// isr -#asm - defw 0 // 2 bytes libres -#endasm - -void ISR(void) { - #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank - #endasm -} - -void wyz_init (void) { - #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank - #endasm -} - -void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei - #endasm -} - -void __FASTCALL__ wyz_play_music (unsigned char song_number) { - #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei - #endasm - song_playing = song_number; -} - -void wyz_stop_sound (void) { - #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei - #endasm -} diff --git a/trash/blip_blep/dev/zcc_opt.def b/trash/blip_blep/dev/zcc_opt.def deleted file mode 100644 index 3cbd4251..00000000 --- a/trash/blip_blep/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 61936 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/trash/blip_blep/map/mapa.MAP b/trash/blip_blep/map/mapa.MAP index 4658730f..3d523ee2 100644 Binary files a/trash/blip_blep/map/mapa.MAP and b/trash/blip_blep/map/mapa.MAP differ diff --git a/trash/blip_blep/map/mapa.fmp b/trash/blip_blep/map/mapa.fmp index ca585e9c..c8750feb 100644 Binary files a/trash/blip_blep/map/mapa.fmp and b/trash/blip_blep/map/mapa.fmp differ diff --git a/trash/mlst/bin/loader.bin b/trash/mlst/bin/loader.bin index 6ce1f798..74757e94 100644 Binary files a/trash/mlst/bin/loader.bin and b/trash/mlst/bin/loader.bin differ diff --git a/trash/mlst/dev/assets/ay_fx_numbers.h b/trash/mlst/dev/assets/ay_fx_numbers.h index 411264ac..d1c0346e 100644 --- a/trash/mlst/dev/assets/ay_fx_numbers.h +++ b/trash/mlst/dev/assets/ay_fx_numbers.h @@ -1,20 +1,42 @@ // MTE MK1 (la Churrera) v5.0 // Copyleft 2010-2014, 2020 by the Mojon Twins -#define SFX_START 0 -#define SFX_BREAKABLE_HIT 1 -#define SFX_BREAKABLE_BREAK 2 -#define SFX_PUSH_BOX 3 -#define SFX_OPEN_LOCK 3 -#define SFX_SHOOT 4 -#define SFX_OBJECT_GET 5 -#define SFX_KILL_ENEMY_STEP 6 -#define SFX_KILL_ENEMY_SHOOT 6 -#define SFX_HIT_ENEMY 7 -#define SFX_ONE_OBJECT_GET 8 -#define SFX_ONE_OBJECT_WRONG 9 -#define SFX_KEY_GET 10 -#define SFX_REFILL_GET 11 -#define SFX_JUMP 12 -#define SFX_SPIKES 13 -#define SFX_ENEMY_HIT 14 +#ifdef USE_ARKOS_PLAYER + #define SFX_START 1 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 4 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 2 + #define SFX_SPIKES 2 + #define SFX_ENEMY_HIT 8 + +#else + #define SFX_START 0 + #define SFX_BREAKABLE_HIT 1 + #define SFX_BREAKABLE_BREAK 2 + #define SFX_PUSH_BOX 3 + #define SFX_OPEN_LOCK 3 + #define SFX_SHOOT 4 + #define SFX_OBJECT_GET 5 + #define SFX_KILL_ENEMY_STEP 6 + #define SFX_KILL_ENEMY_SHOOT 6 + #define SFX_HIT_ENEMY 7 + #define SFX_ONE_OBJECT_GET 8 + #define SFX_ONE_OBJECT_WRONG 9 + #define SFX_KEY_GET 10 + #define SFX_REFILL_GET 11 + #define SFX_JUMP 12 + #define SFX_SPIKES 13 + #define SFX_ENEMY_HIT 14 + +#endif \ No newline at end of file diff --git a/trash/mlst/dev/assets/levels.h b/trash/mlst/dev/assets/levels.h index c601614a..bd29b455 100644 --- a/trash/mlst/dev/assets/levels.h +++ b/trash/mlst/dev/assets/levels.h @@ -14,7 +14,7 @@ // Map data, 75 or 150 * (MAP_W*MAP_H) bytes // Bolts, 32 * 4 = 128 bytes // Tileset, 2304 bytes -// Enemies, MAP_W * MAP_H * 3 * 10 bytes +// Enemies, MAP_W * MAP_H * MAX_ENEMS * 10 bytes // Hotspots, MAP_W * MAP_H * 3 bytes // Behs, 48 bytes // Spriteset, 2312 bytes @@ -64,7 +64,7 @@ extern unsigned char font [0]; ._font BINARY "font.bin" #endasm -extern LEVELHEADER level_data [0]; +extern LEVELHEADER level_data; #asm ._level_data defs 16 #endasm @@ -94,7 +94,7 @@ extern unsigned char tileset [0]; extern MALOTE malotes [0]; #asm - ._malotes defs MAP_W * MAP_H * 3 * 10 + ._malotes defs MAP_W * MAP_H * MAX_ENEMS * 10 #endasm extern HOTSPOT hotspots [0]; diff --git a/trash/mlst/dev/compile.bat b/trash/mlst/dev/compile.bat index b96d1905..52542aa4 100644 --- a/trash/mlst/dev/compile.bat +++ b/trash/mlst/dev/compile.bat @@ -34,7 +34,8 @@ echo Running The Librarian ..\..\..\src\utils\librarian2.exe list=..\bin\list.txt index=assets\librarian.h bins_prefix=..\bin\ rams_prefix=..\bin\ > nul echo Compilando guego -zcc +zx -vn -m mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +zcc +zx -vn mk1.c -O3 -crt0=crt.asm -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul +rem zcc +zx -vn mk1.c -o %game%.bin -lsplib2_mk2.lib -zorg=24000 > nul ..\..\..\src\utils\printsize.exe %game%.bin ..\..\..\src\utils\printsize.exe ..\script\scripts.bin diff --git a/trash/mlst/dev/crt.asm b/trash/mlst/dev/crt.asm new file mode 100644 index 00000000..27e0d47d --- /dev/null +++ b/trash/mlst/dev/crt.asm @@ -0,0 +1,17 @@ + MODULE zx82_crt0 + INCLUDE "zcc_opt.def" + XREF _main ; main() is always external to crt0 code + + IF !STACKPTR + defc STACKPTR = $FFFF + ENDIF + + IF !CRT_ORG_CODE + defc CRT_ORG_CODE = 32768 + ENDIF + + org CRT_ORG_CODE + +start: + ld sp,STACKPTR + jp _main diff --git a/trash/mlst/dev/definitions.h b/trash/mlst/dev/definitions.h index 4c74b69d..38f3bd82 100644 --- a/trash/mlst/dev/definitions.h +++ b/trash/mlst/dev/definitions.h @@ -6,7 +6,8 @@ .fsClipStruct defb 0, 24, 0, 32 #endasm -void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +//void *joyfunc = sp_JoyKeyboard; // Puntero a la función de manejo seleccionada. +unsigned int (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard; const void *joyfuncs [] = { sp_JoyKeyboard, sp_JoyKempston, sp_JoySinclair1 @@ -56,7 +57,7 @@ unsigned char enoffs; // Aux char asm_number; -unsigned int asm_int; +unsigned int asm_int @ 23302; unsigned int asm_int_2; unsigned int seed; unsigned char half_life; @@ -118,7 +119,7 @@ unsigned char p_tx, p_ty; #endif signed int ptgmx, ptgmy; -const unsigned char *spacer = " "; +unsigned char *spacer = " "; unsigned char enit; @@ -313,3 +314,5 @@ unsigned char *_gp_gen; unsigned char song_playing = 0; unsigned char player_on = 1; #endif + +unsigned char isrc; diff --git a/trash/mlst/dev/engine.h b/trash/mlst/dev/engine.h index 53120ace..bbbbfb9f 100644 --- a/trash/mlst/dev/engine.h +++ b/trash/mlst/dev/engine.h @@ -153,7 +153,7 @@ void espera_activa (int espera) { // Sonido #ifdef MODE_128K - wyz_play_sound (SFX_PUSH_BOX); + PLAY_SOUND (SFX_PUSH_BOX); #else beep_fx (2); #endif @@ -182,7 +182,7 @@ void espera_activa (int espera) { -- p_keys; #ifdef MODE_128K - wyz_play_sound (SFX_OPEN_LOCK); + PLAY_SOUND (SFX_OPEN_LOCK); #else beep_fx (8); #endif @@ -624,7 +624,8 @@ void select_joyfunc (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_START); + STOP_SOUND (); + PLAY_SOUND (SFX_START); sp_WaitForNoKey (); #endif } diff --git a/trash/mlst/dev/engine/breakable.h b/trash/mlst/dev/engine/breakable.h index cf4ab8a8..01e9423f 100644 --- a/trash/mlst/dev/engine/breakable.h +++ b/trash/mlst/dev/engine/breakable.h @@ -23,7 +23,7 @@ void break_wall (void) { #include "my/ci/on_wall_broken.h" } #ifdef MODE_128K - wyz_play_sound (gpit); + PLAY_SOUND (gpit); #else // Show what just happened before the sound interrupts the action sp_UpdateNow (); diff --git a/trash/mlst/dev/engine/bullets.h b/trash/mlst/dev/engine/bullets.h index 10be0bb8..2278b516 100644 --- a/trash/mlst/dev/engine/bullets.h +++ b/trash/mlst/dev/engine/bullets.h @@ -166,7 +166,7 @@ void bullets_fire (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_SHOOT); + PLAY_SOUND (SFX_SHOOT); #else beep_fx (6); #endif diff --git a/trash/mlst/dev/engine/c_levels.h b/trash/mlst/dev/engine/c_levels.h index 18b118a1..cbbaf91a 100644 --- a/trash/mlst/dev/engine/c_levels.h +++ b/trash/mlst/dev/engine/c_levels.h @@ -10,8 +10,8 @@ void prepare_level (void) { #endif { n_pant = level_data.scr_ini; - gpx = level_data->ini_x << 4; p_x = gpx << 6; - gpy = level_data->ini_y << 4; p_y = gpy << 6; + gpx = level_data.ini_x << 4; p_x = gpx << 6; + gpy = level_data.ini_y << 4; p_y = gpy << 6; } #ifdef ACTIVATE_SCRIPTING @@ -27,8 +27,8 @@ void prepare_level (void) { unpack ((unsigned int) levels [level].c_sprites, (unsigned int) (sprites + 16)); #endif - level_data->map_w = levels [level].map_w; - level_data->map_h = levels [level].map_h; + level_data.map_w = levels [level].map_w; + level_data.map_h = levels [level].map_h; #ifdef ACTIVATE_SCRIPTING if (script_result != 3) diff --git a/trash/mlst/dev/engine/enengine.h b/trash/mlst/dev/engine/enengine.h index b6ca7735..4acb013d 100644 --- a/trash/mlst/dev/engine/enengine.h +++ b/trash/mlst/dev/engine/enengine.h @@ -14,7 +14,7 @@ #if defined(PLAYER_STEPS_ON_ENEMIES) || defined (PLAYER_CAN_FIRE) void enems_init (void) { enit = 0; - while (enit < MAP_W * MAP_H * 3) { + while (enit < MAP_W * MAP_H * MAX_ENEMS) { malotes [enit].t = malotes [enit].t & 0xEF; // Clear bit 4 #ifdef PLAYER_CAN_FIRE malotes [enit].life = ENEMIES_LIFE_GAUGE; @@ -121,7 +121,7 @@ void enems_draw_current (void) { void enems_load (void) { // Movemos y cambiamos a los enemigos según el tipo que tengan - enoffs = n_pant * 3; + enoffs = n_pant * MAX_ENEMS; for (enit = 0; enit < MAX_ENEMS; ++ enit) { en_an_frame [enit] = 0; @@ -450,7 +450,7 @@ void enems_move (void) { #endif { #ifdef MODE_128K - wyz_play_sound (SFX_KILL_ENEMY_STEP); + PLAY_SOUND (SFX_KILL_ENEMY_STEP); en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; en_an_next_frame [enit] = sprite_17_a; @@ -549,7 +549,7 @@ void enems_move (void) { #ifdef MODE_128K en_an_state [enit] = GENERAL_DYING; en_an_count [enit] = 12; - wyz_play_sound (SFX_KILL_ENEMY_SHOOT); + PLAY_SOUND (SFX_KILL_ENEMY_SHOOT); #else beep_fx (5); en_an_next_frame [enit] = sprite_18_a; @@ -563,7 +563,7 @@ void enems_move (void) { } #ifdef MODE_128K - wyz_play_sound (SFX_HIT_ENEMY); + PLAY_SOUND (SFX_HIT_ENEMY); #else beep_fx (1); #endif diff --git a/trash/mlst/dev/engine/hotspots.h b/trash/mlst/dev/engine/hotspots.h index 10f9978c..3a1b3223 100644 --- a/trash/mlst/dev/engine/hotspots.h +++ b/trash/mlst/dev/engine/hotspots.h @@ -25,13 +25,13 @@ void hotspots_do (void) { if (p_objs == 0) { p_objs ++; #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_GET); + PLAY_SOUND (SFX_ONE_OBJECT_GET); #else beep_fx (9); #endif } else { #ifdef MODE_128K - wyz_play_sound (SFX_ONE_OBJECT_WRONG); + PLAY_SOUND (SFX_ONE_OBJECT_WRONG); #else beep_fx (4); #endif @@ -45,7 +45,7 @@ void hotspots_do (void) { #endif #ifdef MODE_128K - wyz_play_sound (SFX_OBJECT_GET); + PLAY_SOUND (SFX_OBJECT_GET); #else beep_fx (9); #endif @@ -70,7 +70,7 @@ void hotspots_do (void) { case 2: p_keys ++; #ifdef MODE_128K - wyz_play_sound (SFX_KEY_GET); + PLAY_SOUND (SFX_KEY_GET); #else beep_fx (7); #endif @@ -83,7 +83,7 @@ void hotspots_do (void) { if (p_life > PLAYER_LIFE) p_life = PLAYER_LIFE; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (8); #endif @@ -97,7 +97,7 @@ void hotspots_do (void) { else p_ammo = MAX_AMMO; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (9); #endif @@ -111,7 +111,7 @@ void hotspots_do (void) { else timer_t = 99; #ifdef MODE_128K - wyz_play_sound (SFX_REFILL_GET); + PLAY_SOUND (SFX_REFILL_GET); #else beep_fx (7); #endif @@ -122,7 +122,7 @@ void hotspots_do (void) { case 6: mem_save (); #ifdef MODE_128K - wyz_play_sound (SFX_START); + PLAY_SOUND (SFX_START); #else beep_fx (7); #endif diff --git a/trash/mlst/dev/engine/isr.h b/trash/mlst/dev/engine/isr.h new file mode 100644 index 00000000..76b5bf4a --- /dev/null +++ b/trash/mlst/dev/engine/isr.h @@ -0,0 +1,15 @@ +// MTE MK1 (la Churrera) v5.0 +// Copyleft 2010-2014, 2020 by the Mojon Twins + +// Very simple ISR which counts frames. + +#asm + defw 0 // 2 bytes libres +#endasm + +void ISR (void) { + #asm + ld hl, _isrc + inc (hl) + #endasm +} diff --git a/trash/mlst/dev/engine/player.h b/trash/mlst/dev/engine/player.h index 02467651..59844d68 100644 --- a/trash/mlst/dev/engine/player.h +++ b/trash/mlst/dev/engine/player.h @@ -404,7 +404,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -430,7 +430,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -725,19 +725,19 @@ unsigned char player_move (void) { } } - p_next_frame = player_cells [p_facing + p_frame]; + p_next_frame = (unsigned char *) (player_cells [p_facing + p_frame]); #elif defined PLAYER_BOOTEE gpit = p_facing << 2; if (p_vy == 0) { - p_next_frame = player_cells [gpit]; + p_next_frame = (unsigned char *) (player_cells [gpit]); } else if (p_vy < 0) { - p_next_frame = player_cells [gpit + 1]; + p_next_frame = (unsigned char *) (player_cells [gpit + 1]); } else { - p_next_frame = player_cells [gpit + 2]; + p_next_frame = (unsigned char *) (player_cells [gpit + 2]); } #else if (!possee && !p_gotten) { - p_next_frame = player_cells [8 + p_facing]; + p_next_frame = (unsigned char *) (player_cells [8 + p_facing]); } else { gpit = p_facing << 2; if (p_vx == 0) { @@ -745,7 +745,7 @@ unsigned char player_move (void) { } else { rda = ((gpx + 4) >> 3) & 3; } - p_next_frame = player_cells [gpit + rda]; + p_next_frame = (unsigned char *) (player_cells [gpit + rda]); } #endif } @@ -760,7 +760,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/trash/mlst/dev/engine/player_wip.h b/trash/mlst/dev/engine/player_wip.h index 8c746184..815761a3 100644 --- a/trash/mlst/dev/engine/player_wip.h +++ b/trash/mlst/dev/engine/player_wip.h @@ -504,7 +504,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -530,7 +530,7 @@ unsigned char player_move (void) { p_saltando = 1; p_cont_salto = 0; #ifdef MODE_128K - wyz_play_sound (SFX_JUMP); + PLAY_SOUND (SFX_JUMP); #else beep_fx (3); #endif @@ -860,7 +860,7 @@ void player_kill (unsigned char sound) { player_deplete (); #ifdef MODE_128K - wyz_play_sound (sound); + PLAY_SOUND (sound); #else beep_fx (sound); #endif diff --git a/trash/mlst/dev/loader/loader.asm b/trash/mlst/dev/loader/loader.asm index 641a7155..ffcd0bae 100644 --- a/trash/mlst/dev/loader/loader.asm +++ b/trash/mlst/dev/loader/loader.asm @@ -49,7 +49,7 @@ scf ld a, $ff ld ix, 24000 - ld de, 21861 + ld de, 21360 call $0556 di diff --git a/trash/mlst/dev/mainloop.h b/trash/mlst/dev/mainloop.h index c2df34b6..9875ead0 100644 --- a/trash/mlst/dev/mainloop.h +++ b/trash/mlst/dev/mainloop.h @@ -12,7 +12,7 @@ void main (void) { di #endasm - #ifdef MODE_128K + #if defined MODE_128K || defined MIN_FAPS_PER_FRAME sp_InitIM2(0xf1f1); sp_CreateGenericISR(0xf1f1); sp_RegisterHook(255, ISR); @@ -20,8 +20,15 @@ void main (void) { #asm ei #endasm + #endif + + #ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + arkos_stop(); + #else + wyz_init (); + #endif - wyz_init (); #endif cortina (); @@ -48,13 +55,13 @@ void main (void) { // Sprite creation #ifdef NO_MASKS - sp_player = sp_CreateSpr (sp_OR_SPRITE, 3, sprite_2_a); + sp_player = sp_CreateSpr (NO_MASKS, 3, sprite_2_a); sp_AddColSpr (sp_player, sprite_2_b); sp_AddColSpr (sp_player, sprite_2_c); p_current_frame = p_next_frame = sprite_2_a; - for (gpit = 0; gpit < 3; gpit ++) { - sp_moviles [gpit] = sp_CreateSpr(sp_OR_SPRITE, 3, sprite_9_a); + for (gpit = 0; gpit < MAX_ENEMS; gpit ++) { + sp_moviles [gpit] = sp_CreateSpr(NO_MASKS, 3, sprite_9_a); sp_AddColSpr (sp_moviles [gpit], sprite_9_b); sp_AddColSpr (sp_moviles [gpit], sprite_9_c); en_an_current_frame [gpit] = sprite_9_a; @@ -154,7 +161,7 @@ void main (void) { } silent_level = 0; - prepare_level (level); + prepare_level (); #endif #ifndef DIRECT_TO_PLAY @@ -179,7 +186,7 @@ void main (void) { #ifdef COMPRESSED_LEVELS if (success) { #ifdef MODE_128K - //wyz_play_music (6); + //PLAY_MUSIC (6); #endif if (silent_level == 0) zone_clear (); @@ -203,7 +210,7 @@ void main (void) { } } else { #ifdef MODE_128K - //wyz_play_music (8); + //PLAY_MUSIC (8); #endif #if defined(TIMER_ENABLE) && defined(TIMER_GAMEOVER_0) && defined(SHOW_TIMER_OVER) @@ -213,7 +220,7 @@ void main (void) { #endif #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif break; } @@ -221,7 +228,7 @@ void main (void) { if (success) { game_ending (); } else { - //wyz_play_music (8); + //PLAY_MUSIC (8); game_over (); } #endif diff --git a/trash/mlst/dev/mainloop/flick_screen.h b/trash/mlst/dev/mainloop/flick_screen.h index c1c039b9..97b4515c 100644 --- a/trash/mlst/dev/mainloop/flick_screen.h +++ b/trash/mlst/dev/mainloop/flick_screen.h @@ -13,7 +13,7 @@ } #if defined (COMPRESSED_LEVELS) - if (gpx == 224 && p_vx > 0 && x_pant < (level_data->map_w - 1)) + if (gpx == 224 && p_vx > 0 && x_pant < (level_data.map_w - 1)) #else if (gpx == 224 && p_vx > 0 && x_pant < (MAP_W - 1)) #endif @@ -27,7 +27,7 @@ #if MAP_H > 1 if (gpy == 0 && p_vy < 0 && y_pant > 0) { #if defined (COMPRESSED_LEVELS) - n_pant -= level_data->map_w; + n_pant -= level_data.map_w; #else n_pant -= MAP_W; #endif @@ -37,8 +37,8 @@ } #if defined (COMPRESSED_LEVELS) - if (gpy == 144 && p_vy > 0 && y_pant < (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (gpy == 144 && p_vy > 0 && y_pant < (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (gpy == 144 && p_vy > 0 && y_pant < (MAP_H - 1)) { n_pant += MAP_W; @@ -62,8 +62,8 @@ #if MAP_H > 1 #if defined (COMPRESSED_LEVELS) - if (gpy == 0 && p_vy < 0 && n_pant >= level_data->map_w) { - n_pant -= level_data->map_w; + if (gpy == 0 && p_vy < 0 && n_pant >= level_data.map_w) { + n_pant -= level_data.map_w; #else if (gpy == 0 && p_vy < 0 && n_pant >= MAP_W) { n_pant -= MAP_W; @@ -74,8 +74,8 @@ if (gpy == 144 && p_vy > 0) { // 9216 = 144 * 64 #if defined (COMPRESSED_LEVELS) - if (n_pant < level_data->map_w * (level_data->map_h - 1)) { - n_pant += level_data->map_w; + if (n_pant < level_data.map_w * (level_data.map_h - 1)) { + n_pant += level_data.map_w; #else if (n_pant < MAP_W * MAP_H - MAP_W) { n_pant += MAP_W; diff --git a/trash/mlst/dev/mainloop/game_loop.h b/trash/mlst/dev/mainloop/game_loop.h index b58b30c2..3f59e563 100644 --- a/trash/mlst/dev/mainloop/game_loop.h +++ b/trash/mlst/dev/mainloop/game_loop.h @@ -44,9 +44,9 @@ #ifdef MODE_128K // Play music #ifdef COMPRESSED_LEVELS - wyz_play_music (levels [level].music_id); + PLAY_MUSIC (levels [level].music_id); #else - wyz_play_music (1); + PLAY_MUSIC (1); #endif #endif @@ -76,8 +76,8 @@ #ifdef PLAYER_CHECK_MAP_BOUNDARIES #ifdef COMPRESSED_LEVELS - x_pant = n_pant % level_data->map_w; - y_pant = n_pant / level_data->map_w; + x_pant = n_pant % level_data.map_w; + y_pant = n_pant / level_data.map_w; #else x_pant = n_pant % MAP_W; y_pant = n_pant / MAP_W; #endif @@ -219,6 +219,23 @@ if (o_pant == n_pant) { #include "mainloop/update_sprites.h" + // Limit frame rate + + #ifdef MIN_FAPS_PER_FRAME + #asm + .ml_min_faps_loop + ld a, (_isrc) + cp MIN_FAPS_PER_FRAME + jr nc, ml_min_faps_loop_end + halt + jr ml_min_faps_loop + + .ml_min_faps_loop_end + xor a + ld (_isrc), a + #endasm + #endif + sp_UpdateNow(); } @@ -242,7 +259,7 @@ if (sp_KeyPressed (KEY_Z)) { if (!key_z_pressed) { #ifdef MODE_128K - wyz_play_sound (0); + PLAY_SOUND (0); #else beep_fx (2); #endif @@ -344,7 +361,7 @@ sp_WaitForNoKey (); #ifdef MODE_128K - wyz_stop_sound (); + STOP_SOUND (); #endif #include "my/ci/after_game_loop.h" diff --git a/trash/mlst/dev/mk1.c b/trash/mlst/dev/mk1.c index a1ca98d7..ba5f994d 100644 --- a/trash/mlst/dev/mk1.c +++ b/trash/mlst/dev/mk1.c @@ -59,7 +59,7 @@ #endif #endif -#define NUMBLOCKS (40 + (MAX_PROJECTILES * 5)) +#define NUMBLOCKS (((1 + MAX_ENEMS) * 10) + (MAX_PROJECTILES * 5)) unsigned char AD_FREE [NUMBLOCKS * 15]; @@ -95,9 +95,16 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #include "my/ci/extra_vars.h" #ifdef MODE_128K - #include "wyzplayer.h" + #ifdef USE_ARKOS_PLAYER + #include "sound/arkosplayer.h" + #else + #include "sound/wyzplayer.h" + #endif #else - #include "beeper.h" + #include "sound/beeper.h" + #ifdef MIN_FAPS_PER_FRAME + #include "engine/isr.h" + #endif #endif #include "printer.h" @@ -136,5 +143,5 @@ unsigned char AD_FREE [NUMBLOCKS * 15]; #ifndef MODE_128K // From beepola. Phaser engine by Shiru. - #include "music.h" + #include "sound/music.h" #endif diff --git a/trash/mlst/dev/mlst.tap b/trash/mlst/dev/mlst.tap index 1b737ead..fa9fe4db 100644 Binary files a/trash/mlst/dev/mlst.tap and b/trash/mlst/dev/mlst.tap differ diff --git a/trash/mlst/dev/my/config.h b/trash/mlst/dev/my/config.h index c137fc0e..5dc98d00 100644 --- a/trash/mlst/dev/my/config.h +++ b/trash/mlst/dev/my/config.h @@ -8,6 +8,9 @@ // ============================================================================ #define MODE_128K // Read the docs! +//#define MIN_FAPS_PER_FRAME 2 // Limits the max # of fps to 50/N +//#define USE_ARKOS_PLAYER // Use Arkos instead of Wyz player for 128k Music +//#define ARKOS_SFX_CHANNEL 0 // SFX Channel (0-2) //#define VENG_SELECTOR // Very advanced! //#define USE_MAP_CUSTOM_DECODER diff --git a/trash/mlst/dev/my/fixed_screens.h b/trash/mlst/dev/my/fixed_screens.h index 36e03655..e794b96d 100644 --- a/trash/mlst/dev/my/fixed_screens.h +++ b/trash/mlst/dev/my/fixed_screens.h @@ -36,7 +36,7 @@ void game_ending (void) { void game_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " GAME OVER! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" GAME OVER! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNow (); @@ -52,7 +52,7 @@ void game_over (void) { #if defined(TIMER_ENABLE) && defined(SHOW_TIMER_OVER) void time_over (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " TIME'S UP! "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" TIME'S UP! "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); @@ -69,7 +69,7 @@ void game_over (void) { #ifdef PAUSE_ABORT void pause_screen (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " PAUSED "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" PAUSED "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); } @@ -78,7 +78,7 @@ void game_over (void) { #ifdef COMPRESSED_LEVELS void zone_clear (void) { _x = 10; _y = 11; _t = 79; _gp_gen = spacer; print_str (); - _x = 10; _y = 12; _t = 79; _gp_gen = " ZONE CLEAR "; print_str (); + _x = 10; _y = 12; _t = 79; _gp_gen = (unsigned char *)(" ZONE CLEAR "); print_str (); _x = 10; _y = 13; _t = 79; _gp_gen = spacer; print_str (); sp_UpdateNowEx (0); espera_activa (250); diff --git a/trash/mlst/dev/my/msc.h b/trash/mlst/dev/my/msc.h index 0f5f5fb3..b16cfeec 100644 --- a/trash/mlst/dev/my/msc.h +++ b/trash/mlst/dev/my/msc.h @@ -135,7 +135,7 @@ void run_script (unsigned char whichs) { // readxy (); // sc_terminado = (flags [sc_x] != sc_y); #asm - call _read_two_bytes_d_e + call _read_two_bytes_D_E // Set sc_terminado if flags [C] != E ld b, 0 ld c, d @@ -199,9 +199,9 @@ void run_script (unsigned char whichs) { // MUSIC n sc_n = read_vbyte (); if (sc_n == 0xff) { - wyz_stop_sound (); + STOP_SOUND (); } else { - wyz_play_music (sc_n); + PLAY_MUSIC (sc_n); } break; case 0xF3: diff --git a/trash/mlst/dev/pantallas.h b/trash/mlst/dev/pantallas.h index b1fbc674..2734d92b 100644 --- a/trash/mlst/dev/pantallas.h +++ b/trash/mlst/dev/pantallas.h @@ -12,17 +12,17 @@ #asm ._s_title - BINARY "title.bin" + BINARY "..\bin\title.bin" ._s_marco #endasm #ifndef DIRECT_TO_PLAY #asm - BINARY "marco.bin" + BINARY "..\bin\marco.bin" #endasm #endif #asm ._s_ending - BINARY "ending.bin" + BINARY "..\bin\ending.bin" #endasm #endif diff --git a/trash/mlst/dev/prototypes.h b/trash/mlst/dev/prototypes.h index 62efd2b3..843aaf1a 100644 --- a/trash/mlst/dev/prototypes.h +++ b/trash/mlst/dev/prototypes.h @@ -7,6 +7,18 @@ #define ENABLE_SIMPLE_COCOS #endif +#ifdef MODE_128K + #ifdef USE_ARKOS_PLAYER + #define PLAY_MUSIC arkos_play_music + #define PLAY_SOUND arkos_play_sound + #define STOP_SOUND arkos_stop_sound + #else + #define PLAY_MUSIC wyz_play_music + #define PLAY_SOUND wyz_play_sound + #define STOP_SOUND wyz_stop_sound + #endif +#endif + // Engine // breakable.h @@ -113,9 +125,11 @@ void tilanims_add (void); void tilanims_do (void); void tilanims_reset (void); -// wyzplayer.h +#ifdef MODE_128K +// wyzplayer.h / arcos_player.h void ISR (void); -void wyz_init (void); -void wyz_play_sound (unsigned char fx_number); -void wyz_play_music (unsigned char song_number); -void wyz_stop_sound (void); +void INIT_PLAYER (void); +void PLAY_SOUND (unsigned char fx_number); +void PLAY_MUSIC (unsigned char song_number); +void STOP_SOUND (void); +#endif diff --git a/trash/mlst/dev/sound/arkos-addresses.h b/trash/mlst/dev/sound/arkos-addresses.h new file mode 100644 index 00000000..fa3225d7 --- /dev/null +++ b/trash/mlst/dev/sound/arkos-addresses.h @@ -0,0 +1,9 @@ +#define SFXS_SONG 0xd10c +#define ATINIT 0xc68c +#define ATPLAY 0xc000 +#define ATSFXINIT 0xc6f0 +#define ATSFXPLAY 0xc704 +#define ATSFXSTOP 0xc745 +#define ATSFXSTOPALL 0xc6f7 +#define ATSTOP 0xc6e1 +#define SONG_LIST 0xd5b7 diff --git a/trash/mlst/dev/sound/arkosplayer.h b/trash/mlst/dev/sound/arkosplayer.h new file mode 100644 index 00000000..c149b1b9 --- /dev/null +++ b/trash/mlst/dev/sound/arkosplayer.h @@ -0,0 +1,118 @@ +// MT Engine MK2 +// Copyleft 2014 the Mojon Twins + +// arkosplayer.h +// Arkos Player hook functions + +// This code is based on the original integration by Syx & Nightwolf +// In fact, this code IS the original integration by Syx & Nightwolf. +// I just changed the way params are passed (thanks @reidrac) +// I just automated the process & reindented to meet my own personal taste. + +#include "sound\arkos-addresses.h" + +// Start. + +// isr +#asm + defw 0 +#endasm + +void ISR(void) { + #asm + ld b, 1 + call SetRAMBank + call ATPLAY + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) + #endasm +} + +void arkos_stop (void) { + #asm + ld b, 1 + call SetRAMBank + ld a, 201 + ld (ATPLAY),A + ld b, 0 + call SetRAMBank + #endasm +} + +void __FASTCALL__ arkos_play_sound (unsigned char fx_number) { + #asm + di + ld b,1 + call SetRAMBank + + ; __FASTCALL__ -> fx_number is in l! + ld a, ARKOS_SFX_CHANNEL + ld h, 15 + ld e, 50 + ld d, 0 + ld bc, 0 + call ATSFXPLAY + + ld b,0 + call SetRAMBank + ei + #endasm +} + +void __FASTCALL__ arkos_play_music (unsigned char song_number) { + #asm + di + ld b, 1 + call SetRAMBank + + ; Reactivate sound generation + ld a, 175 + ld (ATPLAY),A + + ; Initialize song + ; __FASTCALL__ -> song_number is in l! + ld a, l + add a, a + ld hl, SONG_LIST + add a,l + jr nc, salta_inc_song + inc h + salta_inc_song: + ld l,a + ld e, (hl) + inc hl + ld d, (hl) + + call ATINIT + + ld de, SFXS_SONG + call ATSFXINIT + + ld b, 0 + call SetRAMBank + ei + #endasm +} + +void arkos_stop_sound (void) +{ + #asm + di + ld b,1 + call SetRAMBank + + call ATSFXSTOPALL + call ATSTOP + + ; Turn off sound generation + ld a,201 + ld (ATPLAY),A + + ld b,0 + call SetRAMBank + ei + #endasm +} diff --git a/trash/mlst/dev/sound/beeper.h b/trash/mlst/dev/sound/beeper.h new file mode 100644 index 00000000..e0ac0cc0 --- /dev/null +++ b/trash/mlst/dev/sound/beeper.h @@ -0,0 +1,289 @@ +// Beeper.h +// Rutinas de sonido para beeper por Shiru +// I removed di's and ei's, not needed here. +// Copyleft 2010 The Mojon Twins + +#asm + .playsfx + ;di + ld l,a + ld h,0 + add hl,hl + ld de,proclist + add hl,de + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + ld de,0 + jp (hl) + + .sound1 ;enemy destroyed + ex de,hl + ld bc,500 + .sound1l0 + ld a,(hl) + and 16 + out ($FE),a + ld e,a + inc a + sla a + sla a + .sound1l1 + dec a + jr nz,sound1l1 + out ($FE),a + ld a,e + inc a + add a,a + add a,a + add a,a + .sound1l2 + dec a + jr nz,sound1l2 + ld a,b + inc hl + dec bc + ld a,b + or c + jr nz,sound1l0 + ;ei + ret + + .sound2 ;enemy hit + ex de,hl + ld bc,40*256+100 + .sound2l0 + ld a,(hl) + and 16 + out ($FE),a + inc hl + ld a,c + .sound2l1 + dec a + jr nz,sound2l1 + out ($FE),a + ld a,c + .sound2l2 + dec a + jr nz,sound2l2 + djnz sound2l0 + ;ei + ret + + .sound3 ;something + ex de,hl + ld b,100 + ld de,$1020 + .sound3l0 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,e + .sound3l0a + dec a + jr nz,sound3l0a + djnz sound3l0 + ld b,250 + .sound3l1 + ld a,(hl) + and d + out ($FE),a + inc hl + ld a,2 + .sound3l2 + dec a + jr nz,sound3l2 + xor a + out ($FE),a + ld a,e + .sound3l3 + dec a + jr nz,sound3l3 + djnz sound3l1 + ;ei + ret + + .sound4 ;jump + ld bc,20*256+250 + .sound4l0 + ld a,16 + out ($FE),a + ld a,4 + .sound4l1 + dec a + jr nz,sound4l1 + out ($FE),a + ld a,c + .sound4l2 + dec a + jr nz,sound4l2 + dec c + dec c + djnz sound4l0 + ;ei + ret + + .sound5 ;player hit + ex de,hl + ld bc,100*256+16 + .sound5l0 + ld a,(hl) + and c + out ($FE),a + inc hl + ld a,110 + sub b + ld e,a + and c + out ($FE),a + .sound5l1 + dec e + jr nz,sound5l1 + djnz sound5l0 + ;ei + ret + + .sound6 ;enemy destroyed 2 + ex de,hl + ld bc,20*256+16 + .sound6l0 + ld a,(hl) + inc hl + and c + out ($FE),a + xor a + .sound6l0a + dec a + jr nz,sound6l0a + djnz sound6l0 + .sound6l1 + ld a,(hl) + inc hl + and c + out ($FE),a + .sound6l2 + dec a + jr nz,sound6l2 + djnz sound6l1 + ;ei + ret + + .sound7 ;shot + ex de,hl + ld bc,100*256 + .sound7l0 + ld a,(hl) + inc hl + or c + and 16 + out ($FE),a + ld a,(hl) + srl a + srl a + .sound7l1 + dec a + jr nz,sound7l1 + ld a,c + add a,4 + ld c,a + djnz sound7l0 + ;ei + ret + + .sound8 ;take item + ld a,200 + jr soundItem + .sound9 + ld a,175 + jr soundItem + .sound10 + ld a,100 + .soundItem + ld (frq),a + ld b,4 + ld d,128 + .sound8l2 + push bc + ;.frq=$+1 + ; ld bc,2*256+200 + defb 1 ;ld bc + .frq + defb 200 ;+200 + defb 2 ;2*256 + .sound8l0 + push bc + ld b,50 + .sound8l1 + xor 16 + and 16 + out ($FE),a + ld e,a + ld a,d + .sound8l2b + dec a + jr nz,sound8l2b + out ($FE),a + ld a,129 + sub d + .sound8l3 + dec a + jr nz,sound8l3 + ld a,e + ld e,c + .sound8l4 + dec e + jr nz,sound8l4 + djnz sound8l1 + pop bc + ld a,c + sub 16 + ld c,a + djnz sound8l0 + pop bc + srl d + srl d + djnz sound8l2 + ;ei + ret + + .proclist + defw sound1 + defw sound2 + defw sound3 + defw sound4 + defw sound5 + defw sound6 + defw sound7 + defw sound8 + defw sound9 + defw sound10 +#endasm + +/* + TABLA DE SONIDOS + + n Sonido + ---------- + 0 Enemy destroyed + 1 Enemy hit + 2 Something + 3 Jump + 4 Player hit + 5 Enemy destroyed 2 + 6 Shot + 7 Item #1 (item) + 8 Item #2 (key) + 9 Item #3 (life) + +*/ + +void beep_fx (unsigned char n) { + // Cargar en A el valor de n + asm_int = n; + #asm + ld a, (_asm_int) + call playsfx + #endasm +} diff --git a/trash/mlst/dev/sound/music.h b/trash/mlst/dev/sound/music.h new file mode 100644 index 00000000..db6c2b4b --- /dev/null +++ b/trash/mlst/dev/sound/music.h @@ -0,0 +1,655 @@ +#asm +; ***************************************************************************** +; * Phaser1 Engine, with synthesised drums +; * +; * Original code by Shiru - .HTTP//shiru.UNTERGRUND.NET/ +; * Modified by Chris Cowley +; * +; * Produced by Beepola v1.05.01 +; ****************************************************************************** + +.musicstart + LD HL,MUSICDATA ; <- Pointer to Music Data. change + ; this to play a different song + LD A,(HL) ; Get the loop start pointer + LD (PATTERN_LOOP_BEGIN),A + INC HL + LD A,(HL) ; Get the song end pointer + LD (PATTERN_LOOP_END),A + INC HL + LD E,(HL) + INC HL + LD D,(HL) + INC HL + LD (INSTRUM_TBL),HL + LD (CURRENT_INST),HL + ADD HL,DE + LD (PATTERN_ADDR),HL + XOR A + LD (PATTERN_PTR),A ; Set the pattern pointer to zero + LD H,A + LD L,A + LD (NOTE_PTR),HL ; Set the note offset (within this pattern) to 0 + +.PLAYER + ;DI + PUSH IY + ;LD A,BORDER_COL + xor a + LD H,$00 + LD L,A + LD (CNT_1A),HL + LD (CNT_1B),HL + LD (DIV_1A),HL + LD (DIV_1B),HL + LD (CNT_2),HL + LD (DIV_2),HL + LD (OUT_1),A + LD (OUT_2),A + JR MAIN_LOOP + +; ******************************************************************************************************** +; * NEXT_PATTERN +; * +; * Select the next pattern in sequence (and handle looping if weve reached PATTERN_LOOP_END +; * Execution falls through to PLAYNOTE to play the first note from our next pattern +; ******************************************************************************************************** +.NEXT_PATTERN + LD A,(PATTERN_PTR) + INC A + INC A + DEFB $FE ; CP n +.PATTERN_LOOP_END defb 0 + JR NZ,NO_PATTERN_LOOP + ; Handle Pattern Looping at and of song + DEFB $3E ; LD A,n +.PATTERN_LOOP_BEGIN defb 0 +.NO_PATTERN_LOOP ld (PATTERN_PTR),a + LD HL,$0000 + LD (NOTE_PTR),HL ; Start of pattern (NOTE_PTR = 0) + +.MAIN_LOOP + LD IYL,0 ; Set channel = 0 + +.READ_LOOP + LD HL,(PATTERN_ADDR) + LD A,(PATTERN_PTR) + LD E,A + LD D,0 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) ; Now DE = Start of Pattern data + LD HL,(NOTE_PTR) + INC HL ; Increment the note pointer and... + LD (NOTE_PTR),HL ; ..STORE it + DEC HL + ADD HL,DE ; Now HL = address of note data + LD A,(HL) + OR A + JR Z,NEXT_PATTERN ; select next pattern + + BIT 7,A + JP Z,RENDER ; Play the currently defined note(S) and drum + LD IYH,A + AND $3F + CP $3C + JP NC,OTHER ; Other parameters + ADD A,A + LD B,0 + LD C,A + LD HL,FREQ_TABLE + ADD HL,BC + LD E,(HL) + INC HL + LD D,(HL) + LD A,IYL ; IYL = 0 for channel 1, or = 1 for channel 2 + OR A + JR NZ,SET_NOTE2 + LD (DIV_1A),DE + EX DE,HL + + DEFB $DD,$21 ; LD IX,nn +.CURRENT_INST + DEFW $0000 + + LD A,(IX+$00) + OR A + JR Z,L809B ; Original code jumps into byte 2 of the DJNZ (invalid opcode FD) + LD B,A +.L8098 add hl,hl + DJNZ L8098 +.L809B ld e,(ix+$01) + LD D,(IX+$02) + ADD HL,DE + LD (DIV_1B),HL + LD IYL,1 ; Set channel = 1 + LD A,IYH + AND $40 + JR Z,READ_LOOP ; No phase reset + + LD HL,OUT_1 ; Reset phaser + RES 4,(HL) + LD HL,$0000 + LD (CNT_1A),HL + LD H,(IX+$03) + LD (CNT_1B),HL + JR READ_LOOP + +.SET_NOTE2 + LD (DIV_2),DE + LD A,IYH + LD HL,OUT_2 + RES 4,(HL) + LD HL,$0000 + LD (CNT_2),HL + JP READ_LOOP + +.SET_STOP + LD HL,$0000 + LD A,IYL + OR A + JR NZ,SET_STOP2 + ; Stop channel 1 note + LD (DIV_1A),HL + LD (DIV_1B),HL + LD HL,OUT_1 + RES 4,(HL) + LD IYL,1 + JP READ_LOOP +.SET_STOP2 + ; Stop channel 2 note + LD (DIV_2),HL + LD HL,OUT_2 + RES 4,(HL) + JP READ_LOOP + +.OTHER cp $3c + JR Z,SET_STOP ; Stop note + CP $3E + JR Z,SKIP_CH1 ; No changes to channel 1 + INC HL ; Instrument change + LD L,(HL) + LD H,$00 + ADD HL,HL + LD DE,(NOTE_PTR) + INC DE + LD (NOTE_PTR),DE ; Increment the note pointer + + DEFB $01 ; LD BC,nn +.INSTRUM_TBL + DEFW $0000 + + ADD HL,BC + LD (CURRENT_INST),HL + JP READ_LOOP + +.SKIP_CH1 + LD IYL,$01 + JP READ_LOOP + +.EXIT_PLAYER + LD HL,$2758 + EXX + POP IY + ;EI + RET + +.RENDER + AND $7F ; L813A + CP $76 + JP NC,DRUMS + LD D,A + EXX + DEFB $21 ; LD HL,nn +.CNT_1A defw $0000 + DEFB $DD,$21 ; LD IX,nn +.CNT_1B defw $0000 + DEFB $01 ; LD BC,nn +.DIV_1A defw $0000 + DEFB $11 ; LD DE,nn +.DIV_1B defw $0000 + DEFB $3E ; LD A,n +.OUT_1 defb $0 + EXX + EX AF,AF ; beware! + DEFB $21 ; LD HL,nn +.CNT_2 defw $0000 + DEFB $01 ; LD BC,nn +.DIV_2 defw $0000 + DEFB $3E ; LD A,n +.OUT_2 defb $00 + +.PLAY_NOTE + ; Read keyboard + LD E,A + XOR A + IN A,($FE) + OR $E0 + INC A + +.PLAYER_WAIT_KEY + JR NZ,EXIT_PLAYER + LD A,E + LD E,0 + +.L8168 exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L8171 + JR L8173 +.L8171 xor $10 +.L8173 add ix,de + JR C,L8179 + JR L817B +.L8179 xor $10 +.L817B ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L8184 + JR L8186 +.L8184 xor $10 +.L8186 nop + JP L818A + +.L818A exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L8193 + JR L8195 +.L8193 xor $10 +.L8195 add ix,de + JR C,L819B + JR L819D +.L819B xor $10 +.L819D ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L81A6 + JR L81A8 +.L81A6 xor $10 +.L81A8 nop + JP L81AC + +.L81AC exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L81B5 + JR L81B7 +.L81B5 xor $10 +.L81B7 add ix,de + JR C,L81BD + JR L81BF +.L81BD xor $10 +.L81BF ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L81C8 + JR L81CA +.L81C8 xor $10 +.L81CA nop + JP L81CE + +.L81CE exx + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L81D7 + JR L81D9 +.L81D7 xor $10 +.L81D9 add ix,de + JR C,L81DF + JR L81E1 +.L81DF xor $10 +.L81E1 ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L81EA + JR L81EC +.L81EA xor $10 + +.L81EC dec e + JP NZ,L8168 + + EXX + EX AF,AF ; beware! + ADD HL,BC + OUT ($FE),A + JR C,L81F9 + JR L81FB +.L81F9 xor $10 +.L81FB add ix,de + JR C,L8201 + JR L8203 +.L8201 xor $10 +.L8203 ex af,af ; beware! + OUT ($FE),A + EXX + ADD HL,BC + JR C,L820C + JR L820E +.L820C xor $10 + +.L820E dec d + JP NZ,PLAY_NOTE + + LD (CNT_2),HL + LD (OUT_2),A + EXX + EX AF,AF ; beware! + LD (CNT_1A),HL + LD (CNT_1B),IX + LD (OUT_1),A + JP MAIN_LOOP + +; ************************************************************ +; * DRUMS - Synthesised +; ************************************************************ +.DRUMS + ADD A,A ; On entry A=$75+Drum number (i.E. $76 to $7e) + LD B,0 + LD C,A + LD HL,DRUM_TABLE - 236 + ADD HL,BC + LD E,(HL) + INC HL + LD D,(HL) + EX DE,HL + JP (HL) + +.DRUM_TONE1 ld l,16 + JR DRUM_TONE +.DRUM_TONE2 ld l,12 + JR DRUM_TONE +.DRUM_TONE3 ld l,8 + JR DRUM_TONE +.DRUM_TONE4 ld l,6 + JR DRUM_TONE +.DRUM_TONE5 ld l,4 + JR DRUM_TONE +.DRUM_TONE6 ld l,2 +.DRUM_TONE + LD DE,3700 + LD BC,$0101 + //LD A,BORDER_COL + xor a +.DT_LOOP0 out ($fe),a + DEC B + JR NZ,DT_LOOP1 + XOR 16 + LD B,C + EX AF,AF ; beware! + LD A,C + ADD A,L + LD C,A + EX AF,AF ; beware! +.DT_LOOP1 dec e + JR NZ,DT_LOOP0 + DEC D + JR NZ,DT_LOOP0 + JP MAIN_LOOP + +.DRUM_NOISE1 ld de,2480 + LD IXL,1 + JR DRUM_NOISE +.DRUM_NOISE2 ld de,1070 + LD IXL,10 + JR DRUM_NOISE +.DRUM_NOISE3 ld de,365 + LD IXL,101 +.DRUM_NOISE + LD H,D + LD L,E + //LD A,BORDER_COL + xor a + LD C,A +.DN_LOOP0 ld a,(hl) + AND 16 + OR C + OUT ($FE),A + LD B,IXL +.DN_LOOP1 djnz DN_LOOP1 + INC HL + DEC E + JR NZ,DN_LOOP0 + DEC D + JR NZ,DN_LOOP0 + JP MAIN_LOOP + +.PATTERN_ADDR defw $0000 +.PATTERN_PTR defb 0 +.NOTE_PTR defw $0000 + +; ************************************************************** +; * Frequency Table +; ************************************************************** +.FREQ_TABLE + DEFW 178,189,200,212,225,238,252,267,283,300,318,337 + DEFW 357,378,401,425,450,477,505,535,567,601,637,675 + DEFW 715,757,802,850,901,954,1011,1071,1135,1202,1274,1350 + DEFW 1430,1515,1605,1701,1802,1909,2023,2143,2270,2405,2548,2700 + DEFW 2860,3030,3211,3402,3604,3818,4046,4286,4541,4811,5097,5400 + +; ***************************************************************** +; * Synth Drum Lookup Table +; ***************************************************************** +.DRUM_TABLE + DEFW DRUM_TONE1,DRUM_TONE2,DRUM_TONE3,DRUM_TONE4,DRUM_TONE5,DRUM_TONE6 + DEFW DRUM_NOISE1,DRUM_NOISE2,DRUM_NOISE3 + + +.MUSICDATA + DEFB 0 ; Pattern loop begin * 2 + DEFB 6 ; Song length * 2 + DEFW 4 ; Offset to start of song (length of instrument table) + DEFB 1 ; Multiple + DEFW 0 ; Detune + DEFB 0 ; Phase + +.PATTERNDATA defw PAT0 + DEFW PAT1 + DEFW PAT1 + +; *** Pattern data - $00 marks the end of a pattern *** +.PAT0 + DEFB $BD,0 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 156 + DEFB 144 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 159 + DEFB 147 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 3 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB 157 + DEFB 145 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB $00 +.PAT1 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 188 + DEFB 180 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 188 + DEFB 180 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 147 + DEFB 181 + DEFB 3 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 190 + DEFB 178 + DEFB 3 + DEFB 188 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 188 + DEFB 178 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 188 + DEFB 178 + DEFB 3 + DEFB 190 + DEFB 188 + DEFB 6 + DEFB 144 + DEFB 178 + DEFB 3 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 147 + DEFB 181 + DEFB 3 + DEFB 145 + DEFB 180 + DEFB 3 + DEFB 188 + DEFB 188 + DEFB 9 + DEFB $00 + +#endasm \ No newline at end of file diff --git a/examples/dogmole_ci/dev/wyzplayer.h b/trash/mlst/dev/sound/wyzplayer.h similarity index 60% rename from examples/dogmole_ci/dev/wyzplayer.h rename to trash/mlst/dev/sound/wyzplayer.h index dea53369..b06fedd7 100644 --- a/examples/dogmole_ci/dev/wyzplayer.h +++ b/trash/mlst/dev/sound/wyzplayer.h @@ -25,61 +25,67 @@ void ISR(void) { #asm - ld b, 1 - call SetRAMBank - call WYZPLAYERISR - ld b, 0 - call SetRAMBank + ld a, (_player_on) + or a + ret z + ld b, 1 + call SetRAMBank + call WYZPLAYERISR + ld b, 0 + call SetRAMBank + + ld hl, _isrc + inc (hl) #endasm } void wyz_init (void) { #asm - ld b,1 - call SetRAMBank - call WYZPLAYERINIT - ld b,0 - call SetRAMBank + ld b,1 + call SetRAMBank + call WYZPLAYERINIT + ld b,0 + call SetRAMBank #endasm } void __FASTCALL__ wyz_play_sound (unsigned char fx_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> fx_number is in l! - ld b, l - call INICIAEFECTO - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> fx_number is in l! + ld b, l + call INICIAEFECTO + ld b, 0 + call SetRAMBank + ei #endasm } void __FASTCALL__ wyz_play_music (unsigned char song_number) { #asm - di - ld b, 1 - call SetRAMBank - ; __FASTCALL__ -> song_number is in l! - ld a, l - call CARGA_CANCION - ld b, 0 - call SetRAMBank - ei + di + ld b, 1 + call SetRAMBank + ; __FASTCALL__ -> song_number is in l! + ld a, l + call CARGA_CANCION + ld b, 0 + call SetRAMBank + ei #endasm song_playing = song_number; } void wyz_stop_sound (void) { #asm - di - ld b,1 - call SetRAMBank - call SILENCIA_PLAYER - ld b,0 - call SetRAMBank - ei + di + ld b,1 + call SetRAMBank + call SILENCIA_PLAYER + ld b,0 + call SetRAMBank + ei #endasm } diff --git a/trash/mlst/dev/zcc_opt.def b/trash/mlst/dev/zcc_opt.def deleted file mode 100644 index 4e0a9518..00000000 --- a/trash/mlst/dev/zcc_opt.def +++ /dev/null @@ -1,8 +0,0 @@ - -IF !DEFINED_STACKPTR - defc DEFINED_STACKPTR = 1 - defc STACKPTR = 23999 -ENDIF - - DEFINE DEFINED_myzorg - defc myzorg = 24000 diff --git a/trash/mlst/script/msc.h b/trash/mlst/script/msc.h index 0f5f5fb3..b16cfeec 100644 --- a/trash/mlst/script/msc.h +++ b/trash/mlst/script/msc.h @@ -135,7 +135,7 @@ void run_script (unsigned char whichs) { // readxy (); // sc_terminado = (flags [sc_x] != sc_y); #asm - call _read_two_bytes_d_e + call _read_two_bytes_D_E // Set sc_terminado if flags [C] != E ld b, 0 ld c, d @@ -199,9 +199,9 @@ void run_script (unsigned char whichs) { // MUSIC n sc_n = read_vbyte (); if (sc_n == 0xff) { - wyz_stop_sound (); + STOP_SOUND (); } else { - wyz_play_music (sc_n); + PLAY_MUSIC (sc_n); } break; case 0xF3: