moved to different file

This commit is contained in:
2026-05-15 23:23:16 -05:00
parent d1e7a2e605
commit e8428b0d7e
10 changed files with 335 additions and 353 deletions

13
inc/title_screen.h Normal file
View File

@@ -0,0 +1,13 @@
#include <genesis.h>
#ifndef TITLE_SCREEN_H_
#define TITLE_SCREEN_H_
extern Sprite* player_sprite;
extern s16 tile_scroll_array [];
extern void init_title_screen();
extern void update_title_screen();
extern void draw_title_screen();
#endif // TITLE_SCREEN_H

Binary file not shown.

Binary file not shown.

View File

@@ -17,4 +17,4 @@ out/src/Main.o: src/Main.c c:/SGDK/inc/genesis.h c:/SGDK/inc/types.h \
c:/SGDK/inc/task_cst.h c:/SGDK/inc/ext/flash-save/flash.h \
c:/SGDK/inc/types.h c:/SGDK/inc/ext/flash-save/saveman.h \
c:/SGDK/inc/ext/console.h c:/SGDK/inc/config.h c:/SGDK/inc/string.h \
c:/SGDK/inc/maths.h c:/SGDK/inc/dma.h res/resources.h
c:/SGDK/inc/maths.h c:/SGDK/inc/dma.h res/resources.h inc/title_screen.h

Binary file not shown.

21
out/src/title_screen.d Normal file
View File

@@ -0,0 +1,21 @@
out/src/title_screen.o: src/title_screen.c c:/SGDK/inc/genesis.h \
c:/SGDK/inc/types.h c:/SGDK/inc/config.h c:/SGDK/inc/asm.h \
c:/SGDK/inc/sys.h c:/SGDK/inc/sram.h c:/SGDK/inc/mapper.h \
c:/SGDK/inc/memory.h c:/SGDK/inc/memory_base.h c:/SGDK/inc/tools.h \
c:/SGDK/inc/bmp.h c:/SGDK/inc/maths.h c:/SGDK/inc/vdp.h \
c:/SGDK/inc/pal.h c:/SGDK/inc/dma.h c:/SGDK/inc/vdp_tile.h \
c:/SGDK/inc/vdp_bg.h c:/SGDK/inc/map.h c:/SGDK/inc/pool.h \
c:/SGDK/inc/object.h c:/SGDK/inc/font.h c:/SGDK/res/libres.h \
c:/SGDK/inc/string.h c:/SGDK/inc/tab_cnv.h c:/SGDK/inc/maths3D.h \
c:/SGDK/inc/vdp_spr.h c:/SGDK/inc/vdp_pal.h c:/SGDK/inc/vram.h \
c:/SGDK/inc/sprite_eng.h c:/SGDK/inc/sprite_eng_legacy.h \
c:/SGDK/inc/z80_ctrl.h c:/SGDK/inc/ym2612.h c:/SGDK/inc/psg.h \
c:/SGDK/inc/snd/sound.h c:/SGDK/inc/snd/xgm.h c:/SGDK/inc/snd/xgm2.h \
c:/SGDK/inc/snd/smp_null.h c:/SGDK/inc/snd/smp_null_dpcm.h \
c:/SGDK/inc/snd/pcm/snd_pcm.h c:/SGDK/inc/snd/pcm/snd_dpcm2.h \
c:/SGDK/inc/snd/pcm/snd_pcm4.h c:/SGDK/inc/joy.h c:/SGDK/inc/timer.h \
c:/SGDK/inc/task.h c:/SGDK/inc/task_cst.h \
c:/SGDK/inc/ext/flash-save/flash.h c:/SGDK/inc/types.h \
c:/SGDK/inc/ext/flash-save/saveman.h c:/SGDK/inc/ext/console.h \
c:/SGDK/inc/config.h c:/SGDK/inc/string.h c:/SGDK/inc/maths.h \
c:/SGDK/inc/dma.h res/resources.h inc/title_screen.h

BIN
out/src/title_screen.o Normal file

Binary file not shown.

