b8  p_  .text @ .rdata@ @ @<.data` ` `?@.sdata* * J.sbss+ + P.bss+ + _********* * FUNCTION: a * DESCRIPTION: b * PARAMETERS: c * RETURNS: d ****************************************************************************/ #include #include #include #include "types.h" #include "asssert.h" #include "pad.h" #include "dump.h" #include "psxdefs.h" #include "sincos.h" /* Debug Macros */ /* NB: May be overruled in makefile */ //#define DEBUG #define ASSERT_ON #define DEF_VDMODE MODE_NTSC #define FLAG_WIDTH 220 #define FLAG_HEIGHT 140 #define NUM_POLYW 13 // 13 for 60Hz NTSC #define NUM_POLYH 13 #define MAX_POLYS ((NUM_POLYW * NUM_POLYH * 2) + 10) #define OT_LENGTH 2 u_char FlagDefCols[3][3] = {{0xbb,0x00,0x00}, {0x00,0xbb,0x00}, {0x00,0x00,0xbb}}; short FlagPoints[NUM_POLYW + 1][NUM_POLYH + 1][2]; short FlagPoints2[NUM_POLYW + 1][NUM_POLYH + 1][2]; u_char FlagCols[NUM_POLYW + 1][NUM_POLYH + 1][3]; int FlagColsCp[NUM_POLYW + 1][NUM_POLYH + 1][3]; GsOT W_OT[2]; GsOT_TAG W_OT_Tag[2][1<' int menu_sel; char sel[6] = {MENU_SELCHAR, ' ', ' ', ' ', ' ', ' '}; // Default screen information is PAL based, but is converted by initScrMode if necessary typedef struct { int w; int h; int intl; int dither; int vram; } SCRMODE; int scr_width; int scr_height; int scr_interlace; int scr_vdmode; SCRMODE scr_mode = {320, 256, GsOFSGPU, GsDITHER, GsDEPTH16}; void initData(void); void renderScreen(void); void cleanUp(void); void initFlagPoints(void); void initDisplace_Tabs(void); void fpsCount(void); SCRMODE * initScrMode(SCRMODE *); int augmentInput(void); int i, j; // Wanted these to be type register, but gcc won't allow it void main() { initData(); renderScreen(); cleanUp(); } void renderScreen(void) { register int x1s, y1s, x1, y1; int tmp; while( (augmentInput() & (PADstart | PADselect)) != (PADstart | PADselect)) { GsClearOt(0,0,&W_OT[scr_buf]); x1s = x1sin_cur; y1s = y1sin_cur; for (j = 0; j <= NUM_POLYH; j++) { x1 = x1s; y1 = y1s; for (i = 0; i <= NUM_POLYW; i++) { FlagPoints2[i][j][0] = FlagPoints[i][j][0] + XDisp_Tab[x1]; FlagPoints2[i][j][1] = FlagPoints[i][j][1] + XDisp_Tab[y1]; // quick (slooo) faked lighting! tmp = -(rsin(x1) + rsin(y1)) + (4096 * 2) + 4096; FlagCols[i][j][0] = (u_char) ((FlagColsCp[i][j][0] * tmp) >> 14); FlagCols[i][j][1] = (u_char) ((FlagColsCp[i][j][1] * tmp) >> 14); FlagCols[i][j][2] = (u_char) ((FlagColsCp[i][j][2] * tmp) >> 14); x1 += x1_modw; x1 &= 4095; y1 += y1_modw; y1 &= 4095; } x1s += x1_modh; x1s &= 4095; y1s += y1_modh; y1s &= 4095; } pck = PacketArea[scr_buf]; for (j = 0; j < NUM_POLYH; j++) { for (i = 0; i < NUM_POLYW; i++) 'F @40,($ 8''!!  < ?1&؀!(0!00 !0؀!D#D@!C!D $!|("0@B0@@"2@܀b( @b$܀ $!|("܀>$!|("0:b0@ b0@ "2@b0&0b0@b0@"2@&4܀b,/@ DJPV]ciou{ &,28>DKQW]ciou{ #)/4:@FLRX^djpv|%+17<BHNTY_ekpv| !&,27=BHNSY^djouz $*/4:?EJOUZ_ejouz     " ' , 1 7 < A F K P U Z _ e j o t y ~      " & + 0 5 : ? D H M R W \ ` e j o s x }       $ ( - 1 6 : > C G L P U Y ^ b f k o t x |       " & * . 2 6 : > B F J N R V Z ^ b f j n r v z ~        # ' * . 2 5 9 < @ C G J N Q U X \ _ b f i m p t w z ~   "%(+.147:<?BEHKMPSVY[^adfiloqtwy|  !#%')+-/13579;=?ACEFHJLNPQSUWYZ\^`aceghjlmoqrtvwyz|} !$&)+.0358:=?BEGJLOQTVY[^`cehjloqtvy{~    "$&(*,.02468:<>@BDFHJLNPRTVXZ[]_aceghjlnprsuwy{|~ofZq4>  tXY0((BLK_FILL *)pck, PSDOFSX[scr_buf ^ 1], PSDOFSY[scr_buf ^ 1]); setXY0((BLK_FILL *)pck, 0, d main() { printf("\n ***Wibbly Flag!*** \n\nby Alex Amsel [IBEYOND] alex@teeth.demon.co.uk\n\n"); printf("Currently using %d Goraud Textured Triangles and no big tables\n\n", NUM_POLYW * NUM_POLYH * 2); printf("All controller buttons can be used on the menu\n"); printf("Start Button resets all values to defaults\n"); printf("Select Button resets current value to zero\n"); printf("Select Button on CONTROLLER 2 ***while loading*** to switch PAL/NTSC\n"); printf("Select & Start to Quit\n\n"); initData(); renderScreen(); cleanUp(); } void renderScreen(void) { register PACKET *pck; register int i, j, x1, y1; register u_char col1, col2, col3, col4; int x1s, y1s; fps_count = ON; while( (augmentInput() & (PADstart | PADselect)) != (PADstart | PADselect)) { GsClearOt(0,0,&W_OT[scr_buf]); x1s = x1sin_cur; y1s = y1sin_cur; for (j = 0; j <= NUM_POLYH; j++) { x1 = x1s; y1 = y1s; for (i = 0; i <= NUM_POLYW; i++) { Flb