mirror of https://github.com/jeremysrand/BuGS.git
Add a way to swap left and right stereo channels and save the value in the settings.
This commit is contained in:
parent
1cd301548a
commit
6947d8762c
31
BuGS/game.s
31
BuGS/game.s
|
@ -754,6 +754,29 @@ gameOver entry
|
||||||
_setGameTile TILE_EMPTY
|
_setGameTile TILE_EMPTY
|
||||||
_setGameTile TILE_EMPTY
|
_setGameTile TILE_EMPTY
|
||||||
_setGameTile TILE_EMPTY
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_LETTER_S
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_LETTER_T
|
||||||
|
_setGameTile TILE_LETTER_O
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_LETTER_S
|
||||||
|
_setGameTile TILE_LETTER_W
|
||||||
|
_setGameTile TILE_LETTER_A
|
||||||
|
_setGameTile TILE_LETTER_P
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_LETTER_S
|
||||||
|
_setGameTile TILE_LETTER_T
|
||||||
|
_setGameTile TILE_LETTER_E
|
||||||
|
_setGameTile TILE_LETTER_R
|
||||||
|
_setGameTile TILE_LETTER_E
|
||||||
|
_setGameTile TILE_LETTER_O
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
|
||||||
|
ldx #GAME_NUM_TILES_WIDE*40+2
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
|
_setGameTile TILE_EMPTY
|
||||||
_setGameTile TILE_LETTER_Q
|
_setGameTile TILE_LETTER_Q
|
||||||
_setGameTile TILE_EMPTY
|
_setGameTile TILE_EMPTY
|
||||||
_setGameTile TILE_LETTER_T
|
_setGameTile TILE_LETTER_T
|
||||||
|
@ -798,6 +821,11 @@ checkKey_loop2 anop
|
||||||
|
|
||||||
cmp #'2'
|
cmp #'2'
|
||||||
beq checkKey_game
|
beq checkKey_game
|
||||||
|
|
||||||
|
cmp #'s'
|
||||||
|
beq checkKey_swapStereo
|
||||||
|
cmp #'S'
|
||||||
|
beq checkKey_swapStereo
|
||||||
|
|
||||||
checkKey_done anop
|
checkKey_done anop
|
||||||
long i,m
|
long i,m
|
||||||
|
@ -814,6 +842,9 @@ checkKey_game anop
|
||||||
sec
|
sec
|
||||||
sbc #'1'
|
sbc #'1'
|
||||||
jmp startGame
|
jmp startGame
|
||||||
|
|
||||||
|
checkKey_swapStereo anop
|
||||||
|
jmp swapStereoSettings
|
||||||
|
|
||||||
|
|
||||||
waitForKey entry
|
waitForKey entry
|
||||||
|
|
|
@ -1293,6 +1293,19 @@ unpauseSound_skipSegment anop
|
||||||
unpauseSound_skipFlea anop
|
unpauseSound_skipFlea anop
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
|
||||||
|
swapStereoChannels entry
|
||||||
|
ldx #SIZEOF_TILE_INFO*NUM_GAME_TILES-SIZEOF_TILE_INFO
|
||||||
|
swapStereoChannels_loop anop
|
||||||
|
lda tileRightVolume,x
|
||||||
|
eor #$ff
|
||||||
|
sta tileRightVolume,x
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
bpl swapStereoChannels_loop
|
||||||
|
|
||||||
|
rtl
|
||||||
|
|
||||||
|
|
||||||
bonusSoundOscReg dc i2'SOUND_REG_CONTROL+BONUS_OSC_NUM'
|
bonusSoundOscReg dc i2'SOUND_REG_CONTROL+BONUS_OSC_NUM'
|
||||||
fleaSoundIsPlaying dc i2'1'
|
fleaSoundIsPlaying dc i2'1'
|
||||||
|
|
81
BuGS/main.c
81
BuGS/main.c
|
@ -52,13 +52,38 @@ typedef struct tSettingsData
|
||||||
|
|
||||||
unsigned int userid;
|
unsigned int userid;
|
||||||
unsigned int randomSeed;
|
unsigned int randomSeed;
|
||||||
tSettingsData settings;
|
tSettingsData settings = {
|
||||||
|
{ 'B', 'u', 'G', 'S' },
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
{
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}},
|
||||||
|
{ 0, { ' ', ' ', ' '}}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RefNumRecGS closeRec;
|
||||||
|
OpenRecGS openRec;
|
||||||
|
IORecGS readRec;
|
||||||
|
CreateRecGS createRec;
|
||||||
|
IORecGS writeRec;
|
||||||
|
NameRecGS destroyRec;
|
||||||
Handle filenameHandle = NULL;
|
Handle filenameHandle = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Implementation */
|
/* Implementation */
|
||||||
|
|
||||||
|
|
||||||
|
extern void swapStereoChannels(void);
|
||||||
|
|
||||||
|
|
||||||
word randomMushroomOffset(void)
|
word randomMushroomOffset(void)
|
||||||
{
|
{
|
||||||
/* We do not put mushrooms in the bottom tile so we subtract the width here to find
|
/* We do not put mushrooms in the bottom tile so we subtract the width here to find
|
||||||
|
@ -164,37 +189,8 @@ void allocateFilenameHandle(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void initSettings(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
tHighScore *scorePtr;
|
|
||||||
|
|
||||||
settings.magic[0] = 'B';
|
|
||||||
settings.magic[1] = 'u';
|
|
||||||
settings.magic[2] = 'G';
|
|
||||||
settings.magic[3] = 'S';
|
|
||||||
|
|
||||||
settings.version = 0;
|
|
||||||
|
|
||||||
settings.swapStereo = FALSE;
|
|
||||||
|
|
||||||
scorePtr = &(settings.highScores[0]);
|
|
||||||
for (i = 0; i < NUM_HIGH_SCORES; i++);
|
|
||||||
{
|
|
||||||
scorePtr->score = 0;
|
|
||||||
scorePtr->who[0] = ' ';
|
|
||||||
scorePtr->who[1] = ' ';
|
|
||||||
scorePtr->who[2] = ' ';
|
|
||||||
|
|
||||||
scorePtr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void deleteSettings(void)
|
void deleteSettings(void)
|
||||||
{
|
{
|
||||||
NameRecGS destroyRec;
|
|
||||||
|
|
||||||
allocateFilenameHandle();
|
allocateFilenameHandle();
|
||||||
HLock(filenameHandle);
|
HLock(filenameHandle);
|
||||||
|
|
||||||
|
@ -208,10 +204,6 @@ void deleteSettings(void)
|
||||||
|
|
||||||
void saveSettings(void)
|
void saveSettings(void)
|
||||||
{
|
{
|
||||||
RefNumRecGS closeRec;
|
|
||||||
CreateRecGS createRec;
|
|
||||||
OpenRecGS openRec;
|
|
||||||
IORecGS writeRec;
|
|
||||||
BOOLEAN success = false;
|
BOOLEAN success = false;
|
||||||
|
|
||||||
deleteSettings();
|
deleteSettings();
|
||||||
|
@ -259,9 +251,6 @@ void saveSettings(void)
|
||||||
|
|
||||||
BOOLEAN loadSettings(void)
|
BOOLEAN loadSettings(void)
|
||||||
{
|
{
|
||||||
RefNumRecGS closeRec;
|
|
||||||
OpenRecGS openRec;
|
|
||||||
IORecGS readRec;
|
|
||||||
BOOLEAN success = FALSE;
|
BOOLEAN success = FALSE;
|
||||||
|
|
||||||
allocateFilenameHandle();
|
allocateFilenameHandle();
|
||||||
|
@ -280,6 +269,7 @@ BOOLEAN loadSettings(void)
|
||||||
readRec.refNum = openRec.refNum;
|
readRec.refNum = openRec.refNum;
|
||||||
readRec.dataBuffer = (Pointer)&settings;
|
readRec.dataBuffer = (Pointer)&settings;
|
||||||
readRec.requestCount = sizeof(tSettingsData);
|
readRec.requestCount = sizeof(tSettingsData);
|
||||||
|
ReadGS(&readRec);
|
||||||
success = (toolerror() == 0);
|
success = (toolerror() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,10 +289,26 @@ BOOLEAN loadSettings(void)
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
if (settings.swapStereo)
|
||||||
|
{
|
||||||
|
swapStereoChannels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void swapStereoSettings(void)
|
||||||
|
{
|
||||||
|
swapStereoChannels();
|
||||||
|
settings.swapStereo = !settings.swapStereo;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int event;
|
int event;
|
||||||
|
@ -332,7 +338,6 @@ int main(void)
|
||||||
InitMouse(0);
|
InitMouse(0);
|
||||||
SetMouse(transparent);
|
SetMouse(transparent);
|
||||||
|
|
||||||
initSettings();
|
|
||||||
if (!loadSettings())
|
if (!loadSettings())
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|
||||||
|
|
1
TODO.md
1
TODO.md
|
@ -4,6 +4,5 @@ TODO
|
||||||
* Implement a high score list and save the high scores across restarts
|
* Implement a high score list and save the high scores across restarts
|
||||||
* Look at supporting a global high score list for systems with an Internet connection
|
* Look at supporting a global high score list for systems with an Internet connection
|
||||||
* Implement the code for supporting a two player game
|
* Implement the code for supporting a two player game
|
||||||
* Provide a way to swap left and right stereo channels
|
|
||||||
* Look at supporting Versions in order to support automatic SW upgrades
|
* Look at supporting Versions in order to support automatic SW upgrades
|
||||||
* So much more.
|
* So much more.
|
||||||
|
|
Loading…
Reference in New Issue