View File

@@ -4,7 +4,7 @@
00000020 a bigTex1_palette_data_size
00000020 a font_pal_default_data_size
00000020 a sgdk_logo_palette_data_size
00000044 A _sdata
00000048 A _sdata
00000080 a bg1_palette_data_size
00000080 a bgtest_palette_data_size
000000ac A stop_xgm_size
@@ -450,78 +450,78 @@
0000846e t internal_reset
000085b4 t VDP_drawImageEx.constprop.0.isra.0
000086fc t main.isra.0
00008c04 T _start_entry
00008cca T _reset_entry
00008cd2 T XGM_doVBlankProcess
00008d38 T MDDBG__SymbolDataPtr
00008d3c t __ErrorHandler
00008d3c t MDDBG__ErrorHandler
00008e64 t MDDBG__Error_IdleLoop
00008e7e t MDDBG__Error_InitConsole
00008e8a t MDDBG__Error_MaskStackBoundaries
00008ef4 t MDDBG__Error_DrawOffsetLocation
00008ef8 t MDDBG__Error_DrawOffsetLocation2
00008efe t MDDBG__Error_DrawOffsetLocation__inj
00008f8c t MDDBG__ErrorHandler_SetupVDP
00008fc2 t MDDBG__ErrorHandler_VDPConfig
00008fd8 t MDDBG__ErrorHandler_VDPConfig_Nametables
00009014 t MDDBG__ErrorHandler_ConsoleConfig_Initial
00009018 t MDDBG__ErrorHandler_ConsoleConfig_Shared
00009048 t MDDBG__Str_OffsetLocation_24bit
00009051 t MDDBG__Str_OffsetLocation_32bit
0000908c t MDDBG__Art1bpp_Font
00009386 t MDDBG__GetSymbolByOffset
000096a0 t MDDBG__FormatString
0000977a t MDDBG__Console_Init
000097b8 t MDDBG__Console_Reset
000097ba t MDDBG__Console_InitShared
00009804 t MDDBG__Console_SetPosAsXY_Stack
0000980a t MDDBG__Console_SetPosAsXY
0000983e t MDDBG__Console_GetPosAsXY
00009864 t MDDBG__Console_StartNewLine
00009892 t MDDBG__Console_SetBasePattern
000098ae t MDDBG__Console_SetWidth
000098cc t MDDBG__Console_WriteLine_WithPattern
000098ce t MDDBG__Console_WriteLine
000098d2 t MDDBG__Console_Write
00009998 t MDDBG__Console_WriteLine_Formatted
0000999c t MDDBG__Console_Write_Formatted
000099cc t MDDBG__Decomp1bpp
000099e8 t MDDBG__KDebug_WriteLine_Formatted
000099ec t MDDBG__KDebug_Write_Formatted
00009a40 t MDDBG__KDebug_FlushLine
00009a4a t MDDBG__KDebug_WriteLine
00009a4e t MDDBG__KDebug_Write
00009a7c t MDDBG__ErrorHandler_ConsoleOnly
00009aa2 t MDDBG__ErrorHandler_ClearConsole
00009acc t MDDBG__ErrorHandler_PauseConsole
00009b06 t MDDBG__ErrorHandler_PagesController
00009b66 t MDDBG__VSync
00009ba0 t MDDBG__ErrorHandler_ExtraDebuggerList
00009bac t MDDBG__Debugger_AddressRegisters
00009bf8 t MDDBG__Debugger_Backtrace
00009c96 T _Bus_Error
00009c96 t MDDBG__BusError
00009caa T _Address_Error
00009caa t MDDBG__AddressError
00009cc2 T _Illegal_Instruction
00009cc2 t MDDBG__IllegalInstr
00009ce0 T _Zero_Divide
00009ce0 t MDDBG__ZeroDivide
00009cf6 T _Chk_Instruction
00009cf6 t MDDBG__ChkInstr
00009d10 T _Trapv_Instruction
00009d10 t MDDBG__TrapvInstr
00009d2c T _Privilege_Violation
00009d2c t MDDBG__PrivilegeViol
00009d4a T _Trace
00009d4a t MDDBG__Trace
00009d5a T _Line_1010_Emulation
00009d5a t MDDBG__Line1010Emu
00009d76 T _Line_1111_Emulation
00009d76 t MDDBG__Line1111Emu
00009d92 T _Error_Exception
00009d92 t MDDBG__ErrorExcept
00008bba T _start_entry
00008c80 T _reset_entry
00008c88 T XGM_doVBlankProcess
00008cf0 T MDDBG__SymbolDataPtr
00008cf4 t __ErrorHandler
00008cf4 t MDDBG__ErrorHandler
00008e1c t MDDBG__Error_IdleLoop
00008e36 t MDDBG__Error_InitConsole
00008e42 t MDDBG__Error_MaskStackBoundaries
00008eac t MDDBG__Error_DrawOffsetLocation
00008eb0 t MDDBG__Error_DrawOffsetLocation2
00008eb6 t MDDBG__Error_DrawOffsetLocation__inj
00008f44 t MDDBG__ErrorHandler_SetupVDP
00008f7a t MDDBG__ErrorHandler_VDPConfig
00008f90 t MDDBG__ErrorHandler_VDPConfig_Nametables
00008fcc t MDDBG__ErrorHandler_ConsoleConfig_Initial
00008fd0 t MDDBG__ErrorHandler_ConsoleConfig_Shared
00009000 t MDDBG__Str_OffsetLocation_24bit
00009009 t MDDBG__Str_OffsetLocation_32bit
00009044 t MDDBG__Art1bpp_Font
0000933e t MDDBG__GetSymbolByOffset
00009658 t MDDBG__FormatString
00009732 t MDDBG__Console_Init
00009770 t MDDBG__Console_Reset
00009772 t MDDBG__Console_InitShared
000097bc t MDDBG__Console_SetPosAsXY_Stack
000097c2 t MDDBG__Console_SetPosAsXY
000097f6 t MDDBG__Console_GetPosAsXY
0000981c t MDDBG__Console_StartNewLine
0000984a t MDDBG__Console_SetBasePattern
00009866 t MDDBG__Console_SetWidth
00009884 t MDDBG__Console_WriteLine_WithPattern
00009886 t MDDBG__Console_WriteLine
0000988a t MDDBG__Console_Write
00009950 t MDDBG__Console_WriteLine_Formatted
00009954 t MDDBG__Console_Write_Formatted
00009984 t MDDBG__Decomp1bpp
000099a0 t MDDBG__KDebug_WriteLine_Formatted
000099a4 t MDDBG__KDebug_Write_Formatted
000099f8 t MDDBG__KDebug_FlushLine
00009a02 t MDDBG__KDebug_WriteLine
00009a06 t MDDBG__KDebug_Write
00009a34 t MDDBG__ErrorHandler_ConsoleOnly
00009a5a t MDDBG__ErrorHandler_ClearConsole
00009a84 t MDDBG__ErrorHandler_PauseConsole
00009abe t MDDBG__ErrorHandler_PagesController
00009b1e t MDDBG__VSync
00009b58 t MDDBG__ErrorHandler_ExtraDebuggerList
00009b64 t MDDBG__Debugger_AddressRegisters
00009bb0 t MDDBG__Debugger_Backtrace
00009c4e T _Bus_Error
00009c4e t MDDBG__BusError
00009c62 T _Address_Error
00009c62 t MDDBG__AddressError
00009c7a T _Illegal_Instruction
00009c7a t MDDBG__IllegalInstr
00009c98 T _Zero_Divide
00009c98 t MDDBG__ZeroDivide
00009cae T _Chk_Instruction
00009cae t MDDBG__ChkInstr
00009cc8 T _Trapv_Instruction
00009cc8 t MDDBG__TrapvInstr
00009ce4 T _Privilege_Violation
00009ce4 t MDDBG__PrivilegeViol
00009d02 T _Trace
00009d02 t MDDBG__Trace
00009d12 T _Line_1010_Emulation
00009d12 t MDDBG__Line1010Emu
00009d2e T _Line_1111_Emulation
00009d2e t MDDBG__Line1111Emu
00009d4a T _Error_Exception
00009d4a t MDDBG__ErrorExcept
00009e00 T smp_null
00009f00 T smp_null_dpcm
00009f80 T __mulsi3 /home/runner/work/m68k-elf-gcc/m68k-elf-gcc/.build/HOST-i686-w64-mingw32/m68k-elf/src/gcc/libgcc/config/m68k/lb1sf68.S:442
@@ -587,103 +587,104 @@
0001274c t bg1_tileset_data
00012b70 t fg1_tileset_data
00013018 A _stext
e0ff0000 D task_sr
e0ff0002 D task_pc
e0ff0006 D task_regs
e0ff0042 D task_lock
e0ff0044 D _edata
e0ff0044 B _start
e0ff0044 B bmp_buffer_write
e0ff0048 B VBlankProcess
e0ff004a B hintCaller
e0ff0050 B vintCB
e0ff0054 B intCB
e0ff0058 B vtimer
e0ff005c B eintCB
e0ff0060 B intLevelSave
e0ff0062 B intTrace
e0ff0064 B dmaQueues
e0ff0068 b state
e0ff006a b tile_scroll_array
e0ff00a2 b scrollFrameDelayHalved
e0ff00a6 b scrollFrameDelay
e0ff00aa b player_hflip
e0ff00ac b player
e0ff00b0 b player_y
e0ff00b4 b player_x
e0ff00b8 b vscroll_update
e0ff00b9 b hscroll_update
e0ff00ba b fadePSGVol
e0ff00bc b fadeFMVol
e0ff00be b fadeCount
e0ff00c0 b usedVDPSprite
e0ff00c2 b xgm2WaitTab
e0ff00ca b xgm2IdleTab
e0ff00d2 b xgmTempoCnt
e0ff00d4 b xgmWaitTab
e0ff0114 b xgmIdleTab
e0ff0154 b xgmTempoDef
e0ff0156 b xgmTempo
e0ff0158 b busProtectSignalAddress
e0ff015a b driverFlags
e0ff015c b currentDriver
e0ff015e b allocStack
e0ff029e b lastVTimer.0
e0ff02a0 b text_plan
e0ff02a4 b text_basetile
e0ff02a6 b lastVCnt
e0ff02a8 b windowWidthSft
e0ff02aa b planeWidthSft
e0ff02ac b windowWidth
e0ff02ae b planeHeight
e0ff02b0 b planeWidth
e0ff02b2 b hscrl_addr
e0ff02b4 b bgb_addr
e0ff02b6 b bga_addr
e0ff02b8 b window_addr
e0ff02ba b lastTick
e0ff02be b cpuFrameLoad
e0ff02c0 b frameLoadIndex
e0ff02c2 b frameLoads
e0ff02d2 b vblankCB
e0ff02d6 b flags
e0ff02d8 b screenHeight
e0ff02da b screenWidth
e0ff02dc b maps_addr
e0ff02de b slist_addr
e0ff02e0 b vdpSpriteCache
e0ff05e0 b spriteVramSize
e0ff05e4 b vram
e0ff05f0 b lastSprite
e0ff05f4 b firstSprite
e0ff05f8 b spritesPool
e0ff05fc b fadeCounter
e0ff05fe b heap
e0ff0602 b free.lto_priv.0
e0ff0606 b randomSeedSet
e0ff0608 b joyEventCB
e0ff060c b retry
e0ff060d b phase.lto_priv.1
e0ff0610 b regValues
e0ff0623 b gun
e0ff0624 b extSet
e0ff0626 b disableIntStack
e0ff0628 b joyAxisY
e0ff0638 b joyAxisX
e0ff0648 b joyState
e0ff0658 b joyType
e0ff0660 b portSupport
e0ff0662 b portType
e0ff0664 b gport
e0ff0666 b flag
e0ff0668 b maxTransferPerFrame
e0ff066a b queueSize
e0ff066c b nextDataBuffer
e0ff0670 b queueTransferSize
e0ff0672 b queueIndexLimit
e0ff0674 b queueIndex
e0ff0676 b dmaDataBuffer
e0ff067a b dataBufferSize
e0ff067c b phase.lto_priv.0
e0ff067e B _bend
e0ff0000 d ind
e0ff0004 D task_sr
e0ff0006 D task_pc
e0ff000a D task_regs
e0ff0046 D task_lock
e0ff0048 D _edata
e0ff0048 B _start
e0ff0048 B bmp_buffer_write
e0ff004c B VBlankProcess
e0ff004e B hintCaller
e0ff0054 B vintCB
e0ff0058 B intCB
e0ff005c B vtimer
e0ff0060 B eintCB
e0ff0064 B intLevelSave
e0ff0066 B intTrace
e0ff0068 B dmaQueues
e0ff006c b state
e0ff006e b player_hflip
e0ff0070 b tile_scroll_array
e0ff00a8 b scrollFrameDelayHalved
e0ff00ac b scrollFrameDelay
e0ff00b0 b player_sprite
e0ff00b4 b player_y
e0ff00b8 b player_x
e0ff00bc b vscroll_update
e0ff00bd b hscroll_update
e0ff00be b fadePSGVol
e0ff00c0 b fadeFMVol
e0ff00c2 b fadeCount
e0ff00c4 b usedVDPSprite
e0ff00c6 b xgm2WaitTab
e0ff00ce b xgm2IdleTab
e0ff00d6 b xgmTempoCnt
e0ff00d8 b xgmWaitTab
e0ff0118 b xgmIdleTab
e0ff0158 b xgmTempoDef
e0ff015a b xgmTempo
e0ff015c b busProtectSignalAddress
e0ff015e b driverFlags
e0ff0160 b currentDriver
e0ff0162 b allocStack
e0ff02a2 b lastVTimer.0
e0ff02a4 b text_plan
e0ff02a8 b text_basetile
e0ff02aa b lastVCnt
e0ff02ac b windowWidthSft
e0ff02ae b planeWidthSft
e0ff02b0 b windowWidth
e0ff02b2 b planeHeight
e0ff02b4 b planeWidth
e0ff02b6 b hscrl_addr
e0ff02b8 b bgb_addr
e0ff02ba b bga_addr
e0ff02bc b window_addr
e0ff02be b lastTick
e0ff02c2 b cpuFrameLoad
e0ff02c4 b frameLoadIndex
e0ff02c6 b frameLoads
e0ff02d6 b vblankCB
e0ff02da b flags
e0ff02dc b screenHeight
e0ff02de b screenWidth
e0ff02e0 b maps_addr
e0ff02e2 b slist_addr
e0ff02e4 b vdpSpriteCache
e0ff05e4 b spriteVramSize
e0ff05e8 b vram
e0ff05f4 b lastSprite
e0ff05f8 b firstSprite
e0ff05fc b spritesPool
e0ff0600 b fadeCounter
e0ff0602 b heap
e0ff0606 b free.lto_priv.0
e0ff060a b randomSeedSet
e0ff060c b joyEventCB
e0ff0610 b retry
e0ff0611 b phase.lto_priv.1
e0ff0614 b regValues
e0ff0627 b gun
e0ff0628 b extSet
e0ff062a b disableIntStack
e0ff062c b joyAxisY
e0ff063c b joyAxisX
e0ff064c b joyState
e0ff065c b joyType
e0ff0664 b portSupport
e0ff0666 b portType
e0ff0668 b gport
e0ff066a b flag
e0ff066c b maxTransferPerFrame
e0ff066e b queueSize
e0ff0670 b nextDataBuffer
e0ff0674 b queueTransferSize
e0ff0676 b queueIndexLimit
e0ff0678 b queueIndex
e0ff067a b dmaDataBuffer
e0ff067e b dataBufferSize
e0ff0680 b phase.lto_priv.0
e0ff0682 B _bend
e1000000 A __stack

