tfv: make the speed handling more similar on the two versions

This commit is contained in:
Vince Weaver 2017-11-26 18:27:58 -05:00
parent b72d12eea8
commit 1bb8491f68
2 changed files with 15 additions and 13 deletions

View File

@ -132,8 +132,7 @@ static int lookup_map(int xx, int yy) {
offset=yy<<3;
offset+=xx;
cycles.lookup_map+=34;
cycles.lookup_map+=37;
if ((yy>7) || (xx>7)) {
cycles.lookup_map+=14;
@ -938,7 +937,7 @@ int flying(void) {
ram[TURNING]=0;
}
else {
ram[TURNING]=235; // -20
ram[TURNING]=250; // -5
ram[ANGLE]-=1;
if (ram[ANGLE]<0) ram[ANGLE]+=ANGLE_STEPS;
@ -950,7 +949,7 @@ int flying(void) {
ram[TURNING]=0;
}
else {
ram[TURNING]=20;
ram[TURNING]=5;
ram[ANGLE]+=1;
if (ram[ANGLE]>=ANGLE_STEPS) ram[ANGLE]-=ANGLE_STEPS;
}
@ -959,7 +958,7 @@ int flying(void) {
cycles.flying+=5;
/* Used to be able to go backwards */
if (ch=='z') {
if (ram[SPEED]<3) ram[SPEED]++;
if (ram[SPEED]<4) ram[SPEED]++;
}
cycles.flying+=5;
if (ch=='x') {
@ -1099,7 +1098,7 @@ int flying(void) {
cycles.flying+=9;
iterations++;
if (iterations==100) {
if (iterations==20) {
int total_cycles;
total_cycles=cycles.flying+cycles.getkey+
cycles.page_flip+cycles.multiply+
@ -1118,7 +1117,8 @@ int flying(void) {
iterations=0;
}
usleep(20000);
/* Limit to around 10 fps */
usleep(100000);
}
return 0;

View File

@ -4,7 +4,8 @@
CONST_SHIPX EQU 15
CONST_TILE_W EQU 64
CONST_TILE_H EQU 64
CONST_MAP_MASK EQU (CONST_TILE_W - 1)
CONST_MAP_MASK_X EQU (CONST_TILE_W - 1)
CONST_MAP_MASK_Y EQU (CONST_TILE_H - 1)
CONST_LOWRES_W EQU 40
CONST_LOWRES_H EQU 40
CONST_BETA_I EQU $ff
@ -159,7 +160,7 @@ check_speedup:
;=========
; SPEED UP
;=========
lda #$3
lda #$8
cmp SPEED
beq check_speeddown
inc SPEED
@ -1019,20 +1020,21 @@ lookup_map:
lda SPACEX_I ; 3
;nomatch2:
sta LAST_SPACEX_I ; 3
and #CONST_MAP_MASK ; 2
sta TEMPY ; 3
and #CONST_MAP_MASK_X ; 2
sta SPACEX_I ; 3
tay ; 2
lda SPACEY_I ; 3
sta LAST_SPACEY_I ; 3
and #CONST_MAP_MASK ; wrap to 64x64 grid ; 2
and #CONST_MAP_MASK_Y ; wrap to 64x64 grid ; 2
sta SPACEY_I
asl ; 2
asl ; 2
asl ; multiply by 8 ; 2
clc ; 2
adc TEMPY ; add in X value ; 3
adc SPACEX_I ; add in X value ; 3
; only valid if x<8 and y<8
; SPACEX_I is in y