// *********************************************** // TITLE.C - title screen + incidental handlings // *********************************************** // **** includes #include //#include "storescr.h" #include "useful.h" #include "global.h" #include "init.h" #include "addrs.h" #include "pad.h" #include "creation.h" #include "calcs.h" #include "text.h" #include "init.h" #include "title.h" static GsBOXF tBox = {(1<<30)+(2<<28), -160, -128, 320, 256, 0, 0, 0}; static long tPos; // **** function prototypes u_long ProcessPadTitle(); void UpdateTitle(); void RenderTitle(); u_long HandleOptionsLoop(); void RenderOptions(u_long); // **** function definitions u_long TitleScreenLoop() { u_long TitleRunning = TRUE; long counter; u_long PAD; play_sound(SONG[0]); tPos = 0; flame[0].x= -160; flame[0].y= -128-256; flame[1].x= -160+256; flame[1].y= -128-256; flame[2].x= -160; flame[2].y= -128; flame[3].x= -160+256; flame[3].y= -128; for (counter=255; counter>-1; counter -=2) { tBox.r = tBox.g = tBox.b = counter; TITLE[0].r = TITLE[0].g = TITLE[0].b = (255-counter)/2; // printf("one "); RenderTitle(); // printf("one "); PAD = ReadPad(); // printf("one "); if ((PAD& PADstart) || (PAD& PADcross)) { counter = -1; tBox.r = tBox.g = tBox.b = 0; TITLE[0].r = TITLE[0].g = TITLE[0].b = 128; flame[0].y= -128; flame[1].y= -128; flame[2].y= -128+256; flame[3].y= -128+256; tPos = 255*8+2; } } while (ReadPad() != 0) {VSync(0);} while (TitleRunning == TRUE) { u_long tPadReturn = ProcessPadTitle(); if (tPadReturn != 0) TitleRunning = FALSE; RenderTitle(); } for (counter=0; counter<256; counter +=4) { tBox.r = tBox.g = tBox.b = counter; RenderTitle(); } return HandleOptionsLoop(); } u_long ProcessPadTitle() { u_long returnValue = 0; u_long PAD1 = ReadPad(); if (((PAD1& PADstart) || (PAD1& PADcross)) && (tPos <(255*4+1))) { tBox.r = tBox.g = tBox.b = 0; TITLE[0].r = TITLE[0].g = TITLE[0].b = 128; flame[0].y= -128; flame[1].y= -128; flame[2].y= -128+256; flame[3].y= -128+256; tPos = 255*8+2; while (ReadPad() != 0) {VSync(0);} PAD1 = 0; } if ((PAD1& PADstart) || (PAD1&PADcross)) { returnValue = 1; } return returnValue; } void RenderTitle() { u_long currentBuffer = GsGetActiveBuff(); GsClearOt(0, 0, &OTable_Header[currentBuffer]); GsSetWorkBase((PACKET*)Packet_Memory[currentBuffer]); // printf("two "); GsSortBoxFill(&tBox, &OTable_Header[currentBuffer], 1); GsSortFastSprite(&flame[0], &OTable_Header[currentBuffer], 2); GsSortFastSprite(&flame[1], &OTable_Header[currentBuffer], 2); GsSortFastSprite(&flame[2], &OTable_Header[currentBuffer], 2); GsSortFastSprite(&flame[3], &OTable_Header[currentBuffer], 2); GsSortFastSprite(&TITLE[0], &OTable_Header[currentBuffer], 0); // printf("two "); if ((tPos%8) == 0) { flame[0].y++; flame[1].y++; flame[2].y++; flame[3].y++; } if (tPos <(255*8+1)) tPos++; // printf("two "); DrawSync(0); VSync(0); GsSwapDispBuff(); GsSortClear(0,0,0, &OTable_Header[currentBuffer]); GsDrawOt(&OTable_Header[currentBuffer]); // printf("two "); } u_long HandleOptionsLoop() { u_long PAD; u_long inOptions = TRUE; u_long tReturnValue = FALSE; u_long loopRunning; u_long target; u_long lrdepressed; long counter; stop_sound(SONG[0]); play_sound(SONG[6]); while (inOptions == TRUE) { target =0; loopRunning = TRUE; lrdepressed = FALSE; SetModelInfo(&CHARINFO[1].charModel, 0, 0, 0, MakeTitleModel(GROUND_MEM)); CHARINFO[1].charModel.Object_Handler.attribute = GsDIV2; SetModelInfo(&CHARINFO[0].charModel, 0, 0, 0, PLAY1_TMD); CHARINFO[0].charVector.vx = 0; CHARINFO[0].charVector.vy = 2048; CHARINFO[0].charVector.vz = 0; RotateModel(&CHARINFO[0].charModel, &CHARINFO[0].charVector, 0, 0, 0); SetViewPoint(&ViewPoint, 400, 0, 0, -1024, -2048, 0, -512-512-256, 0, &CHARINFO[0].charModel.Object_Coord); while (loopRunning == TRUE) { PAD = ReadPad(); if ((PAD& PADstart) || (PAD& PADcross)) loopRunning = FALSE; if ((PAD& PADleft) && (lrdepressed == FALSE)) { if (target>0) target--; lrdepressed = TRUE; } if ((PAD& PADright) && (lrdepressed == FALSE)) { if (target<3) target++; lrdepressed = TRUE; } if (!(PAD& PADright) && !(PAD& PADleft)) lrdepressed = FALSE; CHARINFO[0].charVector.vy -= (CHARINFO[0].charVector.vy - (target*512+2048-1024))>>4; RotateModel(&CHARINFO[0].charModel, &CHARINFO[0].charVector, 0, 0, 0); if (ViewPoint.vry < (-1024+512-100)) { ViewPoint.vry += 8; } GsSetRefView2(&ViewPoint); RenderOptions(FALSE); } PLAYERANIM = 0; while (ViewPoint.vry > (-512-512-512)) { long tPos[3]; u_long *tMemAddress = (u_long *) (PLAYANIMFRAMES[PLAYERANIM>>2]); GsLinkObject4((u_long) (tMemAddress+3), &CHARINFO[0].charModel.Object_Handler, 0); PLAYERANIM = (PLAYERANIM+1) % 16; CHARINFO[0].charVector.vy -= (CHARINFO[0].charVector.vy - (target*512+2048-1024))>>4; RotateModel(&CHARINFO[0].charModel, &CHARINFO[0].charVector, 0, 0, 0); Calculate3dOffset(&CHARINFO[0].charVector, 0, 0, 12, &tPos[0]); CHARINFO[0].charModel.Object_Coord.coord.t[0] += tPos[0]; CHARINFO[0].charModel.Object_Coord.coord.t[2] += tPos[2]; ViewPoint.vry -= 10; GsSetRefView2(&ViewPoint); RenderOptions(FALSE); } if ((target == 0) || (target == 3)) inOptions = FALSE; if (target == 1) { u_char tText1[] = "-- CREDITS 1:4 -- Robert Swan - programming, level design, sound stuff, plagiarism, level graphics, terrible humour. One of these isn't true. #"; u_char tText2[] = "-- CREDITS 2:4 -- Barry Swan - character graphics and rendered title. Part time moneylender to Robert. #"; u_char tText3[] = "-- CREDITS 3:4 -- Tracy Sullivan - title screen artwork. Deserves medal for putting up with my hassle all the time. #"; u_char tText4[] = "-- CREDITS 4:4 -- I'd like to thank everyone who helped me on this, including my mother, my hairdresser, other yaroze members, and just like, well, everyone I've ever met. I'm so happy, I could just cry... #"; TEXT.y = -5; CreateText(&tText1[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} CreateText(&tText2[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} CreateText(&tText3[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} CreateText(&tText4[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} while (ReadPad() > 0) {RenderOptions(TRUE);} } if (target == 2) { u_char tText1[] = "-- HELP 1:4 -- Up button - move forward Down button - move backwards Left + Right button - rotate #"; u_char tText2[] = "-- HELP 2:4 -- Cross button - talk or swing sword Square button - use item Circle button - use magic #"; u_char tText3[] = "-- HELP 3:4 -- L1 + R1 buttons - select item L2 + R2 buttons - select magic Start button - pause #"; u_char tText4[] = "-- HELP 4:4 -- Any other sort of help required, try directory enquiries, or the Samaritans. Alternatively, phone up a freephone bank and ask for their advice. #"; TEXT.y = -5; CreateText(&tText1[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} CreateText(&tText2[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} CreateText(&tText3[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} CreateText(&tText4[0]); while (ReadPad() > 0) {RenderOptions(TRUE);} while (ReadPad() == 0) {RenderOptions(TRUE);} while (ReadPad() > 0) {RenderOptions(TRUE);} } } for (counter=128; counter>-1; counter-=8) { TITLE[0].r = TITLE[0].g = TITLE[0].b = counter; RenderOptions(FALSE); } CHARINFO[1].charModel.Object_Handler.attribute = 0; if (target == 3) tReturnValue = TRUE; stop_sound(SONG[6]); return tReturnValue; } void RenderOptions(u_long tTextOn) { u_long currentBuffer = GsGetActiveBuff(); GsClearOt(0, 0, &OTable_Header[currentBuffer]); GsSetWorkBase((PACKET*)Packet_Memory[currentBuffer]); GsSortFastSprite(&TITLE[0], &OTable_Header[currentBuffer], 0); DrawModel(&CHARINFO[0].charModel, &OTable_Header[currentBuffer], 1); DrawModel(&CHARINFO[1].charModel, &OTable_Header[currentBuffer], 0); if (tTextOn == TRUE) GsSortFastSprite(&TEXT, &OTable_Header[currentBuffer], 0); DrawSync(0); VSync(0); GsSwapDispBuff(); GsSortClear(0,0,0, &OTable_Header[currentBuffer]); GsDrawOt(&OTable_Header[currentBuffer]); }