View File

@@ -1,161 +1,31 @@
#include <genesis.h>
#include <resources.h>
#include "title_screen.h"
char debugString[80];
char* buttonString;
char* clearString = " ";
Sprite* player;
int player_x;
int player_y;
bool player_hflip;
int scrollFrameDelay = 0;
int scrollFrameDelayHalved = 0;
s16 tile_scroll_array [28] = {
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0
};
void myJoyHandler( u16 joy, u16 changed, u16 state)
{
strcpy(debugString, "");
if (joy == JOY_1)
{
if (JOY_getJoypadType(JOY_1) == JOY_TYPE_PAD6 )
{
buttonString = "6 Button Connected";
}
else if (JOY_getJoypadType(JOY_1) == JOY_TYPE_PAD3)
{
buttonString = "3 Button Connected";
}
else
{
buttonString = "Controller Not Found";
}
if (state & BUTTON_START)
{
strcat(debugString, " Start ");
}
if (state & BUTTON_A)
{
strcat(debugString, " A ");
}
if (state & BUTTON_B)
{
strcat(debugString, " B ");
}
if (state & BUTTON_C)
{
strcat(debugString, " C ");
}
if(state & BUTTON_X){
strcat(debugString, " X ");
}
if(state & BUTTON_Y){
strcat(debugString, " Y ");
}
if(state & BUTTON_Z){
strcat(debugString, " Z ");
}
if(state & BUTTON_DOWN){
player_y += 1;
}
if(state & BUTTON_UP){
player_y -= 1;
}
if(state & BUTTON_LEFT){
player_x -= 1;
player_hflip = false;
}
if(state & BUTTON_RIGHT){
player_x += 1;
player_hflip = true;
}
if ((strlen(debugString) == 0)){
strcpy(debugString, "None");
}
}
}
static void handleInputs(){
u16 value = JOY_readJoypad(JOY_1);
if (value & BUTTON_RIGHT){
player_x += 1;
player_hflip = true;
}
if (value & BUTTON_LEFT){
player_x -= 1;
player_hflip = false;
}
if (value & BUTTON_UP){
player_y -= 1;
}
if (value & BUTTON_DOWN){
player_y += 1;
}
}
int main(bool hard)
{
player_x = 50;
player_y = 50;
JOY_init();
//JOY_setEventHandler( &myJoyHandler);
u16 ind = TILE_USER_INDEX;
SPR_init();
PAL_setPalette(PAL0, bg1.palette->data, DMA);
PAL_setPalette(PAL1,fg1.palette->data,DMA);
PAL_setPalette(PAL2, bigTex1.palette->data, DMA);
player = SPR_addSprite(&bigTex1, 0,0, TILE_ATTR(PAL2,false,false,false));
VDP_drawImageEx(BG_B, &bg1,TILE_ATTR_FULL(PAL0, false, false, false, ind), 0, -4, false, true);
ind += bg1.tileset->numTile;
VDP_drawImageEx(BG_A, &fg1,TILE_ATTR_FULL(PAL1, false, false, false, ind), 0, -4, false, true);
ind += fg1.tileset->numTile;
VDP_setScrollingMode(HSCROLL_TILE,VSCROLL_PLANE);
init_title_screen();
while(TRUE)
{
handleInputs();
//VDP_drawImageEx(BG_B, &bg1,TILE_ATTR_FULL(PAL0, false, false, false, ind), 0, 0, false, true);
SPR_setPosition(player, player_x,player_y);
SPR_setHFlip(player, player_hflip);
SPR_update();
update_title_screen();
draw_title_screen();
// read input
// move sprite
@@ -163,45 +33,6 @@ int main(bool hard)
// draw current screen (logo, start screen, settings, game, gameover, credits...)
if (scrollFrameDelay > 1){
scrollFrameDelay = 0;
if (scrollFrameDelayHalved >1){
//0.25 scroll speed
tile_scroll_array[15] -=1;
tile_scroll_array[16] -=1;
tile_scroll_array[17] -=1;
tile_scroll_array[18] -=1;
tile_scroll_array[19] -=1;
//reset this timer
scrollFrameDelayHalved = 0;
}
// 0.5 scroll speed
tile_scroll_array[20] -=1;
// effectively 1.5 scroll speed.
tile_scroll_array[22] -=1;
// 2.5
tile_scroll_array[25] -=1;
scrollFrameDelayHalved ++;
}
tile_scroll_array[21] -=1;
tile_scroll_array[22] -=1; //1.5
tile_scroll_array[23] -=2;
tile_scroll_array[24] -=2;
tile_scroll_array[25] -=2; // 2.5
tile_scroll_array[26] -=3;
tile_scroll_array[27] -=3;
VDP_setHorizontalScrollTile(BG_A, 0, tile_scroll_array, 28, DMA_QUEUE);
scrollFrameDelay ++;
// wait for screen refresh and do all SGDK VBlank tasks

116
src/title_screen.c Normal file
View File

@@ -0,0 +1,116 @@
#include <genesis.h>
#include <resources.h>
#include "title_screen.h"
u16 ind = TILE_USER_INDEX;
Sprite* player_sprite;
int player_x;
int player_y;
int scrollFrameDelay = 0;
int scrollFrameDelayHalved = 0;
bool player_hflip;
s16 tile_scroll_array [28] = {
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0
};
extern void init_title_screen () {
player_x = 50;
player_y = 50;
SPR_init();
PAL_setPalette(PAL0, bg1.palette->data, DMA);
PAL_setPalette(PAL1,fg1.palette->data,DMA);
PAL_setPalette(PAL2, bigTex1.palette->data, DMA);
player_sprite = SPR_addSprite(&bigTex1, 0,0, TILE_ATTR(PAL2,false,false,false));
VDP_drawImageEx(BG_B, &bg1,TILE_ATTR_FULL(PAL0, false, false, false, ind), 0, -4, false, true);
ind += bg1.tileset->numTile;
VDP_drawImageEx(BG_A, &fg1,TILE_ATTR_FULL(PAL1, false, false, false, ind), 0, -4, false, true);
ind += fg1.tileset->numTile;
VDP_setScrollingMode(HSCROLL_TILE,VSCROLL_PLANE);
}
static void handleInputs(){
u16 value = JOY_readJoypad(JOY_1);
if (value & BUTTON_RIGHT){
player_x += 1;
player_hflip = true;
}
if (value & BUTTON_LEFT){
player_x -= 1;
player_hflip = false;
}
if (value & BUTTON_UP){
player_y -= 1;
}
if (value & BUTTON_DOWN){
player_y += 1;
}
}
extern void update_title_screen(){
if (scrollFrameDelay > 1){
scrollFrameDelay = 0;
if (scrollFrameDelayHalved >1){
//0.25 scroll speed
tile_scroll_array[15] -=1;
tile_scroll_array[16] -=1;
tile_scroll_array[17] -=1;
tile_scroll_array[18] -=1;
tile_scroll_array[19] -=1;
//reset this timer
scrollFrameDelayHalved = 0;
}
// 0.5 scroll speed
tile_scroll_array[20] -=1;
// effectively 1.5 scroll speed.
tile_scroll_array[22] -=1;
// 2.5
tile_scroll_array[25] -=1;
scrollFrameDelayHalved ++;
}
tile_scroll_array[21] -=1;
tile_scroll_array[22] -=1; //1.5
tile_scroll_array[23] -=2;
tile_scroll_array[24] -=2;
tile_scroll_array[25] -=2; // 2.5
tile_scroll_array[26] -=3;
tile_scroll_array[27] -=3;
VDP_setHorizontalScrollTile(BG_A, 0, tile_scroll_array, 28, DMA_QUEUE);
scrollFrameDelay ++;
handleInputs();
}
extern void draw_title_screen(){
SPR_setPosition(player_sprite, player_x,player_y);
SPR_setHFlip(player_sprite, player_hflip);
SPR_update();
}