Bruh? 😳

This commit is contained in:
2022-01-08 21:44:02 -08:00
parent 36ad463505
commit c426d0e929
21 changed files with 445 additions and 46 deletions

View File

@@ -5,48 +5,58 @@
* https://opensource.org/licenses/MIT
*/
#include "libs.h"
#include "textbox.h"
#include "time.h"
#include "common_tiles.h"
#include "memory.h"
#include "HELLO.h"
#include "main.h"
void main() {
int16_t j;
uint8_t filled[0x20*0x20];
uint8_t filled[GB_BACKGROUND_COLUMNS*GB_BACKGROUND_ROWS];
// Set up the GAMEBOY's registers.
disable_interrupts();
DISPLAY_OFF;
LCDC_REG = LCDCF_OFF | LCDCF_WIN9C00 | LCDCF_BG8800 | LCDCF_BG9800 | LCDCF_BGON;
BGP_REG = OBP0_REG = OBP1_REG = 0xE4U;
BGP_REG = 0xE4U;
// Prepare tiles.
// Init the random seed
initarand(DIV_REG);
// Prepare time and input
TIME_CURRENT = 0;
INPUT_STATE = joypad();
// Init things
commonTilesInit();
textboxInit();
set_bkg_data(SM_DATA_POSITION, SM_IMAGE_TILES, SM_IMAGE);
conversationTextboxInit();
conversationPauseInit();
conversationQueueInit();
pokerInit();
// Fill screen white
for(j = 0; j < 0x20*0x20; j++) filled[j] = COMMON_TILE_3;
set_bkg_tiles(0x00, 0x00, 0x20, 0x20, filled);
uint8_t sm[SM_IMAGE_TILES];
for(j = 0; j < SM_IMAGE_TILES; j++) sm[j] = j + SM_DATA_POSITION;
set_bkg_tiles(0x00, 0x00, SM_IMAGE_COLUMNS, SM_IMAGE_ROWS, sm);
set_bkg_tiles(0x00, 0x00, GB_BACKGROUND_COLUMNS, GB_BACKGROUND_ROWS, filled);
SCX_REG = 0x00;
SCY_REG = 0x00;
// Now turn the screen on
DISPLAY_ON;
enable_interrupts();
wait_vbl_done();
// Testing.
textboxSetText(STR_HELLO_DATA, STR_HELLO_LENGTH);
// Alright begin the game logic here.
conversationQueueNext();
// Begin the loop
while(1) {
// Wait for VSYNC
wait_vbl_done();
textboxUpdate();
time++;
// Update the input state
INPUT_STATE = joypad();
conversationTextboxUpdate();
conversationPauseUpdate();
// Tick time.
TIME_CURRENT++;
}
}