mirror of
https://codeberg.org/hkzlab/TK2048.git
synced 2026-01-20 05:50:51 +11:00
Merged dii_refactoring, modularize code for 2.0
This commit is contained in:
parent
5d739383aa
commit
cfc455f1ca
37 changed files with 2101 additions and 249 deletions
64
src/dlog_main.c
Normal file
64
src/dlog_main.c
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include <stubs.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <calypsi/intrinsics6502.h>
|
||||
|
||||
#include "game_graphics.h"
|
||||
#include "monitor_subroutines.h"
|
||||
#include "utility.h"
|
||||
#include "mem_map.h"
|
||||
#include "shared_page.h"
|
||||
#include "state_page.h"
|
||||
#include "dlog_data.h"
|
||||
#include "game_data.h"
|
||||
#include "input.h"
|
||||
#include "sound.h"
|
||||
|
||||
// External initialization requirements
|
||||
#pragma require __preserve_zp
|
||||
#pragma require __data_initialization_needed
|
||||
|
||||
static state_page_data* state_page = (state_page_data*)STATE_PAGE;
|
||||
static shared_page_data *shared_page = (shared_page_data*)SHARED_PAGE;
|
||||
|
||||
void main(void) {
|
||||
dlog_data *dld = (dlog_data *)(shared_page->module_data);
|
||||
game_data *gad = (game_data *)(shared_page->module_data);
|
||||
|
||||
// Make sure the buffers are pointing to the correct memory
|
||||
initialize_display_buffers();
|
||||
|
||||
switch(dld->mode) {
|
||||
case DLOG_MODE_WIN:
|
||||
snd_festive();
|
||||
ddraw_endgame_box(1, dld->score, state_page->hi_score);
|
||||
break;
|
||||
case DLOG_MODE_LOSE:
|
||||
snd_sad_scale();
|
||||
ddraw_endgame_box(-1, dld->score, state_page->hi_score);
|
||||
break;
|
||||
default:
|
||||
case DLOG_MODE_START:
|
||||
ddraw_endgame_box(0, dld->score, state_page->hi_score);
|
||||
snd_start();
|
||||
break;
|
||||
};
|
||||
|
||||
if(dld->score > state_page->hi_score) { // New high-score. We need to save it.
|
||||
state_page->hi_score = dld->score;
|
||||
shared_page->master_command = MASTER_COMMAND_SAVE;
|
||||
} else {
|
||||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
}
|
||||
|
||||
shared_page->next_module_idx = 4; // Go to the GAME module
|
||||
gad->mode = GAME_MODE_NORMAL; // Set the proper start mode for the game
|
||||
|
||||
while(!read_any_key()) {
|
||||
lfsr_update();
|
||||
}
|
||||
|
||||
snd_mod_button();
|
||||
|
||||
return;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue