Mercurial > mm7
comparison mm7_5.cpp @ 1477:7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Added support for most of mm6 resources, placeholders for mm8 resources.
Fixed few C4258
author | Nomad |
---|---|
date | Wed, 28 Aug 2013 18:43:07 +0200 |
parents | 5a29caf9b79d |
children | 9e9a12506d51 |
comparison
equal
deleted
inserted
replaced
1475:d7720c1f1d3b | 1477:7ef4b64f6329 |
---|---|
1665 if ( pMessageQueue_50CBD0->uNumMessages ) | 1665 if ( pMessageQueue_50CBD0->uNumMessages ) |
1666 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 1666 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
1667 dword_50CDC8 = 1; | 1667 dword_50CDC8 = 1; |
1668 sub_42FBDD(); | 1668 sub_42FBDD(); |
1669 //pNPCData4 = (NPCData *)GetTravelTime(); | 1669 //pNPCData4 = (NPCData *)GetTravelTime(); |
1670 strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); | 1670 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); |
1671 if ( bUnderwater != 1 && pParty->bFlying | 1671 if ( bUnderwater != 1 && pParty->bFlying |
1672 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) | 1672 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) |
1673 { | 1673 { |
1674 viewparams->bRedrawGameUI = 1; | 1674 viewparams->bRedrawGameUI = 1; |
1675 CloseWindowBackground(); | 1675 CloseWindowBackground(); |
1723 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); | 1723 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); |
1724 ++pParty->days_played_without_rest; | 1724 ++pParty->days_played_without_rest; |
1725 } | 1725 } |
1726 pPaletteManager->ResetNonLocked(); | 1726 pPaletteManager->ResetNonLocked(); |
1727 pSpriteFrameTable->ResetSomeSpriteFlags(); | 1727 pSpriteFrameTable->ResetSomeSpriteFlags(); |
1728 strcpy(pCurrentMapName.data(), pOut); | 1728 strcpy(pCurrentMapName, pOut); |
1729 strcpy(pLevelName, pCurrentMapName.data()); | 1729 strcpy(pLevelName, pCurrentMapName); |
1730 v41 = strtok(pLevelName, "."); | 1730 v41 = strtok(pLevelName, "."); |
1731 strcpy(pLevelName, v41); | 1731 strcpy(pLevelName, v41); |
1732 Level_LoadEvtAndStr(pLevelName); | 1732 Level_LoadEvtAndStr(pLevelName); |
1733 pDecalBuilder->Reset(0); | 1733 pDecalBuilder->Reset(0); |
1734 LoadLevel_InitializeLevelEvt(); | 1734 LoadLevel_InitializeLevelEvt(); |
1735 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName.data()); | 1735 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); |
1736 bUnderwater = 0; | 1736 bUnderwater = 0; |
1737 bNoNPCHiring = 0; | 1737 bNoNPCHiring = 0; |
1738 pGame->uFlags2 &= 0xFFFFFFF7u; | 1738 pGame->uFlags2 &= 0xFFFFFFF7u; |
1739 if ( Is_out15odm_underwater() ) | 1739 if ( Is_out15odm_underwater() ) |
1740 { | 1740 { |
1741 bUnderwater = 1; | 1741 bUnderwater = 1; |
1742 pGame->uFlags2 |= 8u; | 1742 pGame->uFlags2 |= 8u; |
1743 } | 1743 } |
1744 if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d47.blv") ) | 1744 if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") ) |
1745 bNoNPCHiring = 1; | 1745 bNoNPCHiring = 1; |
1746 PrepareToLoadODM(1u, (OutdoorCamera *)1); | 1746 PrepareToLoadODM(1u, (OutdoorCamera *)1); |
1747 pAudioPlayer->SetMapEAX(); | 1747 pAudioPlayer->SetMapEAX(); |
1748 bDialogueUI_InitializeActor_NPC_ID = 0; | 1748 bDialogueUI_InitializeActor_NPC_ID = 0; |
1749 OnMapLoad(); | 1749 OnMapLoad(); |
1909 case UIMSG_BF: | 1909 case UIMSG_BF: |
1910 __debugbreak(); | 1910 __debugbreak(); |
1911 dword_50CDC8 = 1; | 1911 dword_50CDC8 = 1; |
1912 sub_42FBDD(); | 1912 sub_42FBDD(); |
1913 SaveGame(1, 0); | 1913 SaveGame(1, 0); |
1914 strcpy(pCurrentMapName.data(), pMapStats->pInfos[uHouse_ExitPic].pFilename); | 1914 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); |
1915 dword_6BE364_game_settings_1 |= 1; | 1915 dword_6BE364_game_settings_1 |= 1; |
1916 uGameState = GAME_STATE_2; | 1916 uGameState = GAME_STATE_2; |
1917 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; | 1917 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
1918 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; | 1918 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; |
1919 if ( v53 < 0 ) | 1919 if ( v53 < 0 ) |
1969 v173 = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; | 1969 v173 = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; |
1970 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" | 1970 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" |
1971 GameUI_SetFooterString(pTmpBuf.data()); | 1971 GameUI_SetFooterString(pTmpBuf.data()); |
1972 continue; | 1972 continue; |
1973 } | 1973 } |
1974 pMapNum = pMapStats->GetMapInfo(pCurrentMapName.data()); | 1974 pMapNum = pMapStats->GetMapInfo(pCurrentMapName); |
1975 pMapName = "Not in Map Stats"; | 1975 pMapName = "Not in Map Stats"; |
1976 if ( pMapNum ) | 1976 if ( pMapNum ) |
1977 pMapName = pMapStats->pInfos[pMapNum].pName; | 1977 pMapName = pMapStats->pInfos[pMapNum].pName; |
1978 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum ) | 1978 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum ) |
1979 { | 1979 { |
2013 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | 2013 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); |
2014 } | 2014 } |
2015 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | 2015 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); |
2016 if ( bRecallingBeacon ) | 2016 if ( bRecallingBeacon ) |
2017 { | 2017 { |
2018 if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) | 2018 if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) |
2019 { | 2019 { |
2020 SaveGame(1, 0); | 2020 SaveGame(1, 0); |
2021 OnMapLeave(); | 2021 OnMapLeave(); |
2022 strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); | 2022 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); |
2023 dword_6BE364_game_settings_1 |= 1; | 2023 dword_6BE364_game_settings_1 |= 1; |
2024 uGameState = GAME_STATE_2; | 2024 uGameState = GAME_STATE_2; |
2025 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; | 2025 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; |
2026 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | 2026 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; |
2027 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | 2027 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; |
2057 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); | 2057 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); |
2058 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) | 2058 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) |
2059 continue; | 2059 continue; |
2060 for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) | 2060 for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) |
2061 { | 2061 { |
2062 if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName.data()) ) | 2062 if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) ) |
2063 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; | 2063 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; |
2064 } | 2064 } |
2065 } | 2065 } |
2066 continue; | 2066 continue; |
2067 case UIMSG_ClickTownInTP: | 2067 case UIMSG_ClickTownInTP: |
2084 default: | 2084 default: |
2085 if ( uMessageParam != 5 ) | 2085 if ( uMessageParam != 5 ) |
2086 { | 2086 { |
2087 LABEL_486: | 2087 LABEL_486: |
2088 SaveGame(1, 0); | 2088 SaveGame(1, 0); |
2089 v64 = pMapStats->GetMapInfo(pCurrentMapName.data()); | 2089 v64 = pMapStats->GetMapInfo(pCurrentMapName); |
2090 v65 = uMessageParam; | 2090 v65 = uMessageParam; |
2091 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) | 2091 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) |
2092 { | 2092 { |
2093 pParty->vPosition.x = TownPortalList[v65].pos.x; | 2093 pParty->vPosition.x = TownPortalList[v65].pos.x; |
2094 pParty->vPosition.y = TownPortalList[v65].pos.y; | 2094 pParty->vPosition.y = TownPortalList[v65].pos.y; |
2101 { | 2101 { |
2102 SaveGame(1, 0); | 2102 SaveGame(1, 0); |
2103 OnMapLeave(); | 2103 OnMapLeave(); |
2104 dword_6BE364_game_settings_1 |= 1; | 2104 dword_6BE364_game_settings_1 |= 1; |
2105 uGameState = GAME_STATE_2; | 2105 uGameState = GAME_STATE_2; |
2106 strcpy(pCurrentMapName.data(), pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); | 2106 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
2107 dword_5B65C0 = 1; | 2107 dword_5B65C0 = 1; |
2108 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; | 2108 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; |
2109 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | 2109 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; |
2110 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | 2110 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; |
2111 v66 = TownPortalList[uMessageParam].rot_x; | 2111 v66 = TownPortalList[uMessageParam].rot_x; |
2281 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | 2281 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); |
2282 } | 2282 } |
2283 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | 2283 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); |
2284 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | 2284 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) |
2285 { | 2285 { |
2286 strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); | 2286 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); |
2287 dword_6BE364_game_settings_1 |= 1u; | 2287 dword_6BE364_game_settings_1 |= 1u; |
2288 uGameState = GAME_STATE_2; | 2288 uGameState = GAME_STATE_2; |
2289 OnMapLeave(); | 2289 OnMapLeave(); |
2290 continue; | 2290 continue; |
2291 } | 2291 } |
2536 { | 2536 { |
2537 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | 2537 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; |
2538 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | 2538 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; |
2539 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | 2539 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; |
2540 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | 2540 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; |
2541 v90 = pMapStats->GetMapInfo(pCurrentMapName.data()); | 2541 v90 = pMapStats->GetMapInfo(pCurrentMapName); |
2542 if ( !v90 ) | 2542 if ( !v90 ) |
2543 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | 2543 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; |
2544 pMapInfo = &pMapStats->pInfos[v90]; | 2544 pMapInfo = &pMapStats->pInfos[v90]; |
2545 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) | 2545 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) |
2546 { | 2546 { |