Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions corescape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
#include "status.h"
#include "intro.h"

#define NOP __asm{nop}
#define SEI __asm{sei}
#define CLI __asm{cli}

static char LevelText[] = S"STAGE 1";
static char GameOverText[] = S"GAMEOVER";

bool trainer_mode, level_skip, level_retry, restart;
bool cheating;
bool second_fire, previous_second_fire;

struct Level
{
Expand Down Expand Up @@ -70,6 +75,33 @@ const char PausedColors[] = {
VCOL_ORANGE, VCOL_RED, VCOL_PURPLE, VCOL_BLUE
};

void check_second_fire(void)
{
byte* JoyReg = (byte*)0xDC00;
byte* CtrlPort = (byte*)0xD419;
byte b;

previous_second_fire = second_fire;

SEI
JoyReg[2] = 0xC0;
NOP
b = JoyReg[0];
b = b & 0b00111111;
b = b | 0b10000000;
JoyReg[0] = b;
for (byte c = 0; c < 20; c++)
NOP

b = CtrlPort[0];
CLI
if (b < 16) second_fire = true;
else second_fire = false;
JoyReg[0] = 0x7F;
JoyReg[2] = 0xFF;
}


void game_pause(void)
{
// Silence during pause
Expand Down Expand Up @@ -107,6 +139,12 @@ void game_pause(void)
keyb_poll();
if (keyb_key == (KSCAN_SPACE | KSCAN_QUAL_DOWN))
break;

// ... or second fire to continue
check_second_fire();
if (second_fire && !previous_second_fire)
break;

}

// Hide pause text sprited
Expand Down Expand Up @@ -161,8 +199,13 @@ void game_keyboard(void)

}
}
//check Second Fire
check_second_fire();
if (second_fire && !previous_second_fire)
game_pause();
}


void game_play(void)
{
// Undo all cheat modes at a new start
Expand Down
2 changes: 1 addition & 1 deletion gamemusic.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ void music_toggle(void)

void music_volume(char volume)
{
*(volatile char *)0xa15d = volume;
*(volatile char*)0xD418 = volume;
}
2 changes: 1 addition & 1 deletion intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static const char ScrollText[] =
S"--- CODING AND GRAPHICS BY \y83DR.MORTAL WOMBAT\y80 "
S"--- JOYSTICK IN PORT \y812\y80 "
S"--- BUTTON TO START "
S"--- SPACE TO PAUSE "
S"--- SPACE OR 2ND FIRE TO PAUSE "
S"--- CHEATS: \y81S\y82KIP, \y81T\y82RAINER, \y81L\y82IVE, \y81R\y82ETRY, \y81H\y82ALFSPEED \y80"
S"--- NO HIGHSCORE WHEN CHEATING :) --- ";

Expand Down