void RemoveSmokeEffectFromTile( INT16 sGridNo, INT8 bLevel ) { ANITILE *pAniTile; UINT8 ubLevelID; // Get ANI tile... if ( bLevel == 0 ) { ubLevelID = ANI_STRUCT_LEVEL; } else { ubLevelID = ANI_ONROOF_LEVEL; } pAniTile = GetCachedAniTileOfType( sGridNo, ubLevelID, ANITILE_SMOKE_EFFECT ); if ( pAniTile != NULL ) { DeleteAniTile( pAniTile ); SetRenderFlags( RENDER_FLAG_FULL ); } // Unset flags in world.... // ( // check to see if we are the last one.... if ( GetCachedAniTileOfType( sGridNo, ubLevelID, ANITILE_SMOKE_EFFECT ) == NULL ) { gpWorldLevelData[ sGridNo ].ubExtFlags[ bLevel ] &= ( ~ANY_SMOKE_EFFECT ); } }
void RemoveTraitObjectsFromViewArea() { if (gsMineMaxCellY == -1) { return; } INT32 ubX, ubY, ubZ; BOOLEAN fChanged = FALSE; for ( ubX=gsMineMinCellX; ubX<=gsMineMaxCellX; ++ubX ) { for ( ubY=gsMineMinCellY; ubY<=gsMineMaxCellY; ++ubY ) { for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ ) { INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo; INT8& bTrait = gCoverViewArea[ ubX ][ ubY ][ ubZ ].bTrait; if ( bTrait != -1 || TraitTileHasAdjTile( ubX, ubY, ubZ )) { TileDefines tile = GetTileTraitIndex( bTrait ); RemoveCoverObjectFromWorld( sGridNo, tile, (BOOLEAN) ubZ ); bTrait = -1; fChanged = TRUE; } } } } // Re-render the scene! if ( fChanged ) { SetRenderFlags( RENDER_FLAG_FULL ); } }
void EndUIPlan( ) { int cnt; SOLDIERTYPE *pSoldier; // Zero out any planned soldiers for( cnt = MAX_NUM_SOLDIERS; cnt < TOTAL_SOLDIERS; cnt++ ) { pSoldier = MercPtrs[ cnt ]; if ( pSoldier->bActive ) { if ( pSoldier->sPlannedTargetX != -1 ) { SetRenderFlags(RENDER_FLAG_FULL ); } TacticalRemoveSoldier( pSoldier->ubID ); } } gfInUIPlanMode = FALSE; gusSelectedSoldier = gpUIStartPlannedSoldier->ubID; gfPlotNewMovement = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Leaving Planning Mode" ); }
void AddMinesObjectsToViewArea() { if (gsMineMaxCellY == -1) { return; } INT32 ubX, ubY, ubZ; BOOLEAN fChanged = FALSE; for ( ubX=gsMineMinCellX; ubX<=gsMineMaxCellX; ++ubX ) { for ( ubY=gsMineMinCellY; ubY<=gsMineMaxCellY; ++ubY ) { for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ ) { INT8& bMines = gCoverViewArea[ ubX ][ ubY ][ ubZ ].bMines; if ( bMines != MINES_ALL && ( bMines != MAX_MINES || MineTileHasAdjTile( ubX, ubY, ubZ ) ) ) { INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo; TileDefines tile = GetTileMinesIndex( bMines ); AddCoverObjectToWorld( sGridNo, tile, (BOOLEAN) ubZ ); fChanged = TRUE; } } } } // Re-render the scene! if ( fChanged ) { SetRenderFlags( RENDER_FLAG_FULL ); } }
// This function changes the graphic of the statue and adds the exit grid... void ChangeO3SectorStatue( BOOLEAN fFromExplosion ) { EXITGRID ExitGrid; UINT16 usTileIndex; INT16 sX, sY; // Remove old graphic ApplyMapChangesToMapTempFile( TRUE ); // Remove it! // Get index for it... GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 5 ), &usTileIndex ); RemoveStruct( 13830, usTileIndex ); // Add new one... if ( fFromExplosion ) { // Use damaged peice GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 7 ), &usTileIndex ); } else { GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 8 ), &usTileIndex ); // Play sound... PlayJA2Sample( OPEN_STATUE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } AddStructToHead( 13830, usTileIndex ); // Add exit grid ExitGrid.ubGotoSectorX = 3; ExitGrid.ubGotoSectorY = MAP_ROW_O; ExitGrid.ubGotoSectorZ = 1; ExitGrid.usGridNo = 13037; AddExitGridToWorld( 13669, &ExitGrid ); gpWorldLevelData[ 13669 ].uiFlags |= MAPELEMENT_REVEALED; // Turn off permenant changes.... ApplyMapChangesToMapTempFile( FALSE ); // Re-render the world! gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; // FOR THE NEXT RENDER LOOP, RE-EVALUATE REDUNDENT TILES InvalidateWorldRedundency( ); SetRenderFlags(RENDER_FLAG_FULL); // Redo movement costs.... ConvertGridNoToXY( 13830, &sX, &sY ); RecompileLocalMovementCostsFromRadius( 13830, 5 ); }
BOOLEAN CutWireFence( INT16 sGridNo ) { STRUCTURE * pStructure; pStructure = FindCuttableWireFenceAtGridNo( sGridNo ); if (pStructure) { pStructure = SwapStructureForPartnerAndStoreChangeInMap( sGridNo, pStructure ); if (pStructure) { RecompileLocalMovementCosts( sGridNo ); SetRenderFlags( RENDER_FLAG_FULL ); return( TRUE ); } } return( FALSE ); }
void CenterScreenAtMapIndex( INT32 iMapIndex ) { INT16 sWorldX, sWorldY; INT16 sCellX, sCellY; //Get X, Y world GRID Coordinates sWorldY = ( iMapIndex / WORLD_COLS ); sWorldX = iMapIndex - ( sWorldY * WORLD_COLS ); //Convert into cell coords sCellY = sWorldY * CELL_Y_SIZE; sCellX = sWorldX * CELL_X_SIZE; //Set the render values, so that the screen will render here next frame. gsRenderCenterX = sCellX; gsRenderCenterY = sCellY; SetRenderFlags( RENDER_FLAG_FULL ); }
void RemoveCoverObjectsFromViewArea() { if (gsMaxCellY == -1) { return; } register INT32 ubX, ubY, ubZ; BOOLEAN fChanged = FALSE; for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX ) { for ( ubY=gsMinCellY; ubY<=gsMaxCellY; ++ubY ) { for ( ubZ=0; ubZ<COVER_Z_CELLS; ++ubZ ) { INT8& bCover = gCoverViewArea[ ubX ][ ubY ][ ubZ ].bCover; if ( bCover != -1 ) { INT32& sGridNo = gCoverViewArea[ ubX ][ ubY ][ ubZ ].sGridNo; BOOLEAN& fInverseColor = gCoverViewArea[ ubX ][ ubY ][ ubZ ].fInverseColor; TileDefines tile = GetTileCoverIndex(!fInverseColor ? bCover : MAX_COVER - bCover); RemoveCoverObjectFromWorld( sGridNo, tile, (BOOLEAN) ubZ ); bCover = -1; fChanged = TRUE; } } } } // Re-render the scene! if ( fChanged ) { SetRenderFlags( RENDER_FLAG_FULL ); } }
BOOLEAN SetOpenableStructureToClosed( INT16 sGridNo, UINT8 ubLevel ) { STRUCTURE * pStructure; STRUCTURE * pNewStructure; pStructure = FindStructure( sGridNo, STRUCTURE_OPENABLE ); if ( !pStructure ) { return( FALSE ); } if ( pStructure->fFlags & STRUCTURE_OPEN ) { pNewStructure = SwapStructureForPartner( sGridNo, pStructure ); if ( pNewStructure != NULL) { RecompileLocalMovementCosts( sGridNo ); SetRenderFlags( RENDER_FLAG_FULL ); } } // else leave it as is! return( TRUE ); }
UINT32 MPChatScreenHandle( ) { InputAtom InputEvent; if ( gfNewChatBox ) { // If in game screen.... if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) { //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; //UINT8 *pDestBuf, *pSrcBuf; if( gfStartedFromGameScreen ) { HandleTacticalUILoseCursorFromOtherScreen( ); } else { HandleMAPUILoseCursorFromOtherScreen( ); } gfStartedFromGameScreen = FALSE; gfStartedFromMapScreen = FALSE; } gfNewChatBox = FALSE; return( MP_CHAT_SCREEN ); } UnmarkButtonsDirty( ); // Render the box! if ( gChatBox.fRenderBox ) { // Render the Background ( this includes the text string) RenderMercPopUpBoxFromIndex( gChatBox.iBoxId, gChatBox.sX, gChatBox.sY, FRAME_BUFFER ); UINT16 usWidth = StringPixLength( gzMPChatboxText[0], CHATBOX_FONT_TITLE ); int usPosY = 0; int usPosX = 0; usPosY = gChatBox.sY + 10; usPosX = gChatBox.sX + ((gChatBox.usWidth - usWidth) / 2); DrawTextToScreen( gzMPChatboxText[0], usPosX, usPosY, usWidth, CHATBOX_FONT_TITLE, CHATBOX_FONT_COLOR, DEFAULT_SHADOW, FALSE, CENTER_JUSTIFIED | TEXT_SHADOWED ); // Render the toggle button strings for(UINT8 cnt=0; cnt<NUM_CHAT_TOGGLES; cnt++) { GUI_BUTTON* btn = ButtonList[ guiChatToggles[ cnt ] ]; usPosX = btn->XLoc + 12 + 10; usPosY = btn->YLoc; usWidth = StringPixLength( gzMPChatToggleText[ cnt ], CHATBOX_FONT_TOGGLE ); DrawTextToScreen( gzMPChatToggleText[ cnt ], usPosX, usPosY, usWidth, CHATBOX_FONT_TOGGLE, CHATBOX_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } if (gIncludeChatLog) { // draw chatbox HVOBJECT hHandle; // get and blt panel GetVideoObject(&hHandle, guiCHATLOGIMG ); BltVideoObject( FRAME_BUFFER , hHandle, 0, gChatMessageLogRegion.iLeft, gChatMessageLogRegion.iTop, VO_BLT_SRCTRANSPARENCY,NULL ); BltVideoObject( FRAME_BUFFER , hHandle, 1, gChatMessageLogRegion.iRight+CHATBOX_SLIDER_GAP, gChatMessageLogRegion.iTop, VO_BLT_SRCTRANSPARENCY,NULL ); // draw slider DisplayChatLogScrollBarSlider( ); // draw chat log text DisplayStringsInChatLogMessageList(); } } MarkButtonsDirty(); EnableDisableChatLogScrollButtonsAndRegions(); // Render buttons RenderButtons( ); // render text boxes //SaveFontSettings(); SetFontDestBuffer( FRAME_BUFFER, gChatTextBoxRegion.iLeft , gChatTextBoxRegion.iTop , gChatTextBoxRegion.iRight , gChatTextBoxRegion.iBottom, FALSE ); RenderAllTextFields(); // textbox system call SetFontDestBuffer( FRAME_BUFFER, 0 , 0 , SCREEN_WIDTH , SCREEN_HEIGHT , FALSE ); //RestoreFontSettings(); EndFrameBufferRender( ); // carter, need key shortcuts for clearing up message boxes // Check for esc bool bHandled; while (DequeueEvent(&InputEvent) == TRUE) { bHandled = false; if(InputEvent.usEvent == KEY_DOWN ) { if( ( InputEvent.usParam == ESC ) ) { // Exit messagebox gChatBox.bHandled = MSG_BOX_RETURN_NO; memset(gszChatBoxInputString,0,sizeof(CHAR16)*255); bHandled = true; } if( InputEvent.usParam == ENTER ) { // retrieve the string from the text box Get16BitStringFromField( 0, gszChatBoxInputString, 255 ); // these indexes are based on the order created // Exit messagebox gChatBox.bHandled = MSG_BOX_RETURN_OK; bHandled = true; } // OJW - 20090403 - add better key control UINT8 ubDesiredMessageIndex; UINT8 ubNumMessages; ubNumMessages = GetRangeOfChatLogMessages(); if ( ubNumMessages > MAX_CHATLOG_MESSAGES ) { if (InputEvent.usParam == PGUP) { //move up a page ChatScreenMsgScrollUp( MAX_CHATLOG_MESSAGES ); bHandled = true; } if (InputEvent.usParam == PGDN) { // move down a page ChatScreenMsgScrollDown( MAX_CHATLOG_MESSAGES ); bHandled = true; } if (InputEvent.usParam == HOME) { // move to the beginning ChangeCurrentChatScreenMessageIndex( 0 ); bHandled = true; } if (InputEvent.usParam == END) { // move to end ubDesiredMessageIndex = ubNumMessages - MAX_CHATLOG_MESSAGES; ChangeCurrentChatScreenMessageIndex( ubDesiredMessageIndex ); bHandled = true; } } } // send to text box if (!bHandled) HandleTextInput( &InputEvent ); } if ( gChatBox.bHandled ) { SetRenderFlags( RENDER_FLAG_FULL ); return( ExitChatBox( gChatBox.bHandled ) ); } return( MP_CHAT_SCREEN ); }
UINT32 ExitChatBox( INT8 ubExitCode ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; UINT8 *pDestBuf, *pSrcBuf; SGPPoint pPosition; // Delete popup! RemoveMercPopupBoxFromIndex( gChatBox.iBoxId ); gChatBox.iBoxId = -1; // OJW - 20090208 - Add text input box type // exit text input mode in this screen and clean up text boxes KillAllTextInputModes(); RemoveButton( gChatBox.uiOKButton ); RemoveButton( gChatBox.uiNOButton ); // Delete button images UnloadButtonImage( gChatBox.iButtonImages ); //Remove the toggle buttons for(int cnt=0; cnt<NUM_CHAT_TOGGLES; cnt++) { RemoveButton( guiChatToggles[ cnt ] ); } // delete graphics and scrolling buttons / slider if (gIncludeChatLog) { RemoveButton( guiChatLogScrollButtons[ 0 ] ); RemoveButton( guiChatLogScrollButtons[ 1 ] ); UnloadButtonImage( guiChatLogScrollButtonsImage[ 0 ] ); UnloadButtonImage( guiChatLogScrollButtonsImage[ 1 ] ); DeleteVideoObjectFromIndex( guiCHATLOGIMG ); DeleteChatLogSliderBar(); } #if 0 if (!gChatBox.fWasPaused) { // Unpause game.... UnLockPauseState(); UnPauseGame(); // UnPause timers as well.... PauseTime( FALSE ); } #endif // Restore mouse restriction region... RestrictMouseCursor( &gOldCursorLimitRectangle ); gfInChatBox = FALSE; // Call done callback! if ( gChatBox.ExitCallback != NULL ) { (*(gChatBox.ExitCallback))( ubExitCode ); } //if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback if( ( ( gChatBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer ) { // restore what we have under here... pSrcBuf = LockVideoSurface( gChatBox.uiSaveBuffer, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, gChatBox.sX , gChatBox.sY, 0, 0, gChatBox.usWidth, gChatBox.usHeight ); UnLockVideoSurface( gChatBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); InvalidateRegion( gChatBox.sX, gChatBox.sY, (INT16)( gChatBox.sX + gChatBox.usWidth ), (INT16)( gChatBox.sY + gChatBox.usHeight ) ); } fRestoreBackgroundForMessageBox = FALSE; gfDontOverRideSaveBuffer = TRUE; if( fCursorLockedToArea == TRUE ) { GetMousePos( &pPosition ); if( ( pPosition.iX > ChatBoxRestrictedCursorRegion.iRight ) || ( pPosition.iX > ChatBoxRestrictedCursorRegion.iLeft ) && ( pPosition.iY < ChatBoxRestrictedCursorRegion.iTop ) && ( pPosition.iY > ChatBoxRestrictedCursorRegion.iBottom ) ) { SimulateMouseMovement( pOldMousePosition.iX , pOldMousePosition.iY ); } fCursorLockedToArea = FALSE; RestrictMouseCursor( &ChatBoxRestrictedCursorRegion ); } // Remove region MSYS_RemoveRegion(&(gChatBox.BackRegion) ); // Remove save buffer! DeleteVideoSurfaceFromIndex( gChatBox.uiSaveBuffer ); switch( gChatBox.uiExitScreen ) { case GAME_SCREEN: if ( InOverheadMap( ) ) { gfOverheadMapDirty = TRUE; } else { SetRenderFlags( RENDER_FLAG_FULL ); } break; case MAP_SCREEN: fMapPanelDirty = TRUE; break; } if ( gfFadeInitialized ) { SetPendingNewScreen(FADE_SCREEN); return( FADE_SCREEN ); } return( gChatBox.uiExitScreen ); }
void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLocators, UINT8 ubLevel, BOOLEAN fForce ) { INT32 maincnt,markercnt,marker,tilesLeftToSee,prevmarker; UINT8 cnt; INT32 Inc[6],Dir[6]; INT8 itemVisible = FALSE; INT8 Blocking,twoMoreTiles,markerDir; INT8 nextDir=0; UINT8 who; //,itemIndex; // for each square checked UINT8 dir,range,Path2; //DBrot: More Rooms //UINT8 ubRoomNo; UINT16 usRoomNo; BOOLEAN fCheckForRooms = FALSE; ITEM_POOL *pItemPool; BOOLEAN fHiddenStructVisible; UINT8 ubMovementCost; BOOLEAN fTravelCostObs; BOOLEAN fGoneThroughDoor = FALSE; BOOLEAN fThroughWindow = FALSE; BOOLEAN fItemsQuoteSaid = FALSE; UINT16 usIndex; BOOLEAN fRevealItems = TRUE; BOOLEAN fStopRevealingItemsAfterThisTile = FALSE; INT8 bTallestStructureHeight; INT32 iDoorGridNo; STRUCTURE *pStructure, *pDummy; INT8 bStructHeight; INT8 bThroughWindowDirection; if ( pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY ) { //pSoldier->needToLookForItems = FALSE; return; } if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } // Return if this guy has no gridno, has bad life, etc if(TileIsOutOfBounds(pSoldier->sGridNo) || !pSoldier->bInSector || pSoldier->stats.bLife < OKLIFE ) { return; } if (pSoldier->bBlindedCounter > 0) { return; } gubGridNoValue++; if ( gubGridNoValue == 255 ) { // Reset! Assert(gubGridNoMarkers); memset(gubGridNoMarkers, 0, sizeof(UINT8)*WORLD_MAX); gubGridNoValue = 1; } // OK, look for doors MercLooksForDoors( pSoldier, TRUE ); who = pSoldier->ubID; dir = pSoldier->ubDirection; //NumMessage("good old reveal",dir); // a gassed merc can only see 1 tile away due to blurred vision if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) { range = 1; } else { range = pSoldier->bViewRange; // Flugente: adjust sightrange range = (UINT8)( (range * (100 + pSoldier->GetSightRangeBonus()) ) / 100); // balance item viewing range between normal and the limit set by opplist-type functions -- CJC range = (AdjustMaxSightRangeForEnvEffects( pSoldier, LightTrueLevel( pSoldier->sGridNo, pSoldier->pathing.bLevel), range ) + range) / 2; } BuildSightDir(dir,(UINT32 *)&Dir[0],(UINT32 *)&Dir[1],(UINT32 *)&Dir[2],(UINT32 *)&Dir[3],(UINT32 *)&Dir[4]); for (cnt = 0; cnt < 5; cnt++) Inc[cnt] = DirectionInc( (UINT8) Dir[cnt]); // create gridno increment for NOVIEW - in other words, no increment! Inc[5] = 0; Dir[5] = pSoldier->ubDirection; if (dir % 2 == 1) /* even numbers use ViewPath2 */ Path2 = TRUE; else Path2 = FALSE; // ATE: if in this special cercumstance... our guys are moving on their own... // Stop sighting items // IN the future, we may want to do something else here... if ( gTacticalStatus.uiFlags & OUR_MERCS_AUTO_MOVE ) { itemsToo = FALSE; } for (maincnt = 0; maincnt < MAXVIEWPATHS; maincnt++) { marker = pSoldier->sGridNo; Blocking = FALSE; twoMoreTiles = FALSE; tilesLeftToSee = 99; fRevealItems = TRUE; fStopRevealingItemsAfterThisTile = FALSE; #ifdef _DEBUG if ( _KeyDown( NUM_LOCK ) ) { memset( gubFOVDebugInfoInfo, 0, sizeof( gubFOVDebugInfoInfo ) ); SetRenderFlags( RENDER_FLAG_FULL ); RenderWorld( ); } #endif for (markercnt = 0; markercnt < range; markercnt++) { //fGoneThroughDoor = FALSE; //fThroughWindow = FALSE; prevmarker = marker; nextDir = 99; fCheckForRooms = FALSE; fTravelCostObs = FALSE; if ( fStopRevealingItemsAfterThisTile ) { fRevealItems = FALSE; fStopRevealingItemsAfterThisTile = FALSE; } if (Path2) { markerDir = ViewPath2[maincnt][markercnt]; if (markercnt < 12) nextDir = ViewPath2[maincnt][markercnt+1]; } else { markerDir = ViewPath[maincnt][markercnt]; if (markercnt < 12) nextDir = ViewPath[maincnt][markercnt+1]; } // OK, check flags for going through door/window last tile if ( fThroughWindow == 1 ) { // ATE: Make sure we are going through the same direction! // THis is to solve the drassen SAM problem with seeing through walls if ( Dir[markerDir] == bThroughWindowDirection) { fThroughWindow = 2; } else { fThroughWindow = 0; } } else if ( fThroughWindow == 2 ) { // We've overstayed our welcome - remove! fThroughWindow = 0; } if ( fGoneThroughDoor == 1 ) { fGoneThroughDoor = 2; } else if ( fGoneThroughDoor == 2 ) { // We've overstayed our welcome - remove! fGoneThroughDoor = 0; } //ATE CHECK FOR NOVIEW! if ( nextDir == NOVIEW ) { nextDir = 99; } marker = NewGridNo(marker,(INT16)Inc[markerDir]); if ( marker == 12426 ) { int i = 0; } // End if this is a no view... if ( markerDir == NOVIEW && markercnt != 0 ) { break; } #ifdef _DEBUG if ( _KeyDown( NUM_LOCK ) ) { int cnt = GetJA2Clock( ); gubFOVDebugInfoInfo[ marker ] = (UINT8)markercnt; StartFrameBufferRender(); RenderFOVDebug( ); SetFont( LARGEFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); mprintf( 10, 10 , L"%d", maincnt ); //mprintf( 10, 20 , L"%d", marker ); //mprintf( 50, 20 , L"%d", pSoldier->sGridNo ); InvalidateScreen( ); EndFrameBufferRender(); RefreshScreen( NULL ); do { } while( ( GetJA2Clock( ) - cnt ) < 250 ); } #endif // Check if we can get to this gridno from our direction in ubMovementCost = gubWorldMovementCosts[ marker ][ Dir[ markerDir ] ][ ubLevel ]; // ATE: Added: If our current sector is below ground, ignore any blocks! if ( gfCaves && ubMovementCost != TRAVELCOST_CAVEWALL ) { ubMovementCost = TRAVELCOST_FLAT; } if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) { ubMovementCost = DoorTravelCost( pSoldier, marker, ubMovementCost, (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), &iDoorGridNo ); pStructure = FindStructure( iDoorGridNo, STRUCTURE_ANYDOOR ); if ( pStructure != NULL && pStructure->fFlags & STRUCTURE_TRANSPARENT) { // cell door or somehow otherwise transparent; allow merc to see through ubMovementCost = TRAVELCOST_FLAT; } } // If we have hit an obstacle, STOP HERE if ( ubMovementCost >= TRAVELCOST_BLOCKED ) { // We have an obstacle here... // If it is bigger than a breadbox... err... taller than a man... // Then stop path altogether // otherwise just stop revealing items // CJC: only do this when the direction is horizontal; easier and faster to check // and the effect should still be good enough if ( ubMovementCost == TRAVELCOST_WALL || ubMovementCost == TRAVELCOST_DOOR || ubMovementCost == TRAVELCOST_EXITGRID ) { fTravelCostObs = TRUE; fRevealItems = FALSE; } else { // walls are handled above, so the blocking object is guaranteed not to be a wall bTallestStructureHeight = GetTallestStructureHeight( marker, FALSE ); if (bTallestStructureHeight >= 3) { fTravelCostObs = TRUE; fStopRevealingItemsAfterThisTile = TRUE; } else if ( bTallestStructureHeight != 0 ) { // stop revealing items after this tile but keep going fStopRevealingItemsAfterThisTile = TRUE; } } if ( (Dir[markerDir] % 2) == 1 ) { // diagonal fTravelCostObs = TRUE; // cheap hack... don't reveal items fRevealItems = FALSE; } else { bTallestStructureHeight = GetTallestStructureHeight( marker, FALSE ); if (bTallestStructureHeight >= 3) { fTravelCostObs = TRUE; fStopRevealingItemsAfterThisTile = TRUE; } else if ( bTallestStructureHeight != 0 ) { // stop revealing items after this tile but keep going fStopRevealingItemsAfterThisTile = TRUE; } } } // Check if it's been done already! if ( gubGridNoMarkers[ marker ] != gubGridNoValue ) { // Mark gridno gubGridNoMarkers[ marker ] = gubGridNoValue; // check and see if the gridno changed // if the gridno is the same, avoid redundancy and break if (marker==prevmarker && markercnt != 0 ) { } else // it changed { // Skip others if we have gone through a door but are too far away.... if ( fGoneThroughDoor ) { if (markercnt > 5 ) // Are we near the door? { break; } } // DO MINE FINDING STUFF // GET INDEX FOR ITEM HERE // if there IS a direction after this one, nextdir WILL NOT be 99 if (nextDir != 99) { Blocking = GetBlockingStructureInfo( marker, (INT8)Dir[ markerDir ], (INT8)Dir[ nextDir ], ubLevel, &bStructHeight, &pDummy, FALSE ); } else // no "next" direction, so pass in a NOWHERE so that // "SpecialViewObstruction" will know not to take it UINT32o consideration { Blocking = GetBlockingStructureInfo( marker, (INT8)Dir[markerDir], (INT8)30, ubLevel, &bStructHeight, &pDummy, FALSE ); } if ( gfCaves ) { Blocking = NOTHING_BLOCKING; } // CHECK FOR ROOMS if ( Blocking == BLOCKING_TOPLEFT_WINDOW || Blocking == BLOCKING_TOPLEFT_OPEN_WINDOW ) { // CHECK FACING DIRECTION! if ( Dir[markerDir] == NORTH || Dir[markerDir] == SOUTH ) { if (markercnt <= 1 ) // Are we right beside it? { fThroughWindow = TRUE; bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; } } } if ( Blocking == BLOCKING_TOPRIGHT_WINDOW || Blocking == BLOCKING_TOPRIGHT_OPEN_WINDOW ) { // CHECK FACING DIRECTION! if ( Dir[markerDir] == EAST || Dir[markerDir] == WEST ) { if (markercnt <= 1 ) // Are we right beside it? { fThroughWindow = TRUE; bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; } } } if ( Blocking == BLOCKING_TOPLEFT_DOOR ) { fGoneThroughDoor = TRUE; } if ( Blocking == BLOCKING_TOPRIGHT_DOOR ) { fGoneThroughDoor = TRUE; } // ATE: If we hit this tile, find item always! //if (Blocking < FULL_BLOCKING ) { // Handle special things for our mercs, like uncovering roofs // and revealing objects... //gpSoldier->shad |= SEENBIT; //itemVisible = ObjList[itemIndex].visible; // NOTE: don't allow object viewing if gassed XXX if (itemsToo && fRevealItems ) // && itemIndex < MAXOBJECTLIST) { // OK, look for corpses... LookForAndMayCommentOnSeeingCorpse( pSoldier, marker, ubLevel ); if ( GetItemPool( marker, &pItemPool, ubLevel ) ) { itemVisible = pItemPool->bVisible; if ( SetItemPoolVisibilityOn( pItemPool, INVISIBLE, fShowLocators ) ) { SetRenderFlags(RENDER_FLAG_FULL); // WANNE: Should we pause when item was found in tactical? bool enableItemSpottingAction = true; if ( !is_networked && gGameExternalOptions.fItemSpottedNoTalk && gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT) enableItemSpottingAction = false; if (enableItemSpottingAction) { if ( fShowLocators ) { // Set makred render flags //gpWorldLevelData[marker].uiFlags|=MAPELEMENT_REDRAW; //gpWorldLevelData[gusCurMousePos].pTopmostHead->uiFlags |= LEVELNODE_DYNAMIC; //SetRenderFlags(RENDER_FLAG_MARKED); SetRenderFlags(RENDER_FLAG_FULL); // Hault soldier // ATE: Only if in combat... if ( gTacticalStatus.uiFlags & INCOMBAT ) { pSoldier->HaultSoldierFromSighting( FALSE ); } else { // ATE: Make sure we show locators... gTacticalStatus.fLockItemLocators = FALSE; } if ( !fItemsQuoteSaid && gTacticalStatus.fLockItemLocators == FALSE ) { gTacticalStatus.fLockItemLocators = TRUE; if ( gTacticalStatus.ubAttackBusyCount > 0 && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { gTacticalStatus.fItemsSeenOnAttack = TRUE; gTacticalStatus.ubItemsSeenOnAttackSoldier = pSoldier->ubID; gTacticalStatus.usItemsSeenOnAttackGridNo = marker; } else { // Display quote! if ( !AM_AN_EPC( pSoldier ) ) { TacticalCharacterDialogueWithSpecialEvent( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ), DIALOGUE_SPECIAL_EVENT_SIGNAL_ITEM_LOCATOR_START, marker, 0 ); } else { // Turn off item lock for locators... gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! SlideToLocation( 0, marker ); } } fItemsQuoteSaid = TRUE; } } } } } } // if blood here, let the user see it now... //if (ExtGrid[marker].patrolInfo < MAXBLOOD) // gpSoldier->blood = ExtGrid[marker].patrolInfo; //DoRoofs(marker,gpSoldier); tilesLeftToSee--; } // CHECK FOR HIDDEN STRUCTS // IF we had a hidden struct here that is not visible ( which will still be true because // we set it revealed below... if ( DoesGridNoContainHiddenStruct( marker, &fHiddenStructVisible ) ) { if ( !fHiddenStructVisible ) { gpWorldLevelData[marker].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); RecompileLocalMovementCosts( marker ); } } if (tilesLeftToSee <= 0) break; if ( Blocking == FULL_BLOCKING || ( fTravelCostObs && !fThroughWindow ) ) { break; } //if ( Blocking == NOTHING_BLOCKING || Blocking == BLOCKING_NEXT_TILE ) if ( Blocking == NOTHING_BLOCKING ) { fCheckForRooms = TRUE; } if ( ubLevel != 0 ) { fCheckForRooms = FALSE; } // CHECK FOR SLANT ROOF! { STRUCTURE *pStructure, *pBase; pStructure = FindStructure( marker, STRUCTURE_SLANTED_ROOF ); if ( pStructure != NULL ) { pBase = FindBaseStructure( pStructure ); // ADD TO SLANTED ROOF LIST! AddSlantRoofFOVSlot( marker ); } } // Set gridno as revealed if ( ubLevel == FIRST_LEVEL ) { if ( gfBasement || gfCaves ) { // OK, if we are underground, we don't want to reveal stuff if // 1 ) there is a roof over us and // 2 ) we are not in a room if ( gusWorldRoomInfo[ marker ] == NO_ROOM && TypeRangeExistsInRoofLayer( marker, FIRSTROOF, FOURTHROOF, &usIndex ) ) { int i = 0; } else { gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED; if( gfCaves ) { RemoveFogFromGridNo( marker ); } } } else { gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED; } // CHECK FOR ROOMS //if ( fCheckForRooms ) { if ( InAHiddenRoom( marker, &usRoomNo ) ) { RemoveRoomRoof( marker, usRoomNo, pSoldier ); if ( usRoomNo == ROOM_SURROUNDING_BOXING_RING && gWorldSectorX == BOXING_SECTOR_X && gWorldSectorY == BOXING_SECTOR_Y && gbWorldSectorZ == BOXING_SECTOR_Z ) { // reveal boxing ring at same time RemoveRoomRoof( marker, BOXING_RING, pSoldier ); } } } } else { gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED_ROOF; } // Check for blood.... UpdateBloodGraphics( marker, ubLevel ); if ( Blocking != NOTHING_BLOCKING && Blocking != BLOCKING_TOPLEFT_DOOR && Blocking != BLOCKING_TOPRIGHT_DOOR && Blocking != BLOCKING_TOPLEFT_WINDOW && Blocking != BLOCKING_TOPRIGHT_WINDOW && Blocking != BLOCKING_TOPRIGHT_OPEN_WINDOW && Blocking != BLOCKING_TOPLEFT_OPEN_WINDOW) { break; } //gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_SHADELAND; } } // End of duplicate check else { if ( fTravelCostObs ) { break; } } } // end of one path } // end of path loop // Loop through all availible slant roofs we collected and perform cool stuff on them ExamineSlantRoofFOVSlots( ); //pSoldier->needToLookForItems = FALSE; //LookForDoors(pSoldier,UNAWARE); }
void DeleteAniTile( ANITILE *pAniTile ) { ANITILE *pAniNode = NULL; ANITILE *pOldAniNode = NULL; TILE_ELEMENT *TileElem; pAniNode = pAniTileHead; while( pAniNode!= NULL ) { if ( pAniNode == pAniTile ) { // OK, set links // Check for head or tail if ( pOldAniNode == NULL ) { // It's the head pAniTileHead = pAniTile->pNext; } else { pOldAniNode->pNext = pAniNode->pNext; } if ( !(pAniNode->uiFlags & ANITILE_EXISTINGTILE ) ) { // Delete memory assosiated with item switch( pAniNode->ubLevelID ) { case ANI_STRUCT_LEVEL: RemoveStructFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode ); break; case ANI_SHADOW_LEVEL: RemoveShadowFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode ); break; case ANI_OBJECT_LEVEL: RemoveObject( pAniNode->sGridNo, pAniNode->usTileIndex ); break; case ANI_ROOF_LEVEL: RemoveRoof( pAniNode->sGridNo, pAniNode->usTileIndex ); break; case ANI_ONROOF_LEVEL: RemoveOnRoof( pAniNode->sGridNo, pAniNode->usTileIndex ); break; case ANI_TOPMOST_LEVEL: RemoveTopmostFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode ); break; } if ( ( pAniNode->uiFlags & ANITILE_CACHEDTILE ) ) { RemoveCachedTile( pAniNode->sCachedTileID ); } if ( pAniNode->uiFlags & ANITILE_EXPLOSION ) { // Talk to the explosion data... RemoveExplosionData( pAniNode->uiUserData3 ); if ( !gfExplosionQueueActive ) { // turn on sighting again // the explosion queue handles all this at the end of the queue gTacticalStatus.uiFlags &= (~DISALLOW_SIGHT); } // Freeup attacker from explosion DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., EXPLOSION effect gone off") ); ReduceAttackBusyCount( (UINT8)pAniNode->ubUserData2, FALSE ); } if ( pAniNode->uiFlags & ANITILE_RELEASE_ATTACKER_WHEN_DONE ) { // First delete the bullet! RemoveBullet( pAniNode->uiUserData3 ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - miss finished animation") ); FreeUpAttacker( (UINT8) pAniNode->ubAttackerMissed ); } } else { TileElem = &( gTileDatabase[ pAniNode->usTileIndex ] ); // OK, update existing tile usIndex.... Assert( TileElem->pAnimData != NULL ); pAniNode->pLevelNode->usIndex = TileElem->pAnimData->pusFrames[ pAniNode->pLevelNode->sCurrentFrame ]; // OK, set our frame data back to zero.... pAniNode->pLevelNode->sCurrentFrame = 0; // Set some flags to write to Z / update save buffer // pAniNode->pLevelNode->uiFlags |=( LEVELNODE_LASTDYNAMIC | LEVELNODE_UPDATESAVEBUFFERONCE ); pAniNode->pLevelNode->uiFlags &= ~( LEVELNODE_DYNAMIC | LEVELNODE_USEZ | LEVELNODE_ANIMATION ); if (pAniNode->uiFlags & ANITILE_DOOR) { // unset door busy! DOOR_STATUS * pDoorStatus; pDoorStatus = GetDoorStatus( pAniNode->sGridNo ); if (pDoorStatus) { pDoorStatus->ubFlags &= ~(DOOR_BUSY); } if ( GridNoOnScreen( pAniNode->sGridNo ) ) { SetRenderFlags(RENDER_FLAG_FULL); } } } MemFree( pAniNode ); return; } pOldAniNode = pAniNode; pAniNode = pAniNode->pNext; } }
UINT32 MessageBoxScreenHandle( ) { InputAtom InputEvent; if ( gfNewMessageBox ) { // If in game screen.... if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) { //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; //UINT8 *pDestBuf, *pSrcBuf; if( gfStartedFromGameScreen ) { HandleTacticalUILoseCursorFromOtherScreen( ); } else { HandleMAPUILoseCursorFromOtherScreen( ); } gfStartedFromGameScreen = FALSE; gfStartedFromMapScreen = FALSE; /* // Save what we have under here... pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0 , 0, gMsgBox.sX , gMsgBox.sY, gMsgBox.usWidth, gMsgBox.usHeight ); UnLockVideoSurface( gMsgBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); */ } gfNewMessageBox = FALSE; return( MSG_BOX_SCREEN ); } UnmarkButtonsDirty( ); // Render the box! if ( gMsgBox.fRenderBox ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { MarkAButtonDirty( gMsgBox.uiButton[0] ); MarkAButtonDirty( gMsgBox.uiButton[1] ); MarkAButtonDirty( gMsgBox.uiButton[2] ); MarkAButtonDirty( gMsgBox.uiButton[3] ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_CANCEL ) { MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { // Exit messagebox MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) { MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } RenderMercPopUpBoxFromIndex( gMsgBox.iBoxId, gMsgBox.sX, gMsgBox.sY, FRAME_BUFFER ); //gMsgBox.fRenderBox = FALSE; // ATE: Render each frame... } // Render buttons RenderButtons( ); EndFrameBufferRender( ); // carter, need key shortcuts for clearing up message boxes // Check for esc while (DequeueEvent(&InputEvent) == TRUE) { if( InputEvent.usEvent == KEY_UP ) { if( ( InputEvent.usParam == ESC ) || ( InputEvent.usParam == 'n') ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_NO; } } if( InputEvent.usParam == ENTER ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_YES; } else if( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_OK; } else if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_OK; } } if( InputEvent.usParam == 'o' ) { if( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_OK; } } if( InputEvent.usParam == 'y' ) { if( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox gMsgBox.bHandled = MSG_BOX_RETURN_YES; } } if( InputEvent.usParam == '1' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } if( InputEvent.usParam == '2' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } if( InputEvent.usParam == '3' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } if( InputEvent.usParam == '4' ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { // Exit messagebox gMsgBox.bHandled = 1; } } } } if ( gMsgBox.bHandled ) { SetRenderFlags( RENDER_FLAG_FULL ); return( ExitMsgBox( gMsgBox.bHandled ) ); } return( MSG_BOX_SCREEN ); }
UINT32 ExitMsgBox( INT8 ubExitCode ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; UINT8 *pDestBuf, *pSrcBuf; SGPPoint pPosition; // Delete popup! RemoveMercPopupBoxFromIndex( gMsgBox.iBoxId ); gMsgBox.iBoxId = -1; //Delete buttons! if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) { RemoveButton( gMsgBox.uiButton[0] ); RemoveButton( gMsgBox.uiButton[1] ); RemoveButton( gMsgBox.uiButton[2] ); RemoveButton( gMsgBox.uiButton[3] ); } else { if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) { RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } } // Delete button images UnloadButtonImage( gMsgBox.iButtonImages ); // Unpause game.... UnLockPauseState(); UnPauseGame(); // UnPause timers as well.... PauseTime( FALSE ); // Restore mouse restriction region... RestrictMouseCursor( &gOldCursorLimitRectangle ); gfInMsgBox = FALSE; // Call done callback! if ( gMsgBox.ExitCallback != NULL ) { (*(gMsgBox.ExitCallback))( ubExitCode ); } //if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback if( ( ( gMsgBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer ) { // restore what we have under here... pSrcBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, gMsgBox.sX , gMsgBox.sY, 0, 0, gMsgBox.usWidth, gMsgBox.usHeight ); UnLockVideoSurface( gMsgBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); InvalidateRegion( gMsgBox.sX, gMsgBox.sY, (INT16)( gMsgBox.sX + gMsgBox.usWidth ), (INT16)( gMsgBox.sY + gMsgBox.usHeight ) ); } fRestoreBackgroundForMessageBox = FALSE; gfDontOverRideSaveBuffer = TRUE; if( fCursorLockedToArea == TRUE ) { GetMousePos( &pPosition ); if( ( pPosition.iX > MessageBoxRestrictedCursorRegion.iRight ) || ( pPosition.iX > MessageBoxRestrictedCursorRegion.iLeft ) && ( pPosition.iY < MessageBoxRestrictedCursorRegion.iTop ) && ( pPosition.iY > MessageBoxRestrictedCursorRegion.iBottom ) ) { SimulateMouseMovement( pOldMousePosition.iX , pOldMousePosition.iY ); } fCursorLockedToArea = FALSE; RestrictMouseCursor( &MessageBoxRestrictedCursorRegion ); } // Remove region MSYS_RemoveRegion(&(gMsgBox.BackRegion) ); // Remove save buffer! DeleteVideoSurfaceFromIndex( gMsgBox.uiSaveBuffer ); switch( gMsgBox.uiExitScreen ) { case GAME_SCREEN: if ( InOverheadMap( ) ) { gfOverheadMapDirty = TRUE; } else { SetRenderFlags( RENDER_FLAG_FULL ); } break; case MAP_SCREEN: fMapPanelDirty = TRUE; break; } if ( gfFadeInitialized ) { SetPendingNewScreen(FADE_SCREEN); return( FADE_SCREEN ); } return( gMsgBox.uiExitScreen ); }
void UpdateAniTiles( ) { ANITILE *pAniNode = NULL; ANITILE *pNode = NULL; UINT32 uiClock = GetJA2Clock( ); UINT16 usMaxFrames, usMinFrames; UINT8 ubTempDir; // LOOP THROUGH EACH NODE pAniNode = pAniTileHead; while( pAniNode != NULL ) { pNode = pAniNode; pAniNode = pAniNode->pNext; if ( (uiClock - pNode->uiTimeLastUpdate ) > (UINT32)pNode->sDelay && !( pNode->uiFlags & ANITILE_PAUSED ) ) { pNode->uiTimeLastUpdate = GetJA2Clock( ); if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSLOWMOVING ) ) { pNode->pLevelNode->uiFlags |= (LEVELNODE_DYNAMIC ); pNode->pLevelNode->uiFlags &= (~LEVELNODE_LASTDYNAMIC); } else if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSMOKEEFFECT ) ) { // pNode->pLevelNode->uiFlags |= LEVELNODE_DYNAMICZ; ResetSpecificLayerOptimizing( TILES_DYNAMIC_STRUCTURES ); pNode->pLevelNode->uiFlags &= (~LEVELNODE_LASTDYNAMIC); pNode->pLevelNode->uiFlags |= (LEVELNODE_DYNAMIC ); } if ( pNode->uiFlags & ANITILE_FORWARD ) { usMaxFrames = pNode->usNumFrames; if ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME ) { ubTempDir = gOneCDirection[ pNode->uiUserData3 ]; usMaxFrames = (UINT16)usMaxFrames + ( pNode->usNumFrames * ubTempDir ); } if ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME ) { ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ]; usMaxFrames = (UINT16)usMaxFrames + ( pNode->usNumFrames * ubTempDir ); } if ( ( pNode->sCurrentFrame + 1 ) < usMaxFrames ) { pNode->sCurrentFrame++; pNode->pLevelNode->sCurrentFrame = pNode->sCurrentFrame; if ( pNode->uiFlags & ANITILE_EXPLOSION ) { // Talk to the explosion data... UpdateExplosionFrame( pNode->uiUserData3, pNode->sCurrentFrame ); } // CHECK IF WE SHOULD BE DISPLAYING TRANSLUCENTLY! if ( pNode->sCurrentFrame == pNode->ubKeyFrame1 ) { switch( pNode->uiKeyFrame1Code ) { case ANI_KEYFRAME_BEGIN_TRANSLUCENCY: pNode->pLevelNode->uiFlags |= LEVELNODE_REVEAL; break; case ANI_KEYFRAME_CHAIN_WATER_EXPLOSION: IgniteExplosion( pNode->ubUserData2, pNode->pLevelNode->sRelativeX, pNode->pLevelNode->sRelativeY, 0, pNode->sGridNo, (UINT16)( pNode->uiUserData ), 0 ); break; case ANI_KEYFRAME_DO_SOUND: PlayJA2Sample( pNode->uiUserData, RATE_11025, SoundVolume( MIDVOLUME, (INT16)pNode->uiUserData3 ), 1, SoundDir( (INT16)pNode->uiUserData3 ) ); break; } } // CHECK IF WE SHOULD BE DISPLAYING TRANSLUCENTLY! if ( pNode->sCurrentFrame == pNode->ubKeyFrame2 ) { UINT8 ubExpType; switch( pNode->uiKeyFrame2Code ) { case ANI_KEYFRAME_BEGIN_DAMAGE: ubExpType = Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubType; if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || ubExpType == EXPLOSV_SMOKE ) { // Do sound.... // PlayJA2Sample( AIR_ESCAPING_1, RATE_11025, SoundVolume( HIGHVOLUME, pNode->sGridNo ), 1, SoundDir( pNode->sGridNo ) ); NewSmokeEffect( pNode->sGridNo, (UINT16)pNode->uiUserData, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, (UINT8)pNode->ubUserData2 ); } else { SpreadEffect( pNode->sGridNo, Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubRadius, (UINT16)pNode->uiUserData, (UINT8)pNode->ubUserData2, FALSE, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, -1 ); } // Forfait any other animations this frame.... return; } } } else { // We are done! if ( pNode->uiFlags & ANITILE_LOOPING ) { pNode->sCurrentFrame = pNode->sStartFrame; if ( ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME ) ) { // Our start frame is actually a direction indicator ubTempDir = gOneCDirection[ pNode->uiUserData3 ]; pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir ); } if ( ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME ) ) { // Our start frame is actually a direction indicator ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ]; pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir ); } } else if ( pNode->uiFlags & ANITILE_REVERSE_LOOPING ) { // Turn off backwards flag pNode->uiFlags &= (~ANITILE_FORWARD ); // Turn onn forwards flag pNode->uiFlags |= ANITILE_BACKWARD; } else { // Delete from world! DeleteAniTile( pNode ); // Turn back on redunency checks! gTacticalStatus.uiFlags &= (~NOHIDE_REDUNDENCY); return; } } } if ( pNode->uiFlags & ANITILE_BACKWARD ) { if ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) { // ATE: Check if bounding box is on the screen... if ( pNode->bFrameCountAfterStart == 0 ) { pNode->bFrameCountAfterStart = 1; pNode->pLevelNode->uiFlags |= (LEVELNODE_DYNAMIC ); // Dangerous here, since we may not even be on the screen... SetRenderFlags( RENDER_FLAG_FULL ); continue; } } usMinFrames = 0; if ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME ) { ubTempDir = gOneCDirection[ pNode->uiUserData3 ]; usMinFrames = ( pNode->usNumFrames * ubTempDir ); } if ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME ) { ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ]; usMinFrames = ( pNode->usNumFrames * ubTempDir ); } if ( ( pNode->sCurrentFrame - 1 ) >= usMinFrames ) { pNode->sCurrentFrame--; pNode->pLevelNode->sCurrentFrame = pNode->sCurrentFrame; if ( pNode->uiFlags & ANITILE_EXPLOSION ) { // Talk to the explosion data... UpdateExplosionFrame( pNode->uiUserData3, pNode->sCurrentFrame ); } } else { // We are done! if ( pNode->uiFlags & ANITILE_PAUSE_AFTER_LOOP ) { // Turn off backwards flag pNode->uiFlags &= (~ANITILE_BACKWARD ); // Pause pNode->uiFlags |= ANITILE_PAUSED; } else if ( pNode->uiFlags & ANITILE_LOOPING ) { pNode->sCurrentFrame = pNode->sStartFrame; if ( ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME ) ) { // Our start frame is actually a direction indicator ubTempDir = gOneCDirection[ pNode->uiUserData3 ]; pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir ); } if ( ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME ) ) { // Our start frame is actually a direction indicator ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ]; pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir ); } } else if ( pNode->uiFlags & ANITILE_REVERSE_LOOPING ) { // Turn off backwards flag pNode->uiFlags &= (~ANITILE_BACKWARD ); // Turn onn forwards flag pNode->uiFlags |= ANITILE_FORWARD; } else { // Delete from world! DeleteAniTile( pNode ); return; } if ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) { // ATE: Check if bounding box is on the screen... pNode->bFrameCountAfterStart = 0; //pNode->pLevelNode->uiFlags |= LEVELNODE_UPDATESAVEBUFFERONCE; // Dangerous here, since we may not even be on the screen... SetRenderFlags( RENDER_FLAG_FULL ); } } } } else { if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSLOWMOVING ) ) { // ONLY TURN OFF IF PAUSED... if ( ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) ) { if ( pNode->uiFlags & ANITILE_PAUSED ) { if ( pNode->pLevelNode->uiFlags & LEVELNODE_DYNAMIC ) { pNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC ); pNode->pLevelNode->uiFlags |= (LEVELNODE_LASTDYNAMIC); SetRenderFlags( RENDER_FLAG_FULL ); } } } else { pNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC ); pNode->pLevelNode->uiFlags |= (LEVELNODE_LASTDYNAMIC); } } else if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSMOKEEFFECT ) ) { pNode->pLevelNode->uiFlags |= (LEVELNODE_LASTDYNAMIC); pNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC ); } } } }
void MarkWorldDirty() { SetRenderFlags( RENDER_FLAG_FULL ); }
INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 bLevel ) { UINT8 ubPerson; INT16 sTempDestGridNo; INT16 sNewGridNo; BOOLEAN fSwapInDoor = FALSE; if ( sGridNo == NOWHERE ) { return( MOVE_TILE_CLEAR ); } ubPerson = WhoIsThere2( sGridNo, bLevel ); if ( ubPerson != NO_SOLDIER ) { // If this us? if ( ubPerson != pSoldier->ubID ) { // OK, set flag indicating we are blocked by a merc.... if ( pSoldier->bTeam != gbPlayerNum ) // CJC: shouldn't this be in all cases??? //if ( 0 ) { pSoldier->fBlockedByAnotherMerc = TRUE; // Set direction we were trying to goto pSoldier->bBlockedByAnotherMercDirection = bDirection; // Are we only temporarily blocked? // Check if our final destination is = our gridno if ( ( MercPtrs[ ubPerson ]->sFinalDestination == MercPtrs[ ubPerson ]->sGridNo ) ) { return( MOVE_TILE_STATIONARY_BLOCKED ); } else { // OK, if buddy who is blocking us is trying to move too... // And we are in opposite directions... if ( MercPtrs[ ubPerson ]->fBlockedByAnotherMerc && MercPtrs[ ubPerson ]->bBlockedByAnotherMercDirection == gOppositeDirection[ bDirection ] ) { // OK, try and get a path around buddy.... // We have to temporarily make buddy stopped... sTempDestGridNo = MercPtrs[ ubPerson ]->sFinalDestination; MercPtrs[ ubPerson ]->sFinalDestination = MercPtrs[ ubPerson ]->sGridNo; if ( PlotPath( pSoldier, pSoldier->sFinalDestination, NO_COPYROUTE, NO_PLOT, TEMPORARY, pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) { pSoldier->bPathStored = FALSE; // OK, make guy go here... EVENT_GetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode ); // Restore final dest.... MercPtrs[ ubPerson ]->sFinalDestination = sTempDestGridNo; pSoldier->fBlockedByAnotherMerc = FALSE; // Is the next tile blocked too? sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); return( TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->bLevel ) ); } else { // Not for multi-tiled things... if ( !( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) ) { // Is the next movement cost for a door? if ( DoorTravelCost( pSoldier, sGridNo, gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->bLevel ], (BOOLEAN)( pSoldier->bTeam == gbPlayerNum ), NULL ) == TRAVELCOST_DOOR ) { fSwapInDoor = TRUE; } // If we are to swap and we're near a door, open door first and then close it...? // Swap now! MercPtrs[ ubPerson ]->fBlockedByAnotherMerc = FALSE; // Restore final dest.... MercPtrs[ ubPerson ]->sFinalDestination = sTempDestGridNo; // Swap merc positions..... SwapMercPositions( pSoldier, MercPtrs[ ubPerson ] ); // With these two guys swapped, they should try and continue on their way.... // Start them both again along their way... EVENT_GetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode ); EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ], MercPtrs[ ubPerson ]->sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); } } } return( MOVE_TILE_TEMP_BLOCKED ); } } else { //return( MOVE_TILE_STATIONARY_BLOCKED ); // ATE: OK, put some smartshere... // If we are waiting for more than a few times, change to stationary... if ( MercPtrs[ ubPerson ]->fDelayedMovement >= 105 ) { // Set to special 'I want to walk through people' value pSoldier->fDelayedMovement = 150; return( MOVE_TILE_STATIONARY_BLOCKED ); } if ( MercPtrs[ ubPerson ]->sGridNo == MercPtrs[ ubPerson ]->sFinalDestination ) { return( MOVE_TILE_STATIONARY_BLOCKED ); } return( MOVE_TILE_TEMP_BLOCKED ); } } } if ( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) ) { if ( gpWorldLevelData[ sGridNo ].ubReservedSoldierID != pSoldier->ubID ) { return( MOVE_TILE_TEMP_BLOCKED ); } } // Are we clear of structs? if ( !NewOKDestination( pSoldier, sGridNo, FALSE, pSoldier->bLevel ) ) { // ATE: Fence cost is an exclusiuon here.... if ( gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->bLevel ] != TRAVELCOST_FENCE ) { // ATE: HIdden structs - we do something here... reveal it! if ( gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->bLevel ] == TRAVELCOST_HIDDENOBSTACLE ) { gpWorldLevelData[ sGridNo ].uiFlags|=MAPELEMENT_REVEALED; gpWorldLevelData[ sGridNo ].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); RecompileLocalMovementCosts( (UINT16)sGridNo ); } // Unset flag for blocked by soldier... pSoldier->fBlockedByAnotherMerc = FALSE; return( MOVE_TILE_STATIONARY_BLOCKED ); } else { #if 0 // Check if there is a reserved marker here at least.... sNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirection ) ); if ( ( gpWorldLevelData[ sNewGridNo ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) ) { if ( gpWorldLevelData[ sNewGridNo ].ubReservedSoldierID != pSoldier->ubID ) { return( MOVE_TILE_TEMP_BLOCKED ); } } #endif } } // Unset flag for blocked by soldier... pSoldier->fBlockedByAnotherMerc = FALSE; return( MOVE_TILE_CLEAR ); }
void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo ) { LEVELNODE *pNode = NULL; STRUCTURE *pStructure, *pBase; UINT8 ubLoop; DB_STRUCTURE_TILE ** ppTile; INT32 sGridNo; UINT16 usIndex; BOOLEAN fChanged = FALSE; // CHECK FOR A SLANTED ROOF HERE.... pStructure = FindStructure( sCheckGridNo, STRUCTURE_SLANTED_ROOF ); if ( pStructure != NULL ) { // We have a slanted roof here ... find base and remove... pBase = FindBaseStructure( pStructure ); // Get LEVELNODE for struct and remove! pNode = FindLevelNodeBasedOnStructure( pBase->sGridNo, pBase ); // Loop through each gridno and see if revealed.... for ( ubLoop = 0; ubLoop < pBase->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++ ) { ppTile = pBase->pDBStructureRef->ppTile; #if 0//dnl ch83 080114 sGridNo = pBase->sGridNo + ppTile[ ubLoop ]->sPosRelToBase; #else sGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); #endif if (sGridNo < 0 || sGridNo > WORLD_MAX) { continue; } // Given gridno, // IF NOT REVEALED AND HIDDEN.... if ( !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) && pNode->uiFlags & LEVELNODE_HIDDEN ) { // Add graphic if one does not already exist.... if ( !TypeExistsInRoofLayer( sGridNo, SLANTROOFCEILING, &usIndex ) ) { // Add AddRoofToHead( sGridNo, SLANTROOFCEILING1 ); fChanged = TRUE; } } // Revealed? if ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) { ///Remove any slant roof items if they exist if ( TypeExistsInRoofLayer( sGridNo, SLANTROOFCEILING, &usIndex ) ) { RemoveRoof( sGridNo, usIndex ); fChanged = TRUE; } } } } if ( fChanged ) { // DIRTY THE WORLD! InvalidateWorldRedundency(); SetRenderFlags(RENDER_FLAG_FULL ); } }
//DBrot: More Rooms void RemoveRoomRoof( INT32 sGridNo, UINT16 usRoomNum, SOLDIERTYPE *pSoldier ) { INT32 cnt; ITEM_POOL *pItemPool; INT16 sX, sY; BOOLEAN fSaidItemSeenQuote = FALSE; // STRUCTURE *pStructure;//, *pBase; // LOOP THORUGH WORLD AND CHECK ROOM INFO for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) { if ( gusWorldRoomInfo[ cnt ] == usRoomNum ) { SetGridNoRevealedFlag( cnt );//dnl ch56 141009 RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL ); // Reveal any items if here! if ( GetItemPoolFromGround( cnt, &pItemPool ) ) { // Set visible! ( only if invisible... ) if ( SetItemPoolVisibilityOn( pItemPool, INVISIBLE, TRUE ) ) { if ( !fSaidItemSeenQuote ) { fSaidItemSeenQuote = TRUE; if ( pSoldier != NULL ) { //ddd //TacticalCharacterDialogue( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ) ); if(Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase) ) TacticalCharacterDialogue( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ) ); //ddd } } } } // OK, re-set writeframes ( in a radius ) // Get XY ConvertGridNoToXY( cnt, &sX, &sY ); SetRecalculateWireFrameFlagRadius( sX, sY, 2 ); } } //for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) //{ // if ( gubWorldRoomInfo[ cnt ] == bRoomNum ) // { // ExamineGridNoForSlantRoofExtraGraphic( (INT16)cnt ); // } //} // DIRTY THE WORLD! InvalidateWorldRedundency(); SetRenderFlags(RENDER_FLAG_FULL ); CalculateWorldWireFrameTiles( FALSE ); }
void MarkMapIndexDirty( INT32 iMapIndex ) { gpWorldLevelData[ iMapIndex ].uiFlags |= MAPELEMENT_REDRAW; SetRenderFlags( RENDER_FLAG_MARKED ); }
// Add smoke to gridno // ( Replacement algorithm uses distance away ) void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 bLevel ) { ANITILE_PARAMS AniParams; ANITILE *pAniTile; SMOKEEFFECT *pSmoke; BOOLEAN fDissipating = FALSE; pSmoke = &gSmokeEffectData[ iSmokeEffectID ]; if ( ( pSmoke->ubDuration - pSmoke->bAge ) < 2 ) { fDissipating = TRUE; // Remove old one... RemoveSmokeEffectFromTile( sGridNo, bLevel ); } // If smoke effect exists already.... stop if ( gpWorldLevelData[ sGridNo ].ubExtFlags[ bLevel ] & ANY_SMOKE_EFFECT ) { return; } // OK, Create anitile.... memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = sGridNo; if ( bLevel == 0 ) { AniParams.ubLevelID = ANI_STRUCT_LEVEL; } else { AniParams.ubLevelID = ANI_ONROOF_LEVEL; } AniParams.sDelay = (INT16)( 300 + Random( 300 ) ); if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) { AniParams.sStartFrame = (INT16)0; } else { AniParams.sStartFrame = (INT16)Random( 5 ); } // Bare bones flags are... // AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_OPTIMIZEFORSMOKEEFFECT | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING; //AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING; if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) { AniParams.uiFlags = ANITILE_PAUSED | ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING; } else { AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING | ANITILE_ALWAYS_TRANSLUCENT; } AniParams.sX = CenterX( sGridNo ); AniParams.sY = CenterY( sGridNo ); AniParams.sZ = (INT16)0; // Use the right graphic based on type.. switch( bType ) { case NORMAL_SMOKE_EFFECT: if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\smkechze.STI" ); } else { if ( fDissipating ) { strcpy( AniParams.zCachedFile, "TILECACHE\\smalsmke.STI" ); } else { strcpy( AniParams.zCachedFile, "TILECACHE\\SMOKE.STI" ); } } break; case TEARGAS_SMOKE_EFFECT: if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\tearchze.STI" ); } else { if ( fDissipating ) { strcpy( AniParams.zCachedFile, "TILECACHE\\smaltear.STI" ); } else { strcpy( AniParams.zCachedFile, "TILECACHE\\TEARGAS.STI" ); } } break; case MUSTARDGAS_SMOKE_EFFECT: if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\mustchze.STI" ); } else { if ( fDissipating ) { strcpy( AniParams.zCachedFile, "TILECACHE\\smalmust.STI" ); } else { strcpy( AniParams.zCachedFile, "TILECACHE\\MUSTARD2.STI" ); } } break; case CREATURE_SMOKE_EFFECT: if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); } else { if ( fDissipating ) { strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); } else { strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); } } break; } // Create tile... pAniTile = CreateAnimationTile( &AniParams ); // Set world flags gpWorldLevelData[ sGridNo ].ubExtFlags[ bLevel ] |= FromSmokeTypeToWorldFlags( bType ); // All done... // Re-draw..... :( SetRenderFlags(RENDER_FLAG_FULL); }