diff --git a/assets/tiles/tiles.png b/assets/tiles/tiles.png index 602d72d..208a8e0 100644 Binary files a/assets/tiles/tiles.png and b/assets/tiles/tiles.png differ diff --git a/assets/tiles/tiles.pyxel b/assets/tiles/tiles.pyxel index 42c15d4..72526a3 100644 Binary files a/assets/tiles/tiles.pyxel and b/assets/tiles/tiles.pyxel differ diff --git a/img/cx16-othello.gif b/img/cx16-othello.gif index 8d6ff57..c7808d7 100644 Binary files a/img/cx16-othello.gif and b/img/cx16-othello.gif differ diff --git a/src/Makefile b/src/Makefile index 660fa2b..e02112d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,9 +4,12 @@ PYTHON=python3 make: OTHELLO.PRG -OTHELLO.PRG: *.c *.h *.s FONTMAP.DAT TILES.DAT OTHELLO.ZSM TILE.ZSM +OTHELLO.PRG: *.c *.h *.s FONTMAP.DAT TILES.DAT OTHELLO.ZSM TILE.ZSM HELP.DAT $(CC) -O -o OTHELLO.PRG -t cx16 -C othello.cfg *.c *.s *.lib +HELP.DAT: help.hlp + $(PYTHON) help.py + TILES.DAT: $(PYTHON) ../assets/scripts/convert_tilemap.py TILES.DAT diff --git a/src/constants.h b/src/constants.h index c5a9716..95be56a 100644 --- a/src/constants.h +++ b/src/constants.h @@ -43,8 +43,7 @@ #define TILE_BLACK 0x03 #define TILE_WHITE 0x04 #define TILE_MOUSE_CURSOR 0x0F -#define TILE_BLACK_CURSOR 0x13 -#define TILE_WHITE_CURSOR 0x14 +#define TILE_HIGHLIGHT 0x12 // board offsets #define BOARD_WOOD 0x20 @@ -63,6 +62,7 @@ // sprites #define SPRITE_MOUSE_CURSOR 0x00 #define SPRITE_TILE_CURSOR 0x65 +#define SPRITE_HIGHLIGHT 0x66 // stone colors #define STONE_RED 0x03 @@ -95,6 +95,8 @@ #define GAME_STOP 0x00 #define GAME_RUN 0x01 #define GAME_MENU 0x02 +#define GAME_SETTINGS 0x03 +#define GAME_HELP 0x04 #define PLAYER_HUMAN 0x00 #define PLAYER_CPU 0x01 @@ -110,4 +112,6 @@ #define SCROLL_BACKGROUND 1 #define SCROLLSPEED 50 +#define HELPPAGES 6 + #endif // _CONSTANTS_H \ No newline at end of file diff --git a/src/game.c b/src/game.c index 8317e85..7667113 100644 --- a/src/game.c +++ b/src/game.c @@ -37,6 +37,7 @@ uint8_t board_offset_x = 6; uint8_t board_offset_y = 4; uint8_t no_move_counter = 0; uint16_t cpu_waittime = 200; +uint8_t background_scroll = YES; /** * @brief Initialize the game scene @@ -155,10 +156,6 @@ void set_stone(uint8_t y, uint8_t x, uint8_t stone) { * @param x board x position */ void set_cursor(uint8_t y, uint8_t x) { - uint8_t tile = board[cury * boardsize + curx]; - uint8_t edge = edgefield[cury * boardsize + curx]; - uint32_t map_base_addr = 0x0000; - set_sprite(SPRITE_TILE_CURSOR, board_offset_y + y, board_offset_x + x); // update cursor positions @@ -280,9 +277,6 @@ uint8_t place_stone(uint8_t y, uint8_t x, uint8_t probe, uint8_t player) { // change turn swap_turn(); - // reset cursor - set_cursor(y, x); - // display current number of stones count_stones(COUNT_NO_GAME_END); @@ -567,21 +561,19 @@ void human_turn() { ccurx = (*mouse_x >> 4) - board_offset_x; ccury = (*mouse_y >> 4) - board_offset_y; if(ccurx >= 0 && ccurx < boardsize && ccury >=0 && ccury < boardsize) { - set_cursor(ccury, ccurx); - } - - if(mouse_buttons & 1) { - // wait until mouse button is released - while(mouse_buttons != 0x00) { - asm("ldx #2"); - asm("jsr $FF6B"); - asm("sta %v", mouse_buttons); - - sound_fill_buffers(); - update_background_diagonal(); + if(mouse_buttons & 1) { + // wait until mouse button is released + while(mouse_buttons != 0x00) { + asm("ldx #2"); + asm("jsr $FF6B"); + asm("sta %v", mouse_buttons); + + sound_fill_buffers(); + update_background_diagonal(); + } + // place stone in current mouse location + place_stone(ccury, ccurx, PROBE_NO, current_player); } - // place stone in current mouse location - place_stone(cury, curx, PROBE_NO, current_player); } } diff --git a/src/game.h b/src/game.h index 56f3b6f..5f9e1d2 100644 --- a/src/game.h +++ b/src/game.h @@ -31,6 +31,7 @@ #include "constants.h" #include "video.h" #include "sound.h" +#include "sound_low.h" #include "mouse.h" extern uint8_t *board; // store board configuration @@ -50,6 +51,7 @@ extern uint8_t board_offset_x; // board x-offset with respect to screen extern uint8_t board_offset_y; // board y-offset with respect to screen extern uint8_t no_move_counter; // how many turns in a row no move can be made extern uint16_t cpu_waittime; // time to wait until the computer makes a move +extern uint8_t background_scroll; // whether or not to perform background scrolling /** * @brief Initialize the game scene diff --git a/src/help.h b/src/help.h new file mode 100644 index 0000000..654a997 --- /dev/null +++ b/src/help.h @@ -0,0 +1,26 @@ +/************************************************************************** + * * + * Author: Ivo Filot * + * * + * CX16-OTHELLO is free software: * + * you can redistribute it and/or modify it under the terms of the * + * GNU General Public License as published by the Free Software * + * Foundation, either version 3 of the License, or (at your option) * + * any later version. * + * * + * CX16-OTHELLO is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty * + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see http://www.gnu.org/licenses/. * + * * + **************************************************************************/ + +#ifndef _HELP_H +#define _HELP_H + +void __fastcall__ load_help_assets(); + +#endif // _HELP_H \ No newline at end of file diff --git a/src/help.hlp b/src/help.hlp new file mode 100644 index 0000000..65775b7 --- /dev/null +++ b/src/help.hlp @@ -0,0 +1,88 @@ +# +# Generalized HELP file, any lines starting with "#" will be ignored +# in the parsing +# +# All pages are 320x240 pixels or 20 x 15 characters (16x16 font size) +# Writeable area is however 20x12 characters as first line and bottom two +# lines are already used. +# +|PAGE1| +____________________ +Othello for the +Commander X16 is a +modern adaptation +of the classic +strategy board game, +tailored for the +retro charm of the +X16 platform. +|ENDPAGE| +|PAGE2| +____________________ +Known for its simple +yet strategic +gameplay, Othello +challenges players +to outmaneuver their +opponent by flipping +discs (stones) on +the playing board. +|ENDPAGE| +|PAGE3| +____________________ +The objective is to +have the majority +of stones in your +color when the +board is filled. +|ENDPAGE| +|PAGE4| +____________________ +Keyboard, joystick +and mouse can all +be used to play the +game. +When playing with +the keyboard, use +the arrow keys to +move the cursor and +press SPACE to place +a disc. +|ENDPAGE| +|PAGE5| +____________________ +When playing with +the joystick, use the +d-pad to move the +cursor and press the +B key (yellow key on +SNES controller) to +place a disc. +|ENDPAGE| +|PAGE6| +____________________ +When playing with +the mouse, simply +move the cursor +above the tile and +press the left mouse +key to place a disc. +The cursor position +is ignored when +playing with the +mouse. +|ENDPAGE| +#|PAGE| +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#____________________ +#|ENDPAGE| \ No newline at end of file diff --git a/src/help.py b/src/help.py new file mode 100644 index 0000000..78bd451 --- /dev/null +++ b/src/help.py @@ -0,0 +1,36 @@ +# parse .hlp file into binary file that can be parsed by the Othello game + +def main(): + pages = [] + with open('help.hlp') as f: + lines = f.readlines() + + for line in lines: + if line.startswith('#'): + continue + + if line.startswith('|PAGE'): + parsing = True + curpage = bytearray() + continue + + if line.startswith('|ENDPAGE|'): + parsing = False + curpage.extend([0x20] * (20 * 12 - len(curpage))) + pages.append(curpage) + continue + + if parsing: + line = line.strip() + line = line.replace('_', ' ') + if len(line) > 20: + curpage += line[0:20].encode('ascii') + else: + curpage += line.encode('ascii') + bytearray([0x20] * (20 - len(line))) + + with open('HELP.DAT', 'wb') as f: + for page in pages: + f.write(page) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/src/help.s b/src/help.s new file mode 100644 index 0000000..5d325e1 --- /dev/null +++ b/src/help.s @@ -0,0 +1,60 @@ +; +; +; Author: Ivo Filot +; +; CX16-OTHELLO is free software: +; you can redistribute it and/or modify it under the terms of the +; GNU General Public License as published by the Free Software +; Foundation, either version 3 of the License, or (at your option) +; any later version. +; +; CX16-OTHELLO is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty +; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +; See the GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see http://www.gnu.org/licenses/. +; +; + +.include "x16.inc" + +.export _load_help_assets + +.code +; +; Start the sound engine +; +.proc _load_help_assets: near + + ; set ram bank + lda #2 ; use bank 2, bank 1 is used for sound + sta $00 ; set ram bank 2 + + ; assign file name + lda #$08 ; filename length + ldx #filename ; high byte filename pointer + jsr X16::Kernal::SETNAM + + ; set file pointer + lda #2 ; file index + ldx #8 ; SD-card + ldy #2 ; headerless load + jsr X16::Kernal::SETLFS + + ; load file into memory + lda #0 ; load file into system memory + ldx #$00 + ldy #$A0 ; banked memory + jsr X16::Kernal::LOAD + + ; reset ram bank + lda #0 ; reset ram bank + sta $00 + + rts +.endproc + +filename: .asciiz "help.dat" \ No newline at end of file diff --git a/src/main.c b/src/main.c index 8eef179..d4d8dfe 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,7 @@ #include "menu.h" #include "mouse.h" #include "sound.h" +#include "help.h" unsigned char keycode; @@ -39,6 +40,9 @@ void main() { init_sound(); start_bgmusic(); + // load help assets + load_help_assets(); + // enable mouse init_mouse(); set_mouse_pointer(TILE_MOUSE_CURSOR); @@ -46,7 +50,17 @@ void main() { while(1) { while(gamestate == GAME_MENU) { clear_screen(); - game_menu(); + game_title(); + } + + while(gamestate == GAME_SETTINGS) { + clear_screen(); + game_settings(); + } + + while(gamestate == GAME_HELP) { + clear_screen(); + game_help(); } while(gamestate == GAME_RUN) { diff --git a/src/menu.c b/src/menu.c index f63fcc7..f335148 100644 --- a/src/menu.c +++ b/src/menu.c @@ -20,29 +20,159 @@ #include "menu.h" +uint8_t helppage = 0; + +/** + * @brief Show game title screen + * + */ +void game_title() { + static unsigned char keycode; + static const uint8_t offsetx = 8; + + write_string("CX16-OTHELLO", 0, 0); + write_string("music by Crisps", 1, 5); + write_string("1.2.0", 0, 15); + + // build sample board + build_board(6, 4, offsetx); + + // set sprites + assign_sprite(1, stone_color1); + assign_sprite(2, stone_color2); + assign_sprite(3, stone_color1); + assign_sprite(4, stone_color2); + + // print stone colors + set_sprite(1, 6, offsetx+2); + set_sprite(2, 6, offsetx+3); + set_sprite(3, 7, offsetx+3); + set_sprite(4, 7, offsetx+2); + + write_string("(S) SETTINGS", 11, 0); + write_string("(H) HELP", 12, 0); + write_string("(ENTER) START", 14, 0); + + while(1) { + asm("jsr $FFE4"); + asm("sta %v", keycode); + + switch(keycode) { + case 83: + gamestate = GAME_SETTINGS; + return; + case 72: + gamestate = GAME_HELP; + return; + case KEYCODE_RETURN: + gamestate = GAME_RUN; + init_game(); + return; + } + + // update sound buffer + sound_fill_buffers(); + update_background_diagonal(); + } +} + +/** + * @brief Show help screen + * + */ +void game_help() { + static unsigned char keycode; + uint8_t *ptr = (uint8_t*)(0xA000 + 240 * helppage); + uint8_t x,y; + uint32_t map_base_addr; + char buf[4] = {0x00, '/', HELPPAGES+0x30, 0x00}; + + // set sprites + assign_sprite(1, TILE_NONE); + assign_sprite(2, TILE_NONE); + assign_sprite(3, TILE_NONE); + assign_sprite(4, TILE_NONE); + + write_string("HELP", 0, 0); + write_string("(N) NEXT (P) PREV", 13, 0); + write_string("(ESC) BACK PAGE:", 14, 0); + + // print the page + asm("lda #2"); + asm("sta $00"); + for(y=1; y<12; y++) { + map_base_addr = MAPBASE1 + (y * MAPWIDTH) * 2; + VERA.address = map_base_addr; + VERA.address_hi = map_base_addr >> 16; + VERA.address_hi |= 0b10000; + + for(x=0; x<20; x++) { + if(*ptr >= ' ' && *ptr <= '~') { + VERA.data0 = (*ptr) - 0x20 + 0x40; + } else { + VERA.data0 = 0x40; + } + VERA.data0 = 0x00; + ptr++; + } + } + asm("lda #0"); + asm("sta $00"); + + // print page number + itoa(helppage+1, buf, 10); + write_string(buf, 14, 17); + + while(1) { + asm("jsr $FFE4"); + asm("sta %v", keycode); + + switch(keycode) { + case KEYCODE_ESCAPE: + gamestate = GAME_MENU; + return; + case 78: + if(helppage < (HELPPAGES-1)) { + helppage++; + } + return; + case 80: + if(helppage > 0) { + helppage--; + } + return; + } + + // update sound buffer + sound_fill_buffers(); + update_background_diagonal(); + } +} + /** * @brief Show game menu * */ -void game_menu() { +void game_settings() { static unsigned char keycode; unsigned short *mouse_x = (unsigned short *)0x2; unsigned short *mouse_y = (unsigned short *)0x4; - write_string("CX16-OTHELLO", 0, 1); - write_string("music by Crisps", 1, 5); - write_string("1.1.0", 0, 15); + write_string("SETTINGS", 0, 0); + + write_string("(1) Player 1:", 1, 0); + write_string("(2) Player 2:", 2, 0); + write_string("(B) Board:", 4, 0); - write_string("(1) PLAYER 1:", 3, 1); - write_string("(2) PLAYER 2:", 4, 1); - write_string("(B) BOARD:", 6, 1); + write_string("(S) Size:", 6, 0); - write_string("(S) SIZE:", 8, 1); + write_string("(C) Disc player 1:", 9, 0); + write_string("(V) Disc player 2:", 10, 0); - write_string("(C) TILE COLOR 1:", 11, 1); - write_string("(V) TILE COLOR 2:", 12, 1); + write_string("(G) BG scroll:", 12, 0); + write_string("(M) Music:", 13, 0); - write_string("Hit ENTER to start", 14, 1); + write_string("(ESCAPE) BACK", 14, 0); print_choice(); @@ -63,6 +193,19 @@ void game_menu() { board_type = (board_type == BOARD_STONE ? BOARD_WOOD : BOARD_STONE); print_choice(); break; + case 71: + background_scroll = (background_scroll == YES ? NO : YES); + print_choice(); + break; + case 77: + music = (music == YES ? NO : YES); + if(music == YES) { + start_bgmusic(); + } else { + stop_bgmusic(); + } + print_choice(); + break; case 67: stone_color1++; @@ -108,9 +251,8 @@ void game_menu() { print_choice(); break; - case KEYCODE_RETURN: - gamestate = GAME_RUN; - init_game(); + case KEYCODE_ESCAPE: + gamestate = GAME_MENU; return; } @@ -129,13 +271,19 @@ void print_choice() { static const uint8_t offsetx = 12; // print whether player 1 is a human or a cpu - write_string(player1_type == PLAYER_HUMAN ? "HUMAN" : "CPU ", 3, 14); + write_string(player1_type == PLAYER_HUMAN ? "HUMAN" : "CPU ", 1, 14); // print whether player 2 is a human or a cpu - write_string(player2_type == PLAYER_HUMAN ? "HUMAN" : "CPU ", 4, 14); + write_string(player2_type == PLAYER_HUMAN ? "HUMAN" : "CPU ", 2, 14); // print board style - write_string(board_type == BOARD_STONE ? "STONE" : "WOOD ", 7, 1); + write_string(board_type == BOARD_STONE ? "STONE" : "WOOD ", 5, 1); + + // background scrolling + write_string(background_scroll == YES ? "YES" : "NO ", 12, 15); + + // music + write_string(music == YES ? "ON " : "OFF ", 13, 11); // print board size switch(boardsize) { @@ -149,10 +297,10 @@ void print_choice() { memcpy(buf, "10 x 10", 8); break; } - write_string(buf, 9, 1); + write_string(buf, 7, 1); // build sample board - build_board(4, 6, offsetx); + build_board(4, 4, offsetx); // set sprites assign_sprite(1, stone_color1); @@ -161,11 +309,11 @@ void print_choice() { assign_sprite(4, stone_color2); // print stone colors - set_sprite(1, 7, offsetx+1); - set_sprite(2, 7, offsetx+2); - set_sprite(3, 8, offsetx+2); - set_sprite(4, 8, offsetx+1); + set_sprite(1, 5, offsetx+1); + set_sprite(2, 5, offsetx+2); + set_sprite(3, 6, offsetx+2); + set_sprite(4, 6, offsetx+1); - set_tile(11, 18, stone_color1, 0x00); - set_tile(12, 18, stone_color2, 0x00); + set_tile(9, 18, stone_color1, 0x00); + set_tile(10, 18, stone_color2, 0x00); } \ No newline at end of file diff --git a/src/menu.h b/src/menu.h index 221d45b..c59f739 100644 --- a/src/menu.h +++ b/src/menu.h @@ -29,11 +29,25 @@ #include "mouse.h" #include "sound.h" +extern uint8_t helppage; + +/** + * @brief Show game settings menu + * + */ +void game_settings(); + +/** + * @brief Show game title screen + * + */ +void game_title(); + /** - * @brief Show game menu + * @brief Show help screen * */ -void game_menu(); +void game_help(); /** * @brief Print current game configuration to the screen diff --git a/src/sound.c b/src/sound.c new file mode 100644 index 0000000..667fb87 --- /dev/null +++ b/src/sound.c @@ -0,0 +1,33 @@ +/************************************************************************** + * * + * Author: Ivo Filot * + * * + * CX16-OTHELLO is free software: * + * you can redistribute it and/or modify it under the terms of the * + * GNU General Public License as published by the Free Software * + * Foundation, either version 3 of the License, or (at your option) * + * any later version. * + * * + * CX16-OTHELLO is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty * + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see http://www.gnu.org/licenses/. * + * * + **************************************************************************/ + +#include "sound.h" + +uint8_t music = YES; + +/** + * @brief Fill sound buffer + * + */ +void sound_fill_buffers() { + if(music) { + sound_fill_buffers_asm(); + } +} \ No newline at end of file diff --git a/src/sound.h b/src/sound.h index 978ef1f..3bf52c1 100644 --- a/src/sound.h +++ b/src/sound.h @@ -21,40 +21,17 @@ #ifndef _SOUND_H #define _SOUND_H -/** - * @brief Initialize sound engine - * - */ -void __fastcall__ init_sound(); +#include -/** - * @brief Start background music - * - */ -void __fastcall__ start_bgmusic(); +#include "constants.h" +#include "sound_low.h" -/** - * @brief Stop background music - * - */ -void __fastcall__ stop_bgmusic(); - -/** - * @brief Rewind background music - * - */ -void __fastcall__ rewind_bgmusic(); - -/** - * @brief Fill sound buffers - * - */ -void __fastcall__ sound_fill_buffers(); +extern uint8_t music; // whether to play music /** - * @brief Play short sound when placing down a stone + * @brief Fill sound buffer * */ -void __fastcall__ play_thumb(); +void sound_fill_buffers(); #endif // _SOUND_H \ No newline at end of file diff --git a/src/sound_low.h b/src/sound_low.h new file mode 100644 index 0000000..33620fa --- /dev/null +++ b/src/sound_low.h @@ -0,0 +1,60 @@ +/************************************************************************** + * * + * Author: Ivo Filot * + * * + * CX16-OTHELLO is free software: * + * you can redistribute it and/or modify it under the terms of the * + * GNU General Public License as published by the Free Software * + * Foundation, either version 3 of the License, or (at your option) * + * any later version. * + * * + * CX16-OTHELLO is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty * + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see http://www.gnu.org/licenses/. * + * * + **************************************************************************/ + +#ifndef _SOUND_LOW_H +#define _SOUND_LOW_H + +/** + * @brief Initialize sound engine + * + */ +void __fastcall__ init_sound(); + +/** + * @brief Start background music + * + */ +void __fastcall__ start_bgmusic(); + +/** + * @brief Stop background music + * + */ +void __fastcall__ stop_bgmusic(); + +/** + * @brief Rewind background music + * + */ +void __fastcall__ rewind_bgmusic(); + +/** + * @brief Fill sound buffers + * + */ +void __fastcall__ sound_fill_buffers_asm(); + +/** + * @brief Play short sound when placing down a stone + * + */ +void __fastcall__ play_thumb(); + +#endif // _SOUND_LOW_H \ No newline at end of file diff --git a/src/sound.s b/src/sound_low.s similarity index 95% rename from src/sound.s rename to src/sound_low.s index 3f7c1f6..01ed3bb 100644 --- a/src/sound.s +++ b/src/sound_low.s @@ -28,7 +28,7 @@ .export _start_bgmusic .export _stop_bgmusic .export _rewind_bgmusic -.export _sound_fill_buffers +.export _sound_fill_buffers_asm .export _play_thumb TONE1 = 1189 @@ -40,6 +40,7 @@ CHANNEL = 0 ; Start the sound engine ; .proc _init_sound: near + lda #1 ; assign rambank 0 jsr zsmkit::zsm_init_engine ; initialize engine jsr zsmkit::zsmkit_setisr @@ -55,11 +56,6 @@ CHANNEL = 0 ldy #>filename2 ; high byte jsr zsmkit::zsm_setfile - ; set attenuation for background music - ldx #0 ; priority - lda #$20 ; attenuation value - jsr zsmkit::zsm_setatten - rts .endproc @@ -69,6 +65,12 @@ CHANNEL = 0 .proc _start_bgmusic: near ldx #0 jsr zsmkit::zsm_play + + ; set attenuation for background music + ldx #0 ; priority + lda #$20 ; attenuation value + jsr zsmkit::zsm_setatten + rts .endproc @@ -93,8 +95,9 @@ CHANNEL = 0 ; ; Fill sound buffers ; -.proc _sound_fill_buffers: near - jmp zsmkit::zsm_fill_buffers +.proc _sound_fill_buffers_asm: near + jsr zsmkit::zsm_fill_buffers + rts .endproc ; diff --git a/src/video.c b/src/video.c index f52f3b1..33016da 100644 --- a/src/video.c +++ b/src/video.c @@ -313,15 +313,15 @@ void clear_foreground() { * */ void update_background_diagonal() { - #if SCROLL_BACKGROUND == 1 - clock_t curtick = clock(); + if(background_scroll == YES) { + clock_t curtick = clock(); - if(((curtick - prevtick) * 1000 / CLOCKS_PER_SEC) > SCROLLSPEED) { - prevtick = curtick; - VERA.layer0.hscroll = (VERA.layer0.hscroll - 1) % 16; - VERA.layer0.vscroll = (VERA.layer0.vscroll - 1) % 16; + if(((curtick - prevtick) * 1000 / CLOCKS_PER_SEC) > SCROLLSPEED) { + prevtick = curtick; + VERA.layer0.hscroll = (VERA.layer0.hscroll - 1) % 16; + VERA.layer0.vscroll = (VERA.layer0.vscroll - 1) % 16; + } } - #endif } /**