checkin pending files
This commit is contained in:
parent
b1238af49d
commit
ae57fdb378
|
@ -62,8 +62,8 @@ TFV_WORLD: tfv_world.o
|
||||||
ld65 -o TFV_WORLD tfv_world.o -C ../linker_scripts/apple2_2000.inc
|
ld65 -o TFV_WORLD tfv_world.o -C ../linker_scripts/apple2_2000.inc
|
||||||
|
|
||||||
tfv_world.o: tfv_world.s \
|
tfv_world.o: tfv_world.s \
|
||||||
tfv_overworld.s tfv_drawmap.s \
|
tfv_overworld.s tfv_drawmap.s tfv_battle.s \
|
||||||
help_overworld.s \
|
help_overworld.s rotate_intro.s \
|
||||||
graphics_map/tfv_backgrounds.inc tfv_sprites.inc zp.inc
|
graphics_map/tfv_backgrounds.inc tfv_sprites.inc zp.inc
|
||||||
ca65 -o tfv_world.o tfv_world.s -l tfv_world.lst
|
ca65 -o tfv_world.o tfv_world.s -l tfv_world.lst
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,12 @@ print_help:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
help_message:
|
help_message:
|
||||||
.byte 1,18,"HELP",0
|
.byte 18,1,"HELP",0
|
||||||
.byte 3,4,"ARROWS - MOVE",0
|
.byte 3,4, "W/A/S/D,ARROWS - MOVE",0
|
||||||
.byte 3,5,"W/A/S/D - MOVE",0
|
.byte 3,8, "RETURN - ENTER / ACTION",0
|
||||||
.byte 3,6,"Z/X - SPEED UP / SLOW DOWN",0
|
.byte 3,9, "I - INVENTORY",0
|
||||||
.byte 3,7,"SPACE - STOP",0
|
.byte 3,10,"M - MAP",0
|
||||||
.byte 3,8,"RETURN - LAND / ENTER / ACTION",0
|
.byte 3,11,"ESC - QUIT",0
|
||||||
.byte 3,9,"I - INVENTORY",0
|
.byte 3,12,"J - JOYSTICK",0
|
||||||
.byte 3,10,"M - MAP",0
|
.byte 3,13,"CONTROL-T - TOGGLE SOUND",0
|
||||||
.byte 3,11,"ESC - QUIT",0
|
|
||||||
.byte $ff
|
.byte $ff
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -63,31 +63,31 @@ worldmap_keyboard:
|
||||||
|
|
||||||
jsr get_keypress ; get keypress
|
jsr get_keypress ; get keypress
|
||||||
|
|
||||||
; lda LASTKEY
|
|
||||||
|
|
||||||
worldmap_handle_q:
|
worldmap_handle_q:
|
||||||
cmp #('Q') ; if quit, then return
|
cmp #'Q' ; if quit, then return
|
||||||
bne worldmap_handle_up
|
bne worldmap_handle_up
|
||||||
rts
|
rts
|
||||||
|
|
||||||
worldmap_handle_up:
|
worldmap_handle_up:
|
||||||
cmp #('W')
|
cmp #'W'
|
||||||
bne worldmap_handle_down
|
bne worldmap_handle_down
|
||||||
|
|
||||||
dec NEWY
|
dec NEWY
|
||||||
dec NEWY
|
dec NEWY
|
||||||
inc MOVED
|
inc MOVED
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_down:
|
worldmap_handle_down:
|
||||||
cmp #('S')
|
cmp #'S'
|
||||||
bne worldmap_handle_left
|
bne worldmap_handle_left
|
||||||
|
|
||||||
inc NEWY
|
inc NEWY
|
||||||
inc NEWY
|
inc NEWY
|
||||||
inc MOVED
|
inc MOVED
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_left:
|
worldmap_handle_left:
|
||||||
cmp #('A')
|
cmp #'A'
|
||||||
bne worldmap_handle_right
|
bne worldmap_handle_right
|
||||||
|
|
||||||
lda DIRECTION ; 0=left, 1=right
|
lda DIRECTION ; 0=left, 1=right
|
||||||
|
@ -97,11 +97,13 @@ left_turn:
|
||||||
lda #0 ; change direction to left
|
lda #0 ; change direction to left
|
||||||
sta DIRECTION
|
sta DIRECTION
|
||||||
sta ODD ; stand (not walk) if changing
|
sta ODD ; stand (not walk) if changing
|
||||||
beq worldmap_handle_right ; skip ahead
|
beq done_handle_left ; bra skip ahead
|
||||||
|
|
||||||
go_left:
|
go_left:
|
||||||
dec NEWX ; decrement x
|
dec NEWX ; decrement x
|
||||||
inc MOVED ; we moved
|
inc MOVED ; we moved
|
||||||
|
done_handle_left:
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_right:
|
worldmap_handle_right:
|
||||||
cmp #('D')
|
cmp #('D')
|
||||||
|
@ -115,46 +117,55 @@ right_turn:
|
||||||
sta DIRECTION
|
sta DIRECTION
|
||||||
lda #0 ; change to standing
|
lda #0 ; change to standing
|
||||||
sta ODD
|
sta ODD
|
||||||
beq worldmap_handle_enter ; skip ahead
|
beq done_handle_right ; bra skip ahead
|
||||||
|
|
||||||
go_right:
|
go_right:
|
||||||
inc NEWX ; increment X
|
inc NEWX ; increment X
|
||||||
inc MOVED
|
inc MOVED
|
||||||
|
|
||||||
|
done_handle_right:
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_enter:
|
worldmap_handle_enter:
|
||||||
cmp #13
|
cmp #13
|
||||||
bne worldmap_handle_help
|
bne worldmap_handle_help
|
||||||
|
|
||||||
; jsr city_map
|
; jsr city_map
|
||||||
inc REFRESH
|
inc REFRESH
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_help:
|
worldmap_handle_help:
|
||||||
cmp #('H')
|
cmp #('H')
|
||||||
bne worldmap_handle_battle
|
bne worldmap_handle_battle
|
||||||
|
|
||||||
jsr print_help
|
jsr print_help
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_battle:
|
worldmap_handle_battle:
|
||||||
cmp #('B')
|
cmp #'B'
|
||||||
bne worldmap_handle_info
|
bne worldmap_handle_info
|
||||||
|
|
||||||
; jsr do_battle
|
jsr do_battle
|
||||||
inc REFRESH
|
inc REFRESH
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_info:
|
worldmap_handle_info:
|
||||||
cmp #('I')
|
cmp #'I'
|
||||||
bne worldmap_handle_map
|
bne worldmap_handle_map
|
||||||
|
|
||||||
; jsr print_info
|
; jsr print_info
|
||||||
inc REFRESH
|
inc REFRESH
|
||||||
|
jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_handle_map:
|
worldmap_handle_map:
|
||||||
cmp #('M')
|
cmp #('M')
|
||||||
bne worldmap_done_keyboard
|
bne worldmap_done_keyboard
|
||||||
|
|
||||||
jsr show_map
|
jsr show_map
|
||||||
inc REFRESH
|
inc REFRESH
|
||||||
|
|
||||||
|
; jmp worldmap_done_keyboard
|
||||||
|
|
||||||
worldmap_done_keyboard:
|
worldmap_done_keyboard:
|
||||||
|
|
||||||
;===========================
|
;===========================
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
.include "gr_offsets.s"
|
.include "gr_offsets.s"
|
||||||
.include "wait_keypressed.s"
|
.include "wait_keypressed.s"
|
||||||
|
|
||||||
|
.include "tfv_battle.s"
|
||||||
|
.include "rotate_intro.s"
|
||||||
|
|
||||||
;===============================================
|
;===============================================
|
||||||
; Variables
|
; Variables
|
||||||
;===============================================
|
;===============================================
|
||||||
|
|
|
@ -6,7 +6,8 @@ SDL_LIBS= `sdl-config --libs`
|
||||||
SDL_INCLUDE= `sdl-config --cflags`
|
SDL_INCLUDE= `sdl-config --cflags`
|
||||||
GR_SIM = ../gr-sim.a
|
GR_SIM = ../gr-sim.a
|
||||||
|
|
||||||
all: rotate rotate_zoom_in rotate_zoom_out
|
all: rotate rotate_zoom_in rotate_zoom_out rotate_in_lookup rotate_latecomer \
|
||||||
|
rotate_rotozoom rotate_rotolookup
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
|
@ -24,6 +25,14 @@ rotate.o: rotate.c demo_title.c
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
|
rotate_in_lookup: rotate_in_lookup.o $(GR_SIM)
|
||||||
|
$(CC) -o rotate_in_lookup rotate_in_lookup.o $(GR_SIM) $(SDL_LIBS) $(LFLAGS)
|
||||||
|
|
||||||
|
rotate_in_lookup.o: rotate_in_lookup.c demo_title.c
|
||||||
|
$(CC) $(CFLAGS) -c rotate_in_lookup.c
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
rotate_zoom_in: rotate_zoom_in.o $(GR_SIM)
|
rotate_zoom_in: rotate_zoom_in.o $(GR_SIM)
|
||||||
$(CC) -o rotate_zoom_in rotate_zoom_in.o $(GR_SIM) $(SDL_LIBS) $(LFLAGS)
|
$(CC) -o rotate_zoom_in rotate_zoom_in.o $(GR_SIM) $(SDL_LIBS) $(LFLAGS)
|
||||||
|
|
||||||
|
@ -38,8 +47,34 @@ rotate_zoom_out: rotate_zoom_out.o $(GR_SIM)
|
||||||
rotate_zoom_out.o: rotate_zoom_out.c demo_title.c
|
rotate_zoom_out.o: rotate_zoom_out.c demo_title.c
|
||||||
$(CC) $(CFLAGS) -c rotate_zoom_out.c
|
$(CC) $(CFLAGS) -c rotate_zoom_out.c
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
rotate_latecomer: rotate_latecomer.o $(GR_SIM)
|
||||||
|
$(CC) -o rotate_latecomer rotate_latecomer.o $(GR_SIM) $(SDL_LIBS) $(LFLAGS)
|
||||||
|
|
||||||
|
rotate_latecomer.o: rotate_latecomer.c demo_title.c
|
||||||
|
$(CC) $(CFLAGS) -c rotate_latecomer.c
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
rotate_rotozoom: rotate_rotozoom.o $(GR_SIM)
|
||||||
|
$(CC) -o rotate_rotozoom rotate_rotozoom.o $(GR_SIM) $(SDL_LIBS) $(LFLAGS)
|
||||||
|
|
||||||
|
rotate_rotozoom.o: rotate_rotozoom.c demo_title.c
|
||||||
|
$(CC) $(CFLAGS) -c rotate_rotozoom.c
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
rotate_rotolookup: rotate_rotolookup.o $(GR_SIM)
|
||||||
|
$(CC) -o rotate_rotolookup rotate_rotolookup.o $(GR_SIM) $(SDL_LIBS) $(LFLAGS)
|
||||||
|
|
||||||
|
rotate_rotolookup.o: rotate_rotolookup.c demo_title.c
|
||||||
|
$(CC) $(CFLAGS) -c rotate_rotolookup.c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o rotate rotate_zoom_in rotate_zoom_out
|
rm -f *~ *.o rotate rotate_zoom_in rotate_zoom_out rotate_in_lookup rotate_latecomer rotate_rotozoom rotate_rotolookup
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gr-sim.h"
|
||||||
|
#include "tfv_utils.h"
|
||||||
|
#include "tfv_zp.h"
|
||||||
|
|
||||||
|
#include "demo_title.c"
|
||||||
|
|
||||||
|
#define PI 3.14159265358979323846264
|
||||||
|
|
||||||
|
static int lookup_table_x[40][40];
|
||||||
|
static int lookup_table_y[40][40];
|
||||||
|
|
||||||
|
static int setup_lookup_table(void) {
|
||||||
|
|
||||||
|
int xx,yy,dx,dy;
|
||||||
|
double h,theta,thetadiff=PI/16;
|
||||||
|
double theta2,nx,ny,x2,y2,scale=1.0;
|
||||||
|
|
||||||
|
for(yy=0;yy<40;yy++) {
|
||||||
|
for(xx=0;xx<40;xx++) {
|
||||||
|
dx=(xx-20);
|
||||||
|
dy=(yy-20);
|
||||||
|
h=scale*sqrt((dx*dx)+(dy*dy));
|
||||||
|
theta=atan2(dy,dx);
|
||||||
|
|
||||||
|
theta2=theta+thetadiff;
|
||||||
|
nx=h*cos(theta2);
|
||||||
|
ny=h*sin(theta2);
|
||||||
|
|
||||||
|
x2=nx+20;
|
||||||
|
y2=ny+20;
|
||||||
|
|
||||||
|
if ((x2<0)||(x2>39)) {
|
||||||
|
lookup_table_x[xx][yy]=-1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lookup_table_x[xx][yy]=x2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((y2<0)||(y2>39)) {
|
||||||
|
lookup_table_y[xx][yy]=-1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lookup_table_y[xx][yy]=y2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int xx,yy,ch,color;
|
||||||
|
double thetadiff;
|
||||||
|
int frame=0;
|
||||||
|
double scale=1.0;
|
||||||
|
|
||||||
|
grsim_init();
|
||||||
|
gr();
|
||||||
|
|
||||||
|
setup_lookup_table();
|
||||||
|
|
||||||
|
// clear_screens();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE1;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE2;
|
||||||
|
clear_bottom();
|
||||||
|
|
||||||
|
|
||||||
|
// clear_bottom(PAGE0);
|
||||||
|
// clear_bottom(PAGE1);
|
||||||
|
// clear_bottom(PAGE2);
|
||||||
|
|
||||||
|
// grsim_unrle(demo_rle,0x400);
|
||||||
|
grsim_unrle(demo_rle,0xc00);
|
||||||
|
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
|
||||||
|
thetadiff=0;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
grsim_update();
|
||||||
|
|
||||||
|
ch=grsim_input();
|
||||||
|
if (ch=='q') break;
|
||||||
|
|
||||||
|
for(yy=0;yy<40;yy++) {
|
||||||
|
for(xx=0;xx<40;xx++) {
|
||||||
|
if ((lookup_table_x[xx][yy]==-1) ||
|
||||||
|
(lookup_table_y[xx][yy]==-1)) {
|
||||||
|
color=0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
color=scrn_page(lookup_table_x[xx][yy],
|
||||||
|
lookup_table_y[xx][yy],
|
||||||
|
PAGE2);
|
||||||
|
}
|
||||||
|
color_equals(color);
|
||||||
|
plot(xx,yy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thetadiff+=(3.14/16.0);
|
||||||
|
|
||||||
|
scale-=0.008;
|
||||||
|
|
||||||
|
usleep(30000);
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
/* reset */
|
||||||
|
if (frame==128) {
|
||||||
|
sleep(1);
|
||||||
|
thetadiff=0;
|
||||||
|
scale=1.0;
|
||||||
|
frame=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gr-sim.h"
|
||||||
|
#include "tfv_utils.h"
|
||||||
|
#include "tfv_zp.h"
|
||||||
|
|
||||||
|
#include "demo_title.c"
|
||||||
|
|
||||||
|
#define PI 3.14159265358979323946264
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int xx,yy,ch,color,i;
|
||||||
|
double dx,dy,u,v,_u,_v,au,av;
|
||||||
|
double theta=0;
|
||||||
|
int frame=0;
|
||||||
|
double scale=1.0;
|
||||||
|
|
||||||
|
grsim_init();
|
||||||
|
gr();
|
||||||
|
|
||||||
|
// clear_screens();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE1;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE2;
|
||||||
|
clear_bottom();
|
||||||
|
|
||||||
|
|
||||||
|
// clear_bottom(PAGE0);
|
||||||
|
// clear_bottom(PAGE1);
|
||||||
|
// clear_bottom(PAGE2);
|
||||||
|
|
||||||
|
// grsim_unrle(demo_rle,0x400);
|
||||||
|
grsim_unrle(demo_rle,0xc00);
|
||||||
|
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
grsim_update();
|
||||||
|
|
||||||
|
blah:
|
||||||
|
ch=grsim_input();
|
||||||
|
if (ch=='q') break;
|
||||||
|
if (ch==0) goto blah;
|
||||||
|
|
||||||
|
// ; -----------------
|
||||||
|
// ; ROTOZOOM Théorie:
|
||||||
|
// ; theta: angle de rotation
|
||||||
|
// ; scale : coeff pour le zoom
|
||||||
|
// ; xx et yy : coordonnées point écran
|
||||||
|
// ; u et v : coordonnées du point texture
|
||||||
|
// ; déplacement :
|
||||||
|
// ; dx = cos(theta)*scale
|
||||||
|
// ; dx = sin(theta)*scale
|
||||||
|
// ; u = u + xx
|
||||||
|
// ; v = v + yy
|
||||||
|
// ; texture(u,v)->screen(x,y)
|
||||||
|
// ;
|
||||||
|
//; code:
|
||||||
|
///;
|
||||||
|
//; ; déplacement
|
||||||
|
//; dx = cos(theta)*scale;
|
||||||
|
//; dy = sin(theta)*scale;
|
||||||
|
//;
|
||||||
|
//; for(yy=0;yy<24;yy++) { // pour les 24 lignes
|
||||||
|
//; _u = u; ; on sauve les coordonnées du premier pixel à afficher de la ligne
|
||||||
|
//; _v = v; ;
|
||||||
|
//; for(xx=0;xx<40;xx++) { // affichage d'une ligne horizontale (40 points)
|
||||||
|
//; u = u + dx ; déplacement
|
||||||
|
//; v = v + dy ; x et y
|
||||||
|
//; text(u,v) - > screen(xx,yy)
|
||||||
|
//; }
|
||||||
|
//; u = _u - dy; // on se place sur le premier pixel de la prochaine ligne a afficher
|
||||||
|
//; v = _v + dx;
|
||||||
|
//; }
|
||||||
|
//; theta++
|
||||||
|
|
||||||
|
|
||||||
|
dx = cos(theta)*scale;
|
||||||
|
dy = sin(theta)*scale;
|
||||||
|
|
||||||
|
u=0;
|
||||||
|
v=0;
|
||||||
|
|
||||||
|
for(i=0;i<20;i++) {
|
||||||
|
u=u-dx;
|
||||||
|
v=v-dy;
|
||||||
|
}
|
||||||
|
v=40-v;
|
||||||
|
|
||||||
|
|
||||||
|
for(yy=-20;yy<20;yy++) {
|
||||||
|
/* save starting point */
|
||||||
|
_u=u;
|
||||||
|
_v=v;
|
||||||
|
for(xx=-20;xx<20;xx++) {
|
||||||
|
|
||||||
|
/* rotate in center of screen */
|
||||||
|
au=u+20;
|
||||||
|
av=v;//+20;
|
||||||
|
|
||||||
|
// if ((au<0) || (au>39)) color=0;
|
||||||
|
// else if ((av<0) || (av>39)) color=0;
|
||||||
|
// else {
|
||||||
|
color=scrn_page(au,av,PAGE2);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (
|
||||||
|
((xx==-20) && (yy==-20)) ||
|
||||||
|
((xx==0) && (yy==0)) ||
|
||||||
|
((xx==19) && (yy==19))
|
||||||
|
) {
|
||||||
|
printf("%d,%d -> %0.2lf,%0.2lf\n",xx,yy,au,av);
|
||||||
|
}
|
||||||
|
|
||||||
|
color_equals(color);
|
||||||
|
plot(xx+20,yy+20);
|
||||||
|
|
||||||
|
u=u+dx;
|
||||||
|
v=v+dy;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* move on to next line */
|
||||||
|
/* since we start in upper left, add dy */
|
||||||
|
|
||||||
|
/* note: change sign for crazy effects */
|
||||||
|
u=_u-dy;
|
||||||
|
v=_v+dx;
|
||||||
|
|
||||||
|
}
|
||||||
|
theta+=(PI/4.0);
|
||||||
|
|
||||||
|
// scale-=0.008;
|
||||||
|
|
||||||
|
usleep(30000);
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
/* reset */
|
||||||
|
// if (frame==128) {
|
||||||
|
// sleep(1);
|
||||||
|
// theta=0;
|
||||||
|
// scale=1.0;
|
||||||
|
// frame=0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
/* based roughly on code from https://www.ocf.berkeley.edu/~horie/qbrotate.html */
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gr-sim.h"
|
||||||
|
#include "tfv_utils.h"
|
||||||
|
#include "tfv_zp.h"
|
||||||
|
|
||||||
|
#include "demo_title.c"
|
||||||
|
|
||||||
|
#define PI 3.14159265358979323946264
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int xx,yy,ch,color;
|
||||||
|
double ca,sa,cca,csa;
|
||||||
|
double theta=0;
|
||||||
|
int frame=0;
|
||||||
|
double scale=1.0;
|
||||||
|
|
||||||
|
double yca,ysa,xp,yp;
|
||||||
|
int xcenter=20,ycenter=20;
|
||||||
|
|
||||||
|
grsim_init();
|
||||||
|
gr();
|
||||||
|
|
||||||
|
// clear_screens();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE1;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE2;
|
||||||
|
clear_bottom();
|
||||||
|
|
||||||
|
|
||||||
|
// clear_bottom(PAGE0);
|
||||||
|
// clear_bottom(PAGE1);
|
||||||
|
// clear_bottom(PAGE2);
|
||||||
|
|
||||||
|
// grsim_unrle(demo_rle,0x400);
|
||||||
|
grsim_unrle(demo_rle,0xc00);
|
||||||
|
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
grsim_update();
|
||||||
|
|
||||||
|
blah:
|
||||||
|
ch=grsim_input();
|
||||||
|
if (ch=='q') break;
|
||||||
|
if (ch==0) goto blah;
|
||||||
|
|
||||||
|
ca = cos(theta)*scale;
|
||||||
|
sa = sin(theta)*scale;
|
||||||
|
|
||||||
|
cca = -20*ca;
|
||||||
|
csa = -20*sa;
|
||||||
|
|
||||||
|
yca=cca+ycenter;
|
||||||
|
ysa=csa+xcenter;
|
||||||
|
|
||||||
|
for(yy=-20;yy<20;yy++) {
|
||||||
|
|
||||||
|
xp=cca+ysa;
|
||||||
|
yp=yca-csa;
|
||||||
|
|
||||||
|
for(xx=-20;xx<20;xx++) {
|
||||||
|
|
||||||
|
if ((xp<0) || (xp>39)) color=0;
|
||||||
|
else if ((yp<0) || (yp>39)) color=0;
|
||||||
|
else {
|
||||||
|
color=scrn_page(xp,yp,PAGE2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
((xx==-20) && (yy==-20)) ||
|
||||||
|
((xx==0) && (yy==0)) ||
|
||||||
|
((xx==19) && (yy==19))
|
||||||
|
) {
|
||||||
|
printf("%d,%d -> %0.2lf,%0.2lf\n",xx,yy,xp,yp);
|
||||||
|
}
|
||||||
|
|
||||||
|
color_equals(color);
|
||||||
|
plot(xx+20,yy+20);
|
||||||
|
xp=xp+ca;
|
||||||
|
yp=yp-sa;
|
||||||
|
}
|
||||||
|
yca+=ca;
|
||||||
|
ysa+=sa;
|
||||||
|
}
|
||||||
|
theta+=(PI/8.0);
|
||||||
|
|
||||||
|
scale-=0.008;
|
||||||
|
|
||||||
|
usleep(30000);
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
/* reset */
|
||||||
|
if (frame==128) {
|
||||||
|
sleep(1);
|
||||||
|
theta=0;
|
||||||
|
scale=1.0;
|
||||||
|
frame=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
/* based roughly on code from https://www.ocf.berkeley.edu/~horie/qbrotate.html */
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gr-sim.h"
|
||||||
|
#include "tfv_utils.h"
|
||||||
|
#include "tfv_zp.h"
|
||||||
|
|
||||||
|
#include "demo_title.c"
|
||||||
|
|
||||||
|
#define PI 3.14159265358979323946264
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int xx,yy,ch,color;
|
||||||
|
double ca,sa;
|
||||||
|
double theta=0;
|
||||||
|
int frame=0;
|
||||||
|
double scale=1.0;
|
||||||
|
|
||||||
|
double y0,x0,yca,ysa,xp,yp,xd=20,yd=20;
|
||||||
|
int ytop=0,ybottom=40,xcenter=20,ycenter=20;
|
||||||
|
int xleft=0,xright=40;
|
||||||
|
|
||||||
|
grsim_init();
|
||||||
|
gr();
|
||||||
|
|
||||||
|
// clear_screens();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE1;
|
||||||
|
clear_bottom();
|
||||||
|
ram[DRAW_PAGE]=PAGE2;
|
||||||
|
clear_bottom();
|
||||||
|
|
||||||
|
|
||||||
|
// clear_bottom(PAGE0);
|
||||||
|
// clear_bottom(PAGE1);
|
||||||
|
// clear_bottom(PAGE2);
|
||||||
|
|
||||||
|
// grsim_unrle(demo_rle,0x400);
|
||||||
|
grsim_unrle(demo_rle,0xc00);
|
||||||
|
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
// gr_copy_to_current(0xc00);
|
||||||
|
// page_flip();
|
||||||
|
|
||||||
|
ram[DRAW_PAGE]=PAGE0;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
grsim_update();
|
||||||
|
|
||||||
|
blah:
|
||||||
|
ch=grsim_input();
|
||||||
|
if (ch=='q') break;
|
||||||
|
if (ch==0) goto blah;
|
||||||
|
|
||||||
|
ca = cos(theta)*scale;
|
||||||
|
sa = sin(theta)*scale;
|
||||||
|
|
||||||
|
y0=ytop-yd;
|
||||||
|
for(yy=ytop;yy<ybottom;yy++) {
|
||||||
|
y0=y0+1;
|
||||||
|
x0=xleft-xd;
|
||||||
|
yca=y0*ca+ycenter;
|
||||||
|
ysa=y0*sa+xcenter;
|
||||||
|
for(xx=xleft;xx<xright;xx++) {
|
||||||
|
x0=x0+1;
|
||||||
|
xp=x0*ca+ysa;
|
||||||
|
yp=yca-x0*sa;
|
||||||
|
|
||||||
|
if ((xp<0) || (xp>39)) color=0;
|
||||||
|
else if ((yp<0) || (yp>39)) color=0;
|
||||||
|
else {
|
||||||
|
color=scrn_page(xp,yp,PAGE2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
((xx==0) && (yy==0)) ||
|
||||||
|
((xx==20) && (yy==20)) ||
|
||||||
|
((xx==39) && (yy==39))
|
||||||
|
) {
|
||||||
|
printf("%d,%d -> %0.2lf,%0.2lf\n",xx,yy,xp,yp);
|
||||||
|
}
|
||||||
|
|
||||||
|
color_equals(color);
|
||||||
|
plot(xx,yy);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
theta+=(PI/8.0);
|
||||||
|
|
||||||
|
// scale-=0.008;
|
||||||
|
|
||||||
|
usleep(30000);
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
/* reset */
|
||||||
|
// if (frame==128) {
|
||||||
|
// sleep(1);
|
||||||
|
// theta=0;
|
||||||
|
// scale=1.0;
|
||||||
|
// frame=0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue