diff --git a/games/tfv/Makefile b/games/tfv/Makefile index 462a115a..31547e68 100644 --- a/games/tfv/Makefile +++ b/games/tfv/Makefile @@ -108,5 +108,5 @@ music/battle_music.inc: clean: rm -f *~ TITLE.GR *.o *.lst TFV_CREDITS TFV_TITLE TFV_FLYING TFV_WORLD HELLO LOADER cd graphics_battle && make clean - cd graphics_credits && ake clean + cd graphics_credits && make clean cd music && make clean diff --git a/games/tfv/load_game.s b/games/tfv/load_game.s index 3fba9664..a041d92e 100644 --- a/games/tfv/load_game.s +++ b/games/tfv/load_game.s @@ -6,17 +6,46 @@ ; also provide multiple load games load_game: - - lda #$03 - sta HERO_LEVEL - - lda #$02 - sta HERO_HP_HI - lda #$90 - sta HERO_HP_LO - sta HERO_MP - sta HERO_MP_MAX lda #LOAD_FLYING sta WHICH_LOAD + lda #$90 + sta HERO_HP_LO + lda #$02 + sta HERO_HP_HI + lda #$20 + sta HERO_MP + sta HERO_MP_MAX + lda #3 + sta HERO_LIMIT + lda #$03 + sta HERO_LEVEL + lda #$50 + sta HERO_XP + lda #$25 + sta HERO_MONEY + lda #$00 + sta HERO_INVENTORY + lda #'D' + sta HERO_NAME + lda #'E' + sta HERO_NAME1 + lda #'A' + sta HERO_NAME2 + lda #'T' + sta HERO_NAME3 + lda #'E' + sta HERO_NAME4 + lda #'R' + sta HERO_NAME5 + lda #0 + sta HERO_NAME6 + lda #0 + sta HERO_STATE + lda #25 + sta HERO_STEPS + lda #00 + sta TFV_X + sta TFV_Y + sta MAP_X rts diff --git a/games/tfv/tfv_battle_enemy.s b/games/tfv/tfv_battle_enemy.s index 78b8a5ea..48be2d2a 100644 --- a/games/tfv/tfv_battle_enemy.s +++ b/games/tfv/tfv_battle_enemy.s @@ -64,12 +64,14 @@ init_enemy: sta ENEMY_X sta ENEMY_DEAD - lda #$50 ; BCD - sta ENEMY_HP_LO + ; FIXME: lower + lda #$00 ; BCD + sta ENEMY_HP_LO + lda #$03 ; BCD sta ENEMY_HP_HI - lda #$1 ; max HP is 100 + lda #$3 ; max HP is 100 sta ENEMY_LEVEL lda #30 diff --git a/games/tfv/tfv_textentry.s b/games/tfv/tfv_textentry.s index 30722c22..8561d34e 100644 --- a/games/tfv/tfv_textentry.s +++ b/games/tfv/tfv_textentry.s @@ -1,84 +1,198 @@ enter_name: jsr TEXT - jsr HOME + + ; zero out name + + ldx #0 + lda #0 +zero_name_loop: + sta HERO_NAME,X + inx + cpx #8 + bne zero_name_loop + + + lda #0 + sta NAMEX + sta XX + sta YY + +name_loop: + ; clear screen + lda #$A0 + jsr clear_top_a + jsr clear_bottom + + ; print entry string at top lda #>(enter_name_string) sta OUTH lda #<(enter_name_string) sta OUTL + jsr move_and_print - jsr print_string - ; zero out name + + ;============================= + ; print current name + cursor + ; on screen at 11,2? + + ; get pointer to line 2 + lda gr_offsets+(2*2) + sta OUTL + lda gr_offsets+(2*2)+1 + clc + adc DRAW_PAGE + sta OUTH + ldx #0 - lda #0 -zero_name_loop: - sta name,X - inx - cpx #8 - bne zero_name_loop + ldy #11 +print_name_loop: -name_loop: - - jsr NORMAL - - lda #11 - sta CH ; HTAB 12 - - lda #2 - jsr TABV ; VTAB 3 - - ldy #0 - sty NAMEX - -name_line: cpy NAMEX - bne name_notx + bne print_name_name +print_name_cursor: lda #'+' - jmp name_next + bne print_name_put_char ; bra -name_notx: - lda NAMEL,Y - beq name_zero +print_name_name: + lda HERO_NAME,X + bne print_name_char +print_name_zero: + lda #'_'+$80 + bne print_name_put_char ; bra + +print_name_char: ora #$80 - bne name_next -name_zero: - lda #('_'+$80) -name_next: - jsr COUT - lda #(' '+$80) - jsr COUT +print_name_put_char: + sta (OUTL),Y + +done_print_name_loop: + + inx iny - cpy #8 - bne name_line - - lda #7 - sta CV - - lda #('@'+$80) - sta CHAR - -print_letters_loop: - lda #11 - sta CH ; HTAB 12 - jsr VTAB - - ldy #0 - -print_letters_inner_loop: - lda CHAR - jsr COUT - inc CHAR - lda #(' '+$80) - jsr COUT iny + cpy #25 + bne print_name_loop - cpy #$8 - bne print_letters_inner_loop +.if 0 - jsr wait_until_keypressed + for(yy=0;yy<8;yy++) { + basic_htab(12); + basic_vtab(yy*2+6); + for(xx=0;xx<8;xx++) { + if (yy<4) sprintf(tempst,"%c ",(yy*8)+xx+64); + else sprintf(tempst,"%c ",(yy*8)+xx); + + if ((xx==cursor_x) && (yy==cursor_y)) basic_inverse(); + else basic_normal(); + + basic_print(tempst); + } + } + + basic_htab(12); + basic_vtab(22); + basic_normal(); + + if ((cursor_y==8) && (cursor_x<4)) basic_inverse(); + basic_print(" DONE "); + basic_normal(); + basic_print(" "); + if ((cursor_y==8) && (cursor_x>=4)) basic_inverse(); + basic_print(" BACK "); +.endif + + jsr get_keypress + bne done_enter_name + +.if 0 + while(1) { + ch=grsim_input(); + + if (ch==APPLE_UP) { // up + cursor_y--; + } + + else if (ch==APPLE_DOWN) { // down + cursor_y++; + } + + else if (ch==APPLE_LEFT) { // left + if (cursor_y==8) cursor_x-=4; + else cursor_x--; + } + + else if (ch==APPLE_RIGHT) { // right + if (cursor_y==8) cursor_x+=4; + cursor_x++; + } + + else if (ch==13) { + if (cursor_y==8) { + if (cursor_x<4) { + ch=27; + break; + } + else { + nameo[name_x]=0; + name_x--; + if (name_x<0) name_x=0; + break; + } + } + + if (cursor_y<4) nameo[name_x]=(cursor_y*8)+ + cursor_x+64; + else nameo[name_x]=(cursor_y*8)+cursor_x; + name_x++; + } + else if ((ch>32) && (ch<128)) { + nameo[name_x]=ch; + name_x++; + + } + + if (name_x>7) name_x=7; + + if (cursor_x<0) { + cursor_x=7; + cursor_y--; + } + if (cursor_x>7) { + cursor_x=0; + cursor_y++; + } + + if (cursor_y<0) cursor_y=8; + if (cursor_y>8) cursor_y=0; + + if ((cursor_y==8) && (cursor_x<4)) cursor_x=0; + else if ((cursor_y==8) && (cursor_x>=4)) cursor_x=4; + + + if (ch!=0) break; + + grsim_update(); + + usleep(10000); + } + + if (ch==27) break; + +.endif + + jsr page_flip + + jmp name_loop + +done_enter_name: rts + +enter_name_string: + .byte 0,0,"PLEASE ENTER A NAME:",0 + diff --git a/games/tfv/tfv_title.s b/games/tfv/tfv_title.s index 8e0a7982..37219584 100644 --- a/games/tfv/tfv_title.s +++ b/games/tfv/tfv_title.s @@ -112,7 +112,18 @@ title_new_game: jsr enter_name - ; TODO: all rest + ; Initial starting values + lda #$1 + sta HERO_LEVEL + + lda #$01 + sta HERO_HP_HI + lda #$00 + sta HERO_HP_LO + + lda #$20 + sta HERO_MP + sta HERO_MP_MAX lda #LOAD_FLYING sta WHICH_LOAD @@ -124,19 +135,7 @@ title_new_game: ;================================= title_load_game: - ; this should go in new game, not load - lda #$02 - sta HERO_LEVEL - - lda #$01 - sta HERO_HP_HI - lda #$50 - sta HERO_HP_LO - sta HERO_MP - sta HERO_MP_MAX - - lda #LOAD_FLYING - sta WHICH_LOAD + jsr load_game rts @@ -180,6 +179,7 @@ done_increment_frame: .include "keyboard.s" .include "joystick.s" .include "draw_menu.s" +.include "load_game.s" ;=============================================== ; Data @@ -191,10 +191,4 @@ title_menu: .byte 16,23,"CREDITS",0 .byte 255 -enter_name_string: - .asciiz "PLEASE ENTER A NAME:" - -name: - .byte $0,$0,$0,$0,$0,$0,$0,$0 - .include "graphics_title/tfv_title.inc"