So, ye'r wantin tae dae a 3D gemm for the Atari Jaguar? Ye'r wantin tae pit 2D on tap for HUDs an siclike? Weel it's actual pretty seemple, bit funnin it oot wis a real pain in the backside, sae am wantin tae gie yese the answer here tae stap yese fae the same fate!
This guide assumes ye'r uisin an able tae compile the SDK fund here an ur uisin the 3D demo fund in it. Wi aw that, lat's git fired intae it.
We'r gaun'ae grab this eemage an pit it in the wirkin directory fur the project. Click on it tae dounload the TGA file we'll need.
Whan it's in the projeck files, go intae Makefile
an whaur it says TEXTURES
, eik jaguar.cry
at the end, an the section sud leuk like this.
TEXTURES = c1.cry c2.cry c3.cry u1.cry u2.cry u3.cry l1.cry l2.cry l3.cry \
radar1a.cry radar1b.cry radar1d.cry radar1e.cry turret1b.cry \
winrt.cry winfrnt.cry hood.cry rtfront.cry rtside.cry roof.cry \
gunside.cry guntop.cry wing.cry wingside.cry gunback.cry engfrnt.cry \
engtop.cry engside.cry bottomfr.cry bottom.cry finside.cry fin.cry \
engbot.cry back3.cry jaguar.cry
Farther doun, in FIXDATA
, eik -ii jaguar.cry _jagbits
at the stairt, as it's ordered fae the biggest tae smawest eemage, an wir eemage is bigger nor ony texturs the demo uises. The code sud leuk like this.
FIXDATA = -ii jaguar.cry _jagbits \
-ii rtside.cry _rtside -ii c1.cry _c1 -ii c2.cry _c2 \
-ii c3.cry _c3 -ii u1.cry _u1 -ii u2.cry _u2 -ii u3.cry _u3 \
-ii l1.cry _l1 -ii l2.cry _l2 -ii l3.cry _l3 \
-ii radar1b.cry _radar1b -ii radar1d.cry _radar1d \
-ii roof.cry _roof -ii wing.cry _wing -ii turret1b.cry _turret1b \
-ii engside.cry _engside -ii rtfront.cry _rtfront \
-ii winfrnt.cry _winfrnt -ii hood.cry _hood -ii back3.cry _back3 \
-ii winrt.cry _winrt -ii engtop.cry _engtop \
-ii wingside.cry _wingside -ii bottom.cry _bottom \
-ii fin.cry _fin -ii guntop.cry _guntop -ii engfrnt.cry _engfrnt \
-ii radar1a.cry _radar1a -ii radar1e.cry _radar1e \
-ii bottomfr.cry _bottomfr -ii gunside.cry _gunside \
-ii finside.cry _finside -ii gunback.cry _gunback \
-ii engbot.cry _engbot \
-ii $(FONTDIR)/clr6x12.jft _usefnt
The seicont bit, _jagbits
, is whit the program is gaun'ae refer tae it as. Ye kin name it whitiver ye want.
An that's that! The compiler will convert the TGA tae CRY fur the program. Ye'll juist need tae pynt tae it uisin the name gien tae it.
Fur this section, we'r muvin ontae demo.c
. Tae stairt, we'r needin tae set a coople values. The maist important is the eemage itsel. Whaur aw the variables ur declared at the tap, pit in these lines
#define BMP_WIDTH 128
#define BMP_HEIGHT 16
extern short jagbits[];
Than scroll doun tae the object list arrays. Cawed buf1_olist[]
an buf2_olist[]
. We hiv 2 as the 3D is dooble-buffered.
Chynge the array sizes an pit in the follaein code atwessh the 2 elements awready thare.
/* Bitmap for sprite */
{{OL_SCALEBITMAP, /* type */
20+(320-BMP_WIDTH)/2, 20+(240-BMP_HEIGHT), /* x, y */
0L, /* link */
(char *)jagbits, /* data */
BMP_HEIGHT, BMP_WIDTH*3/4, BMP_WIDTH/4, /* height, dwidth, iwidth */
4, 1, 0, OL_TRANS, 0, /* depth, pitch, index, flags, firstpix */
OL_SCALE_NONE,OL_SCALE_TRIPLE,0}}, /* scaling stuff */
A lot tae wawkthrou here, lat me break it doun.
OL_SCALEBITMAP
- This vailyie represents whit object is bein listit. This kin be a regular OL_BITMAP
, OL_SKIP
or an array o ither vailyes we willnae titch on here.(char *)jagbits
- This is the pynter we declared earlier on the code. This is tellin it whit tae render.OL_TRANS
, thit makes colour 0 transparent. Color 0 referrin tae bleck.OL_SCALE_NONE
, OL_SCALE_HALF
, OL_SCALE_DOUBLE
, or OL_SCALE_TRIPLE
.Fur mair information aboot the Object List, this tutorial in Inglis on AtariAge pits it pretty weel!
The resultin code sud leuk like this.
/* object list for first screen */
union olist buf1_olist[3] =
{
{{OL_BITMAP, /* type */
20+(320-OBJWIDTH)/2, 20+(240-OBJHEIGHT), /* x, y */
0L, /* link */
DATA1, /* data */
OBJHEIGHT, OBJWIDTH*3/4, OBJWIDTH/4, /* height, dwidth, iwidth */
4, 3, 0, 0, 0, /* depth, pitch, index, flags, firstpix */
0,0,0}}, /* scaling stuff */
/* Bitmap for sprite */
{{OL_SCALEBITMAP, /* type */
20+(320-BMP_WIDTH)/2, 20+(240-BMP_HEIGHT), /* x, y */
0L, /* link */
(char *)jagbits, /* data */
BMP_HEIGHT, BMP_WIDTH*3/4, BMP_WIDTH/4, /* height, dwidth, iwidth */
4, 1, 0, OL_TRANS, 0, /* depth, pitch, index, flags, firstpix */
OL_SCALE_NONE,OL_SCALE_TRIPLE,0}}, /* scaling stuff */
{{OL_STOP}}
};
/* object list for second screen */
union olist buf2_olist[3] =
{
{{OL_BITMAP, /* type */
20+(320-OBJWIDTH)/2, 20+(240-OBJHEIGHT), /* x, y */
0L, /* link */
DATA2, /* data */
OBJHEIGHT, OBJWIDTH*3/4, OBJWIDTH/4, /* height, dwidth, iwidth */
4, 3, 0, 0, 0, /* depth, pitch, index, flags, firstpix */
0,0,0}}, /* scaling stuff */
/* Bitmap for sprite */
{{OL_SCALEBITMAP, /* type */
20+(320-BMP_WIDTH)/2, 20+(240-BMP_HEIGHT), /* x, y */
0L, /* link */
(char *)jagbits, /* data */
BMP_HEIGHT, BMP_WIDTH*3/4, BMP_WIDTH/4, /* height, dwidth, iwidth */
4, 1, 0, OL_TRANS, 0, /* depth, pitch, index, flags, firstpix */
OL_SCALE_NONE,OL_SCALE_TRIPLE,0}}, /* scaling stuff */
{{OL_STOP}}
};
Ye'll hiv tae eik the sprite ontae baith arrays. Itherwise it will anely render wance ivery 2 frame.
An that's it! Compile the code an rin, ye sud be seein this.
A few hings tae note fae here on
buf1_olist[index].bit.xpos = x
, chynge xpos tae ypos
fur the y axis, hscale
fur horizontal scale, an vscale
fur vertical scale.OLbldto(drawbuf ? buf2_olist : buf1_olist, drawbuf ? packed_olist2 : packed_olist1);
at the end o the gemm loop.hscale
an vscale
urnae nummered vailyies, s' ye'll hiv tae uise the const vailyes listit abuin.OL_SKIP
like sic:
buf1_olist[index].type = OL_SKIP;
buf2_olist[index].type = OL_SKIP;
That sud be aboot it! Go wild!
Big thanks tae CrazyAce an JagChris fae AtariAge fur giein me a haun tae feegure this oot!