Mercurial > mm7
comparison mm7_4.cpp @ 487:d5da524ec901
shop entering fixed
author | Gloval |
---|---|
date | Wed, 27 Feb 2013 22:48:10 +0400 |
parents | 4bd56919f075 |
children | c92dd0242fb6 0e27362ac1d9 |
comparison
equal
deleted
inserted
replaced
486:7887a9cf9e7b | 487:d5da524ec901 |
---|---|
8916 pParty->uFine = 0; | 8916 pParty->uFine = 0; |
8917 } | 8917 } |
8918 if ( v5 > 4000000 ) | 8918 if ( v5 > 4000000 ) |
8919 pParty->uFine = 4000000; | 8919 pParty->uFine = 4000000; |
8920 } | 8920 } |
8921 v6 = pParty->uTimePlayed + 368640; | 8921 |
8922 pParty->field_3C._shop_ban_times[2 * a1] = LODWORD(pParty->uTimePlayed) + 368640; | 8922 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; |
8923 pParty->field_3C._shop_ban_times[2 * a1 + 1] = HIDWORD(v6); | 8923 |
8924 LABEL_13: | 8924 LABEL_13: |
8925 pParty->InTheShopFlags[a1] = 1; | 8925 pParty->InTheShopFlags[a1] = 1; |
8926 if ( v3 ) | 8926 if ( v3 ) |
8927 { | 8927 { |
8928 v7 = &pOutdoor->ddm; | 8928 v7 = &pOutdoor->ddm; |
9260 | 9260 |
9261 //----- (004B1E92) -------------------------------------------------------- | 9261 //----- (004B1E92) -------------------------------------------------------- |
9262 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) | 9262 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) |
9263 { | 9263 { |
9264 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) | 9264 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) |
9265 if ( BYTE1(pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uBuildingType) ) | 9265 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_d ) |
9266 pAudioPlayer->PlaySound( | 9266 pAudioPlayer->PlaySound( |
9267 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), | 9267 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), |
9268 (SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uBuildingType) + 300)), | 9268 (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_d) + 300), |
9269 806, | 9269 806, |
9270 0, | 9270 0, |
9271 -1, | 9271 -1, |
9272 0, | 9272 0, |
9273 0, | 9273 0, |
14195 LABEL_19: | 14195 LABEL_19: |
14196 strcpy(sHouseName, v21); | 14196 strcpy(sHouseName, v21); |
14197 LABEL_20: | 14197 LABEL_20: |
14198 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName); | 14198 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName); |
14199 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) | 14199 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
14200 if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uBuildingType) ) | 14200 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_d ) |
14201 HousePlaySomeSound(v9, 1); | 14201 HousePlaySomeSound(v9, 1); |
14202 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) | 14202 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
14203 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); | 14203 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
14204 result = v23; | 14204 result = v23; |
14205 if ( v23 ) | 14205 if ( v23 ) |
14330 | 14330 |
14331 | 14331 |
14332 | 14332 |
14333 //----- (0044622E) -------------------------------------------------------- | 14333 //----- (0044622E) -------------------------------------------------------- |
14334 bool EnterHouse(enum HOUSE_ID uHouseID) | 14334 bool EnterHouse(enum HOUSE_ID uHouseID) |
14335 { | 14335 { |
14336 //enum HOUSE_ID v1; // edi@1 | 14336 //enum HOUSE_ID v1; // edi@1 |
14337 //int v2; // edi@5 | 14337 //int v2; // edi@5 |
14338 signed int uOpenTime; // eax@5 | 14338 signed int uOpenTime; // eax@5 |
14339 signed int uCloseTime; // esi@5 | 14339 signed int uCloseTime; // esi@5 |
14340 unsigned int v5; // esi@5 | 14340 unsigned int v5; // esi@5 |
14341 int v6; // edx@5 | 14341 int v6; // edx@5 |
14342 signed int am_pm_flag_open; // ecx@10 | 14342 signed int am_pm_flag_open; // ecx@10 |
14343 signed int am_pm_flag_close; // eax@10 | 14343 signed int am_pm_flag_close; // eax@10 |
14344 int v9; // esi@10 | 14344 int v9; // esi@10 |
14345 //unsigned int v10; // esi@16 | 14345 //unsigned int v10; // esi@16 |
14346 int v11; // ecx@17 | 14346 int v11; // ecx@17 |
14347 unsigned int v12; // kr00_4@25 | 14347 unsigned int v12; // kr00_4@25 |
14348 //Player *v13; // esi@25 | 14348 //Player *v13; // esi@25 |
14349 int v14; // eax@25 | 14349 int v14; // eax@25 |
14350 //Player *v15; // esi@27 | 14350 //Player *v15; // esi@27 |
14351 //signed int v16; // eax@32 | 14351 //signed int v16; // eax@32 |
14352 unsigned int v17; // eax@37 | 14352 unsigned int v17; // eax@37 |
14353 signed int v18; // edi@37 | 14353 signed int v18; // edi@37 |
14354 signed int v19; // edi@41 | 14354 signed int v19; // edi@41 |
14355 //unsigned int v20; // ecx@41 | 14355 //unsigned int v20; // ecx@41 |
14356 //const char *v22; // [sp-4h] [bp-40h]@33 | 14356 //const char *v22; // [sp-4h] [bp-40h]@33 |
14357 char pContainer[40]; // [sp+Ch] [bp-30h]@32 | 14357 char pContainer[40]; // [sp+Ch] [bp-30h]@32 |
14358 unsigned int v24; // [sp+34h] [bp-8h]@5 | 14358 unsigned int v24; // [sp+34h] [bp-8h]@5 |
14359 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1 | 14359 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1 |
14360 | 14360 |
14361 //v1 = uHouseID; | 14361 //v1 = uHouseID; |
14362 //v25 = uHouseID; | 14362 //v25 = uHouseID; |
14363 GameUI_StatusBar_TimedString[0] = 0; | 14363 GameUI_StatusBar_TimedString[0] = 0; |
14364 pStatusBarString[0] = 0; | 14364 pStatusBarString[0] = 0; |
14365 ShowStatusBarString("", 2u); | 14365 ShowStatusBarString("", 2u); |
14366 if ( pMessageQueue_50CBD0->uNumMessages ) | 14366 if ( pMessageQueue_50CBD0->uNumMessages ) |
14367 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 14367 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
14368 viewparams->bRedrawGameUI = 1; | 14368 viewparams->bRedrawGameUI = 1; |
14369 uDialogueType = 0; | 14369 uDialogueType = 0; |
14370 pKeyActionMap->_459ED1(3); | 14370 pKeyActionMap->_459ED1(3); |
14371 pKeyActionMap->ResetKeys(); | 14371 pKeyActionMap->ResetKeys(); |
14372 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) | 14372 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) |
14373 { | 14373 { |
14374 GameOverMenu(0); | 14374 GameOverMenu(0); |
14375 return 0; | 14375 return 0; |
14376 } | 14376 } |
14377 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; | 14377 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; |
14378 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; | 14378 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; |
14379 ptr_F8B1E8 = 0; | 14379 ptr_F8B1E8 = 0; |
14380 dword_F8B1E4 = 0; | 14380 dword_F8B1E4 = 0; |
14381 dword_F8B1F4 = 0; | 14381 dword_F8B1F4 = 0; |
14382 memset(byte_F8B1F0, 0, 4); | 14382 memset(byte_F8B1F0, 0, 4); |
14383 memset(byte_F8B148, 0, 16); | 14383 memset(byte_F8B148, 0, 16); |
14384 pRenderer->ClearZBuffer(0, 479); | 14384 pRenderer->ClearZBuffer(0, 479); |
14385 if ( uCloseTime - 1 <= uOpenTime ) | 14385 |
14386 { | 14386 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour >=uOpenTime)||(pParty->uCurrentHour <=(uCloseTime - 1))))|| |
14387 if ( pParty->uCurrentHour >= uOpenTime ) | 14387 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) |
14388 { | 14388 |
14389 //v10 = uHouseID; | 14389 { |
14390 if ( (signed int)uHouseID < 53 ) | 14390 am_pm_flag_open = 0; |
14391 { | 14391 am_pm_flag_close = 0; |
14392 if ( !(pParty->field_3C._shop_ban_times[uHouseID]) | 14392 if (uOpenTime > 12 ) |
14393 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) | 14393 { |
14394 { | 14394 uOpenTime -= 12; |
14395 pParty->field_3C._shop_ban_times[uHouseID] = 0; | 14395 am_pm_flag_open = 1; |
14396 | 14396 } |
14397 } | 14397 if ( uCloseTime > 12 ) |
14398 else | 14398 { |
14399 { | 14399 uCloseTime -= 12; |
14400 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" | 14400 am_pm_flag_close = 1; |
14401 return 0; | 14401 } |
14402 } | 14402 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], |
14403 } | 14403 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" |
14404 if ( !start_event_seq_number ) | 14404 ShowStatusBarString(pTmpBuf, 2u); |
14405 pAudioPlayer->StopChannels(-1, -1); | 14405 if ( uActiveCharacter ) |
14406 | 14406 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); |
14407 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; | 14407 return 0; |
14408 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; | 14408 } |
14409 if ( in_current_building_type == BildingType_20 && pParty->uFine ) // going 2 jail | 14409 else |
14410 { | 14410 { |
14411 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; | 14411 //v10 = uHouseID; |
14412 uHouseID = HOUSE_JAIL; | 14412 if ( (signed int)uHouseID < 53 ) //entering shops and guilds |
14413 pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000; | 14413 { |
14414 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType; | 14414 if ( !(pParty->field_3C._shop_ban_times[uHouseID]) |
14415 ++pParty->uNumPrisonTerms; | 14415 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) |
14416 pParty->uFine = 0; | 14416 { |
14417 for (uint i = 0; i < 4; ++i) | 14417 pParty->field_3C._shop_ban_times[uHouseID] = 0; |
14418 { | 14418 } |
14419 pParty->pPlayers[i].uTimeToRecovery = 0; | 14419 else |
14420 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | 14420 { |
14421 pParty->pPlayers[i].SetVariable(VAR_Award, 87); | 14421 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" |
14422 } | 14422 return 0; |
14423 } | 14423 } |
14424 ++pIcons_LOD->uTexturePacksCount; | 14424 } |
14425 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | 14425 if ( !start_event_seq_number ) |
14426 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | 14426 pAudioPlayer->StopChannels(-1, -1); |
14427 | 14427 |
14428 switch (pParty->alignment) | 14428 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; |
14429 { | 14429 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; |
14430 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | 14430 if ( in_current_building_type == BildingType_20 && pParty->uFine ) // going 2 jail |
14431 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | 14431 { |
14432 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | 14432 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; |
14433 default: assert(false); | 14433 uHouseID = HOUSE_JAIL; |
14434 } | 14434 pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000; |
14435 | 14435 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType; |
14436 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | 14436 ++pParty->uNumPrisonTerms; |
14437 pDialogueNPCCount = 0; | 14437 pParty->uFine = 0; |
14438 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; | 14438 for (uint i = 0; i < 4; ++i) |
14439 uTextureID_507B04 = uTextureID_right_panel; | 14439 { |
14440 PrepareHouse(uHouseID); | 14440 pParty->pPlayers[i].uTimeToRecovery = 0; |
14441 v18 = 1; | 14441 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; |
14442 uTextureID_507B04 = uTextureID_right_panel; | 14442 pParty->pPlayers[i].SetVariable(VAR_Award, 87); |
14443 if ( uNumDialogueNPCPortraits == 1 ) | 14443 } |
14444 pDialogueNPCCount = 1; | 14444 } |
14445 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | 14445 ++pIcons_LOD->uTexturePacksCount; |
14446 dword_5C35D4 = 1; | 14446 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
14447 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) | 14447 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
14448 { | 14448 switch (pParty->alignment) |
14449 if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) | 14449 { |
14450 { | 14450 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; |
14451 return 1; | 14451 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; |
14452 } | 14452 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; |
14453 } | 14453 default: assert(false); |
14454 else | 14454 } |
14455 { //guilds | 14455 |
14456 v19 = word_4F0704[uHouseID-139] - 1; //some gild flag check | 14456 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
14457 //v20 = uHouseID; | 14457 pDialogueNPCCount = 0; |
14458 if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) | 14458 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; |
14459 { | 14459 uTextureID_507B04 = uTextureID_right_panel; |
14460 HousePlaySomeSound(uHouseID, 3); | 14460 PrepareHouse(uHouseID); |
14461 return 1; | 14461 v18 = 1; |
14462 } | 14462 uTextureID_507B04 = uTextureID_right_panel; |
14463 } | 14463 if ( uNumDialogueNPCPortraits == 1 ) |
14464 HousePlaySomeSound(uHouseID, 1); | 14464 pDialogueNPCCount = 1; |
14465 dword_5C35D4 = 1; | 14465 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); |
14466 return 1; | 14466 dword_5C35D4 = 1; |
14467 } | 14467 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) |
14468 } | 14468 { |
14469 else | 14469 if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) |
14470 { | 14470 { |
14471 if (( pParty->uCurrentHour < uOpenTime)||( pParty->uCurrentHour > uCloseTime - 1 )) | 14471 return 1; |
14472 { | 14472 } |
14473 am_pm_flag_open = 0; | 14473 } |
14474 am_pm_flag_close = 0; | 14474 else |
14475 if (uOpenTime > 12 ) | 14475 { //guilds |
14476 { | 14476 v19 = word_4F0704[uHouseID-139] - 1; //some gild flag check |
14477 uOpenTime -= 12; | 14477 //v20 = uHouseID; |
14478 am_pm_flag_open = 1; | 14478 if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) |
14479 } | 14479 { |
14480 if ( uCloseTime > 12 ) | 14480 HousePlaySomeSound(uHouseID, 3); |
14481 { | 14481 return 1; |
14482 uCloseTime -= 12; | 14482 } |
14483 am_pm_flag_close = 1; | 14483 } |
14484 } | 14484 HousePlaySomeSound(uHouseID, 1); |
14485 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], | 14485 dword_5C35D4 = 1; |
14486 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" | 14486 return 1; |
14487 ShowStatusBarString(pTmpBuf, 2u); | 14487 } |
14488 if ( uActiveCharacter ) | 14488 } |
14489 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); | |
14490 return 0; | |
14491 } | |
14492 } | |
14493 | |
14494 } |