void horseRaceRender() { SDL_Event e; regRenderEventIndex = 0; //special-case code for double-clicks /* if (keyIsHit(LMOUSE_DOUBLE)) { keyPressUp(LMOUSE_DOUBLE); utyDoubleClick(); } if (demDemoRecording) { memcpy((ubyte *)&keyScanCode[0], (ubyte *)&keySaveScan[0], sizeof(keyScanCode));//freeze a snapshot of the key state demStateSave(); } else if (demDemoPlaying) { demStateLoad(); }*/ if (hrBackgroundReinit) { if (hrBackgroundTexture != 0) { glDeleteTextures(1, &hrBackgroundTexture); hrBackgroundTexture = 0; } hrBackgroundReinit = FALSE; hrBackgroundDirty = 3; hrBackgroundInitFrame = 0; } // Make sure the Homeworld text gets drawn on the correct frames if (hrBackgroundDirty) { regRecursiveSetDirty(&horseCrapRegion); hrDecRegion = NULL; } else { regionhandle reg; // "Clean" the region with the homeworld logo // in it so it doesn't re-draw all the time reg = horseCrapRegion.child; if (reg) { reg = reg->child; } while (reg && reg->drawFunction != &ferDrawDecorative) { reg = reg->next; } if (reg) { void regNULLRenderFunction(regionhandle region); hrDecRegion = reg; reg->drawFunction = regNULLRenderFunction; } } if (TitanActive) titanPumpEngine(); SDL_Delay(0); if (!SDL_PollEvent(0)) { regProcessingRegions = TRUE; regRegionProcess(horseCrapRegion.child, 0xffffffff); regProcessingRegions = FALSE; if (ChatTextEntryBox!=NULL) { bitSet(ChatTextEntryBox->reg.status,RSF_KeyCapture); keyBufferClear(); } } else { regRegionProcess(horseCrapRegion.child, 0xffffffff); while (SDL_PollEvent(0)) { if (SDL_WaitEvent(&e)) { HandleEvent(&e); if (multiPlayerGame) { if (keyIsStuck(ESCKEY)) { keyClearSticky(ESCKEY); //clear the sticky bit if (!hrAbortLoadConfirm) { if (!hrAbortLoadingGame) // if not already aborting { hrAbortLoadConfirm = feScreenStart(&horseCrapRegion, "AbortLoadConfirm"); } } else { feScreenDelete(hrAbortLoadConfirm); hrAbortLoadConfirm = NULL; } } } regProcessingRegions = TRUE; if (hrAbortLoadConfirm!=NULL) { ; } else if (ChatTextEntryBox!=NULL) { regRegionProcess(&ChatTextEntryBox->reg, 0xffffffff); } regProcessingRegions = FALSE; } if (ChatTextEntryBox!=NULL) { bitSet(ChatTextEntryBox->reg.status,RSF_KeyCapture); keyBufferClear(); } if (TitanActive) titanPumpEngine(); SDL_Delay(0); } } // All of the hacked stuff from the render task //glColor3ub(colRed(RND_StarColor), colGreen(RND_StarColor), colBlue(RND_StarColor)); if (ShouldHaveMousePtr) { if (!feShouldSaveMouseCursor()) { rndClearToBlack(); glClear(GL_DEPTH_BUFFER_BIT); } } // primErrorMessagePrint(); //default rendering scheme is primitives on any //functions which want it off should set it back on when done // I know this looks weird, but it's correct if(hrBackgroundInitFrame == 1) { hrInitBackground(); } // When there's no background loaded yet, it fills the screen with black if (hrBackgroundDirty) { hrDrawBackground(); } else { if (hrBackgroundTexture != 0) { glDeleteTextures(1, &hrBackgroundTexture); hrBackgroundTexture = 0; } } regFunctionsDraw(); //render all regions primErrorMessagePrint(); hrUncleanDecorative(); // We want the init code to be called on the 2nd pass. That way, the screen erases, // Then we incur the delay of loading the background. // For two frames -after that- we'll draw the background, // then just draw the progress bars. if(hrBackgroundDirty && hrBackgroundInitFrame) { if (hrBackgroundDirty > 0) { hrBackgroundDirty--; } } hrBackgroundInitFrame++; if (ShouldHaveMousePtr) { // set the cursor type, reset the variables then draw the mouse cursor mouseSelectCursorSetting(); mouseSetCursorSetting(); if (feShouldSaveMouseCursor()) { mouseStoreCursorUnder(); } mousePoll(); mouseDraw(); //draw mouse atop everything if (demDemoPlaying) { rndShamelessPlug(); } } rndFlush(); if (ShouldHaveMousePtr) { if (feShouldSaveMouseCursor()) { mouseRestoreCursorUnder(); } } primErrorMessagePrint(); }
/*----------------------------------------------------------------------------- Name : gcInGameChatEntry Description : Handles the chat text entry box messages. Inputs : Outputs : Return : void ----------------------------------------------------------------------------*/ void gcInGameChatEntry(char *name, featom *atom) { sdword user; chathistory *chat; char temp[60]; sdword ruentered; if (MessageToAllies == GC_RUTransfer) { if (FEFIRSTCALL(atom)) { chatentrybox = (textentryhandle)atom->pData; uicTextEntryInit(chatentrybox,UICTE_NoTextures|UICTE_ChatTextEntry|UICTE_NumberEntry); bitSet(chatentrybox->reg.status, RSF_KeyCapture); keyBufferClear(); bitSet(chatentrybox->textflags, UICTE_DropShadow); chatentrybox->shadowColor = colBlack; uicTextBufferResize(chatentrybox,GC_MAXCHARACTERS); return; } switch (uicTextEntryMessage(atom)) { case CM_AcceptText : { ruentered = atol(chatentrybox->textBuffer); //sendRUTransfer((udword)PLAYER_MASK(RUTransferToPlayer), ruentered); clWrapRUTransfer(&universe.mainCommandLayer,sigsPlayerIndex,RUTransferToPlayer, ruentered,0); //universe.players[sigsPlayerIndex].resourceUnits-=ruentered; InChatMode = FALSE; feScreenDisappear(NULL,NULL); } break; case CM_RejectText : { InChatMode = FALSE; feScreenDisappear(NULL,NULL); } break; case CM_KeyPressed: { ruentered = atol(chatentrybox->textBuffer); if (ruentered > universe.players[sigsPlayerIndex].resourceUnits || ruentered <= 0) { //backspace if ru's entered are more than player has, or if they're less than or equal to 0 uicBackspaceCharacter(chatentrybox); } } break; } } else { if (FEFIRSTCALL(atom)) { chatentrybox = (textentryhandle)atom->pData; uicTextEntryInit(chatentrybox,UICTE_NoTextures|UICTE_ChatTextEntry); bitSet(chatentrybox->reg.status, RSF_KeyCapture); keyBufferClear(); bitSet(chatentrybox->textflags, UICTE_DropShadow); chatentrybox->shadowColor = colBlack; uicTextBufferResize(chatentrybox,GC_MAXCHARACTERS); return; } switch (uicTextEntryMessage(atom)) { case CM_AcceptText : chat = (chathistory *)memAlloc(sizeof(chathistory),"InGameChat",NonVolatile); if (MessageToAllies==GC_ChatToAllies) { sendChatMessage(universe.players[sigsPlayerIndex].Allies,chatentrybox->textBuffer,(uword)sigsPlayerIndex); strcpy(chat->chatstring, chatentrybox->textBuffer); chat->messageType = GC_WHISPEREDMESSAGE; } else { if ((user=gcParseChatEntry(chatentrybox->textBuffer))!=-1) { if (user!=sigsPlayerIndex) { sendChatMessage(PLAYER_MASK(user),chatentrybox->textBuffer+strlen(playerNames[user])+2,(uword)sigsPlayerIndex); strcpy(chat->chatstring, chatentrybox->textBuffer+strlen(playerNames[user])+2); chat->messageType = GC_WHISPEREDMESSAGE; #ifdef DEBUG_STOMP regVerify(chatdrawregion); #endif bitSet(chatdrawregion->status,RSF_DrawThisFrame); } } else { sendChatMessage(OTHER_PLAYERS_MASK,chatentrybox->textBuffer,(uword)sigsPlayerIndex); strcpy(chat->chatstring, chatentrybox->textBuffer+strlen(playerNames[user])); chat->messageType = GC_NORMALMESSAGE; #ifdef DEBUG_STOMP regVerify(chatdrawregion); #endif bitSet(chatdrawregion->status,RSF_DrawThisFrame); } } strcpy(chat->userName, utyName); chat->playerindex = sigsPlayerIndex; gcAddChatItemToList(chat); uicTextEntrySet(chatentrybox,"",0); InChatMode = FALSE; feScreenDisappear(NULL,NULL); break; case CM_RejectText : InChatMode = FALSE; feScreenDisappear(NULL,NULL); break; case CM_KeyPressed: { if ((user=gcParseChatEntry(chatentrybox->textBuffer))!=-1) { sprintf(temp, "/%s ", playerNames[user]); if (strlen(chatentrybox->textBuffer) < strlen(temp)) uicTextEntrySet(chatentrybox, temp, strlen(temp)); } } break; } } }