mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-29 08:55:10 +00:00
hgr: vgi: add support for sparse triangles
This commit is contained in:
parent
1ba2a3b0e3
commit
673a08f403
@ -24,7 +24,7 @@ HELLO: hello.bas
|
||||
VGI-MYST: myst_vgi.o
|
||||
ld65 -o VGI-MYST myst_vgi.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
myst_vgi.o: clock.data rocket.data rocket_door.data red_book.data fireplace.data \
|
||||
myst_vgi.o: clock.data rocket.data rocket_door.data red_book.data fireplace.data path.data \
|
||||
myst_vgi.s vgi_clearscreen.s vgi_rectangle.s vgi_circles.s vgi_lines.s \
|
||||
vgi_triangles.s
|
||||
ca65 -o myst_vgi.o myst_vgi.s -l myst_vgi.lst
|
||||
@ -38,6 +38,12 @@ clock.data: make_boxes_asm clock.vgi
|
||||
|
||||
###
|
||||
|
||||
path.data: make_boxes_asm path.vgi
|
||||
echo "path_data:" > path.data
|
||||
./make_boxes_asm < path.vgi >> path.data
|
||||
|
||||
###
|
||||
|
||||
rocket.data: make_boxes_asm rocket.vgi
|
||||
echo "rocket_data:" > rocket.data
|
||||
./make_boxes_asm < rocket.vgi >> rocket.data
|
||||
|
@ -115,6 +115,7 @@ VGI Dithered Rectangle (6)
|
||||
VGI Vertical Triangle (7)
|
||||
|
||||
VTRI color vx vy xl xr yb
|
||||
VTRISK color vx vy xl xr yb skip
|
||||
|
||||
Draw a flat bottom filled triangle of color.
|
||||
The top vertex is at (vx,vy)
|
||||
@ -124,6 +125,9 @@ VGI Vertical Triangle (7)
|
||||
|
||||
This was much simpler than a proper filled triangle routine.
|
||||
|
||||
The skip variant adds SKIP as an X increment instead of 1
|
||||
In memoy the skip is encoded in the high nibble of color
|
||||
|
||||
===========================
|
||||
VGI Horizontal Triangle (8)
|
||||
|
||||
@ -145,6 +149,18 @@ VGI Vertical Striped Rectangle (9)
|
||||
of 7 you can't get true stripes (for that we'd need a 4-byte
|
||||
repeating pattern)
|
||||
|
||||
=============
|
||||
VGI Line (10)
|
||||
|
||||
LINE color x1 y1 x2 y2
|
||||
|
||||
Draws a line from (x1,y1)
|
||||
|
||||
Note, X1 can be up to 279 here (the color is overloaded behind
|
||||
the scenes to support this)
|
||||
|
||||
The last point you draw is the starting point for LINETO
|
||||
|
||||
============
|
||||
VGI End (15)
|
||||
|
||||
|
@ -1,79 +1,79 @@
|
||||
; Clock from Myst
|
||||
0 255 ; white background
|
||||
1 1 6 0 90 140 191 ; ocean left
|
||||
1 1 6 140 90 279 191 ; ocean right
|
||||
6 0x8 0x22 157 121 208 165 ; tower shadow
|
||||
6 0x8 0x22 160 165 204 191 ; tower shadow
|
||||
CLS 255 ; white background
|
||||
RECT 1 6 0 90 140 191 ; ocean left
|
||||
RECT 1 6 140 90 279 191 ; ocean right
|
||||
DRECT 0x8 0x22 157 121 208 165 ; tower shadow
|
||||
DRECT 0x8 0x22 160 165 204 191 ; tower shadow
|
||||
; Gear Base
|
||||
1 4 0 141 116 209 129 ; gear base shade
|
||||
1 4 0 147 125 164 134 ; gear base shade left
|
||||
1 7 3 157 129 176 134 ; gear base left
|
||||
1 7 3 192 128 212 134 ; gear base center
|
||||
1 4 0 156 131 171 136 ; gear base shade left
|
||||
1 7 3 211 115 221 131 ; gear base right
|
||||
1 7 3 211 120 233 131 ; gear base right
|
||||
1 4 4 176 130 190 134 ; shade center
|
||||
1 4 4 193 134 213 137 ; shade center right
|
||||
1 4 4 212 129 230 134 ; shade center-right
|
||||
1 4 4 222 122 234 125 ; shade base right
|
||||
RECT 4 0 141 116 209 129 ; gear base shade
|
||||
RECT 4 0 147 125 164 134 ; gear base shade left
|
||||
RECT 7 3 157 129 176 134 ; gear base left
|
||||
RECT 7 3 192 128 212 134 ; gear base center
|
||||
RECT 4 0 156 131 171 136 ; gear base shade left
|
||||
RECT 7 3 211 115 221 131 ; gear base right
|
||||
RECT 7 3 211 120 233 131 ; gear base right
|
||||
RECT 4 4 176 130 190 134 ; shade center
|
||||
RECT 4 4 193 134 213 137 ; shade center right
|
||||
RECT 4 4 212 129 230 134 ; shade center-right
|
||||
RECT 4 4 222 122 234 125 ; shade base right
|
||||
; Tower
|
||||
1 0 0 180 17 213 121 ; tower right
|
||||
6 0x4c 0x33 156 20 209 126 ; tower
|
||||
6 0x4c 0x33 145 9 212 20 ; left roof
|
||||
6 0x4c 0x33 154 4 212 20 ; left roof
|
||||
6 0x4c 0x33 162 0 220 20 ; right roof
|
||||
4 7 155 28
|
||||
5 212 17 ; bottom line
|
||||
4 0 150 20
|
||||
5 214 9 ; middle line
|
||||
4 0 146 13
|
||||
5 219 0 ; top line
|
||||
1 0 0 214 0 219 23 ; right roof
|
||||
RECT 0 0 180 17 213 121 ; tower right
|
||||
DRECT 0x4c 0x33 156 20 209 126 ; tower
|
||||
DRECT 0x4c 0x33 145 9 212 20 ; left roof
|
||||
DRECT 0x4c 0x33 154 4 212 20 ; left roof
|
||||
DRECT 0x4c 0x33 162 0 220 20 ; right roof
|
||||
POINT 7 155 28
|
||||
LINETO 212 17 ; bottom line
|
||||
POINT 0 150 20
|
||||
LINETO 214 9 ; middle line
|
||||
POINT 0 146 13
|
||||
LINETO 219 0 ; top line
|
||||
RECT 0 0 214 0 219 23 ; right roof
|
||||
; Door
|
||||
3 7 180 98 12 ; doorway top
|
||||
1 7 7 168 96 192 127 ; doorway
|
||||
1 7 7 164 98 195 104 ; doorway cross
|
||||
1 7 7 177 83 182 88 ; doorway top
|
||||
3 5 180 98 8 ; door circle top
|
||||
1 5 5 172 96 188 123 ; door
|
||||
FCIRC 7 180 98 12 ; doorway top
|
||||
RECT 7 7 168 96 192 127 ; doorway
|
||||
RECT 7 7 164 98 195 104 ; doorway cross
|
||||
RECT 7 7 177 83 182 88 ; doorway top
|
||||
FCIRC 5 180 98 8 ; door circle top
|
||||
RECT 5 5 172 96 188 123 ; door
|
||||
; clock face
|
||||
3 5 181 49 20 ; clock face ring
|
||||
3 7 181 49 18 ; clock face white
|
||||
2 5 181 49 14 ; clock face inner
|
||||
4 0 181 49 ; clock hand origin
|
||||
5 181 32 ; clock hand
|
||||
FCIRC 5 181 49 20 ; clock face ring
|
||||
FCIRC 7 181 49 18 ; clock face white
|
||||
CIRC 5 181 49 14 ; clock face inner
|
||||
POINT 0 181 49 ; clock hand origin
|
||||
LINETO 181 32 ; clock hand
|
||||
; marker switch
|
||||
1 5 5 148 110 156 120 ; marker switch
|
||||
1 2 2 149 106 155 109 ; top switch
|
||||
RECT 5 5 148 110 156 120 ; marker switch
|
||||
RECT 2 2 149 106 155 109 ; top switch
|
||||
; puzzle
|
||||
1 0 4 60 152 120 178 ; black box
|
||||
1 0 4 70 147 109 152 ; black box (more)
|
||||
1 0 4 81 145 99 147 ; black box (more)
|
||||
4 7 104 173 ; edge (white)
|
||||
5 104 161 ; lineto top
|
||||
4 5 60 152 ; top edge (orange)
|
||||
5 104 161 ; right
|
||||
5 118 151 ; more right
|
||||
5 84 143 ; left
|
||||
5 60 152 ; back to origin
|
||||
1 0 0 78 142 86 147 ; left shaft
|
||||
1 5 5 72 137 86 140 ; left knob
|
||||
1 5 5 75 146 85 151 ; left base
|
||||
1 0 0 90 145 97 152 ; right shaft
|
||||
1 5 5 88 141 101 145 ; right knob
|
||||
1 5 5 91 150 96 154 ; right base
|
||||
1 2 5 100 152 105 157 ; button
|
||||
RECT 0 4 60 152 120 178 ; black box
|
||||
RECT 0 4 70 147 109 152 ; black box (more)
|
||||
RECT 0 4 81 145 99 147 ; black box (more)
|
||||
POINT 7 104 173 ; edge (white)
|
||||
LINETO 104 161 ; lineto top
|
||||
POINT 5 60 152 ; top edge (orange)
|
||||
LINETO 104 161 ; right
|
||||
LINETO 118 151 ; more right
|
||||
LINETO 84 143 ; left
|
||||
LINETO 60 152 ; back to origin
|
||||
RECT 0 0 78 142 86 147 ; left shaft
|
||||
RECT 5 5 72 137 86 140 ; left knob
|
||||
RECT 5 5 75 146 85 151 ; left base
|
||||
RECT 0 0 90 145 97 152 ; right shaft
|
||||
RECT 5 5 88 141 101 145 ; right knob
|
||||
RECT 5 5 91 150 96 154 ; right base
|
||||
RECT 2 5 100 152 105 157 ; button
|
||||
; grass / trees
|
||||
1 5 1 0 163 63 191 ; grass left
|
||||
1 5 1 63 167 143 191 ; grass middle
|
||||
1 5 1 133 177 184 191 ; grass again
|
||||
1 5 1 177 185 230 191 ; grass right
|
||||
6 0xA8 0xAA 28 0 39 178 ; middle tree
|
||||
6 0x8 0x22 1 13 99 44 ; leaves
|
||||
6 0xA8 0xAA 0 0 12 188 ; left tree
|
||||
6 0xA8 0xAA 70 0 81 187 ; right tree
|
||||
1 0 0 39 183 67 186 ; shadow
|
||||
1 0 0 12 179 39 183 ; shadow
|
||||
6 0x8 0x22 66 1 99 19 ; leaves
|
||||
6 0x8 0x22 15 49 49 79 ; leaves
|
||||
15
|
||||
RECT 5 1 0 163 63 191 ; grass left
|
||||
RECT 5 1 63 167 143 191 ; grass middle
|
||||
RECT 5 1 133 177 184 191 ; grass again
|
||||
RECT 5 1 177 185 230 191 ; grass right
|
||||
DRECT 0xA8 0xAA 28 0 39 178 ; middle tree
|
||||
DRECT 0x8 0x22 1 13 99 44 ; leaves
|
||||
DRECT 0xA8 0xAA 0 0 12 188 ; left tree
|
||||
DRECT 0xA8 0xAA 70 0 81 187 ; right tree
|
||||
RECT 0 0 39 183 67 186 ; shadow
|
||||
RECT 0 0 12 179 39 183 ; shadow
|
||||
DRECT 0x8 0x22 66 1 99 19 ; leaves
|
||||
DRECT 0x8 0x22 15 49 49 79 ; leaves
|
||||
END
|
||||
|
@ -14,6 +14,9 @@
|
||||
#define VGI_VSTRIPE_RECTANGLE 9
|
||||
#define VGI_END 15
|
||||
|
||||
/* non-encoded pseudo-values */
|
||||
#define VGI_VERT_TRIANGLE_SKIP 128+7
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
char buffer[1024];
|
||||
@ -21,6 +24,7 @@ int main(int argc, char **argv) {
|
||||
int type,color1,color2,x1,x2,y1,y2,r,xl,xr,yt,yb;
|
||||
int line=1;
|
||||
int size=0;
|
||||
int skip=0;
|
||||
|
||||
while(1) {
|
||||
|
||||
@ -53,7 +57,9 @@ int main(int argc, char **argv) {
|
||||
if (!strncmp(buffer,"DRECT",5)) {
|
||||
type=VGI_DITHER_RECTANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"VTRI",4)) {
|
||||
if (!strncmp(buffer,"VTRISK",6)) {
|
||||
type=VGI_VERT_TRIANGLE_SKIP;
|
||||
} else if (!strncmp(buffer,"VTRI",4)) {
|
||||
type=VGI_VERT_TRIANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"HTRI",4)) {
|
||||
@ -158,7 +164,21 @@ int main(int argc, char **argv) {
|
||||
&color1,
|
||||
&x1,&y1,&xl,&xr,&yb);
|
||||
printf(".byte $%02X,",(type<<4)|7);
|
||||
printf("$%02X,",color1);
|
||||
printf("$%02X,",(1<<4)|color1); /* skip=1 */
|
||||
printf("$%02X,",x1);
|
||||
printf("$%02X,",y1);
|
||||
printf("$%02X,",xl);
|
||||
printf("$%02X,",xr);
|
||||
printf("$%02X\n",yb);
|
||||
size+=7;
|
||||
break;
|
||||
|
||||
case VGI_VERT_TRIANGLE_SKIP: /* vertical triangle w skip*/
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&xl,&xr,&yb,&skip);
|
||||
printf(".byte $%02X,",(VGI_VERT_TRIANGLE<<4)|7);
|
||||
printf("$%02X,",(skip<<4)|color1);
|
||||
printf("$%02X,",x1);
|
||||
printf("$%02X,",y1);
|
||||
printf("$%02X,",xl);
|
||||
|
@ -14,16 +14,16 @@ vgi_test:
|
||||
|
||||
; get pointer to image data
|
||||
|
||||
; lda #<fireplace_data
|
||||
; sta VGIL
|
||||
; lda #>fireplace_data
|
||||
; sta VGIH
|
||||
|
||||
lda #<clock_data
|
||||
lda #<path_data
|
||||
sta VGIL
|
||||
lda #>clock_data
|
||||
lda #>path_data
|
||||
sta VGIH
|
||||
|
||||
; lda #<clock_data
|
||||
; sta VGIL
|
||||
; lda #>clock_data
|
||||
; sta VGIH
|
||||
|
||||
jsr play_vgi
|
||||
|
||||
jsr wait_until_keypress
|
||||
@ -228,7 +228,7 @@ all_done:
|
||||
.include "rocket_door.data"
|
||||
.include "red_book.data"
|
||||
.include "fireplace.data"
|
||||
|
||||
.include "path.data"
|
||||
|
||||
; string data
|
||||
;
|
||||
|
18
graphics/hgr/vgi/path.vgi
Normal file
18
graphics/hgr/vgi/path.vgi
Normal file
@ -0,0 +1,18 @@
|
||||
; Path from Myst
|
||||
CLS 255 ; white background
|
||||
RECT 1 5 0 85 140 191 ; ground left
|
||||
RECT 1 5 140 85 279 191 ; ground right
|
||||
; tower
|
||||
DRECT 0x4c 0x33 216 22 235 33 ; tower
|
||||
RECT 5 5 216 33 236 56 ; mountain
|
||||
VTRI 5 216 33 207 216 60 ; mountain
|
||||
; temple
|
||||
DRECT 0x4c 0x33 181 56 237 96 ; tower
|
||||
VTRI 0 204 53 186 225 60 ; triangle
|
||||
RECT 0 0 203 68 211 81 ; door
|
||||
POINT 7 189 68
|
||||
LINETO 189 82
|
||||
POINT 7 197 67
|
||||
LINETO 197 84
|
||||
POINT 7
|
||||
END
|
@ -1,5 +1,6 @@
|
||||
; VGI Triangles
|
||||
|
||||
SKIP = $70
|
||||
|
||||
;========================
|
||||
; VGI vertical triangle
|
||||
@ -13,8 +14,16 @@
|
||||
VGI_TYB = P5
|
||||
|
||||
vgi_vertical_triangle:
|
||||
lda VGI_TCOLOR
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta SKIP
|
||||
|
||||
ldx VGI_TCOLOR
|
||||
lda VGI_TCOLOR
|
||||
and #$f
|
||||
tax
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
@ -32,13 +41,17 @@ vtri_loop:
|
||||
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
inc VGI_TXL
|
||||
lda VGI_TXL
|
||||
clc
|
||||
adc SKIP
|
||||
sta VGI_TXL
|
||||
; inc VGI_TXL
|
||||
; lda VGI_TXL
|
||||
cmp VGI_TXR
|
||||
bcc vtri_loop
|
||||
|
||||
done_vtri:
|
||||
jmp vgi_loop
|
||||
jmp vgi_loop ; bra
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user