mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-26 11:30:12 +00:00
tfv: optimize to not always draw sky
This commit is contained in:
parent
f68fd6704b
commit
3430394d99
@ -43,6 +43,16 @@
|
||||
#define SPEED 0x7b
|
||||
#define SPLASH_COUNT 0x7c
|
||||
#define OVER_WATER 0x7d
|
||||
#define NUM1L 0x7E
|
||||
#define NUM1H 0x7F
|
||||
#define NUM2L 0x80
|
||||
#define NUM2H 0x81
|
||||
#define RESULT 0x82 // 83,84,85
|
||||
#define NEGATE 0x86 // UNUSED?
|
||||
#define LAST_SPACEX_I 0x87
|
||||
#define LAST_SPACEY_I 0x88
|
||||
#define LAST_MAP_COLOR 0x89
|
||||
#define DRAW_SKY 0x8A
|
||||
|
||||
#define SHIPY 0xE4
|
||||
|
||||
@ -795,20 +805,27 @@ void draw_background_mode7(void) {
|
||||
int map_color;
|
||||
|
||||
ram[OVER_WATER]=0;
|
||||
cycles.mode7+=11;
|
||||
if (ram[DRAW_SKY]) {
|
||||
|
||||
/* Draw Sky */
|
||||
/* Originally wanted to be fancy and have sun too, but no */
|
||||
color_equals(COLOR_MEDIUMBLUE);
|
||||
cycles.mode7+=10;
|
||||
ram[DRAW_SKY]--;
|
||||
|
||||
for(ram[SCREEN_Y]=0;ram[SCREEN_Y]<6;ram[SCREEN_Y]+=2) {
|
||||
hlin_double(ram[DRAW_PAGE], 0, 40, ram[SCREEN_Y]);
|
||||
}
|
||||
/* Draw Sky */
|
||||
/* Originally wanted to be fancy and have sun too, but no */
|
||||
|
||||
color_equals(COLOR_MEDIUMBLUE);
|
||||
cycles.mode7+=11;
|
||||
|
||||
for(ram[SCREEN_Y]=0;ram[SCREEN_Y]<6;ram[SCREEN_Y]+=2) {
|
||||
hlin_double(ram[DRAW_PAGE], 0, 40, ram[SCREEN_Y]);
|
||||
}
|
||||
cycles.mode7+=(63+(16*40)+23)*5;
|
||||
/* Draw hazy horizon */
|
||||
color_equals(COLOR_GREY);
|
||||
hlin_double(ram[DRAW_PAGE], 0, 40, 6);
|
||||
/* Draw hazy horizon */
|
||||
color_equals(COLOR_GREY);
|
||||
hlin_double(ram[DRAW_PAGE], 0, 40, 6);
|
||||
cycles.mode7+=14+63+(16*40);
|
||||
}
|
||||
|
||||
|
||||
cycles.mode7+=30;
|
||||
/* FIXME: only do this if SPACEZ changes? */
|
||||
@ -1030,6 +1047,8 @@ int flying(void) {
|
||||
|
||||
ram[ANGLE]=1; /* 1 so you can see island */
|
||||
|
||||
ram[DRAW_SKY]=2;
|
||||
|
||||
ram[SPACEZ_I]=4;
|
||||
ram[SPACEZ_F]=0x80; /* Z=4.5 */
|
||||
|
||||
|
@ -71,3 +71,16 @@ Add a cache to lookup_map
|
||||
Total = 125,824
|
||||
Frame Rate = 7.95 fps
|
||||
|
||||
Don't draw sky every frame
|
||||
|
||||
Cycles: flying= 162
|
||||
Cycles: getkey= 46
|
||||
Cycles: page_flip= 26
|
||||
Cycles: multiply= 24,935
|
||||
Cycles: mode7= 69,099
|
||||
Cycles: lookup_map= 24,649
|
||||
Cycles: put_sprite= 2,561
|
||||
=================================
|
||||
Total = 121,478
|
||||
Frame Rate = 8.23 fps
|
||||
|
||||
|
@ -47,6 +47,9 @@ flying_start:
|
||||
lda #1
|
||||
sta ANGLE
|
||||
|
||||
lda #2 ; initialize sky both pages
|
||||
sta DRAW_SKY
|
||||
|
||||
lda #4
|
||||
sta SPACEZ_I
|
||||
lda #$80
|
||||
@ -530,16 +533,24 @@ draw_ship:
|
||||
|
||||
draw_background_mode7:
|
||||
|
||||
lda #0 ; 2
|
||||
sta OVER_WATER ; 3
|
||||
|
||||
lda DRAW_SKY ; 3
|
||||
beq no_draw_sky ; 2nt/3
|
||||
|
||||
; Draw Sky
|
||||
; FIXME: the sky never changes?
|
||||
; Only draw sky if necessary (we never overwrite it)
|
||||
|
||||
dec DRAW_SKY ; 5
|
||||
|
||||
lda #COLOR_BOTH_MEDIUMBLUE ; MEDIUMBLUE color ; 2
|
||||
sta COLOR ; 3
|
||||
|
||||
lda #0 ; 2
|
||||
sta OVER_WATER ; 3
|
||||
|
||||
;===========
|
||||
; 10
|
||||
; 11
|
||||
|
||||
sky_loop: ; draw line across screen
|
||||
ldy #40 ; from y=0 to y=6 ; 2
|
||||
@ -565,6 +576,9 @@ sky_loop: ; draw line across screen
|
||||
jsr hlin_double ; hlin 0,40 at 6 ; 63+(X*16)
|
||||
;===========
|
||||
; 63+(X*16)+14
|
||||
|
||||
no_draw_sky:
|
||||
|
||||
; FIXME: only do this if Z changes?
|
||||
; fixed_mul(&space_z,&BETA,&factor);
|
||||
;mul1
|
||||
|
@ -93,6 +93,7 @@ NEGATE EQU $86 ; UNUSED?
|
||||
LAST_SPACEX_I EQU $87
|
||||
LAST_SPACEY_I EQU $88
|
||||
LAST_MAP_COLOR EQU $89
|
||||
DRAW_SKY EQU $8A
|
||||
|
||||
SHIPY EQU $E4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user