59 lines
		
	
	
		
			No EOL
		
	
	
		
			1,000 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			No EOL
		
	
	
		
			1,000 B
		
	
	
	
		
			C
		
	
	
	
	
	
// main
 | 
						|
 | 
						|
#include <genesis.h>
 | 
						|
#include <resources.h>
 | 
						|
 | 
						|
#include "global.h"
 | 
						|
#include "structs.h"
 | 
						|
#include "controls.h"
 | 
						|
#include "start.h"
 | 
						|
#include "background.h"
 | 
						|
#include "foreground.h"
 | 
						|
#include "bullets.h"
 | 
						|
#include "player.h"
 | 
						|
#include "chrome.h"
 | 
						|
 | 
						|
// game loop
 | 
						|
 | 
						|
static void loadInternals(){
 | 
						|
	JOY_init();
 | 
						|
	JOY_setEventHandler(&updateControls);
 | 
						|
	SPR_init(127, 0, 0);
 | 
						|
	VDP_setPalette(PAL1, nitori.palette -> data);
 | 
						|
	VDP_setPalette(PAL2, wall1.palette -> data);
 | 
						|
	VDP_setPalette(PAL3, font.palette -> data);
 | 
						|
	VDP_loadFont(font.tileset, DMA);
 | 
						|
	VDP_setTextPalette(3);
 | 
						|
}
 | 
						|
 | 
						|
void loadGame(){
 | 
						|
	started = TRUE;
 | 
						|
	loadBg();
 | 
						|
	loadChrome();
 | 
						|
	loadFg();
 | 
						|
	loadPlayer();
 | 
						|
}
 | 
						|
 | 
						|
static void updateGame(){
 | 
						|
	updatePlayer();
 | 
						|
	updateBullets();
 | 
						|
	updateBg();
 | 
						|
	updateFg();
 | 
						|
	updateChrome();
 | 
						|
	clock++;
 | 
						|
	if(clock >= CLOCK_LIMIT) clock -= CLOCK_LIMIT;
 | 
						|
}
 | 
						|
 | 
						|
// main loop
 | 
						|
 | 
						|
int main(){
 | 
						|
	loadInternals();
 | 
						|
	// loadGame();
 | 
						|
	loadStart();
 | 
						|
	while(1){
 | 
						|
		started ? updateGame() : updateStart();
 | 
						|
		SPR_update();
 | 
						|
		SYS_doVBlankProcess();
 | 
						|
	}
 | 
						|
	return(0);
 | 
						|
} |