comparison mm7_5.cpp @ 1297:5450af4f57ef

moving files mm7_x ending
author Ritor1
date Wed, 19 Jun 2013 17:06:58 +0600
parents c423f946dc99
children 8c2f689b5f0b
comparison
equal deleted inserted replaced
1296:c423f946dc99 1297:5450af4f57ef
4063 v17 = v19; 4063 v17 = v19;
4064 memcpy(v1->cpuid_80000002_registers, v18, 0x30u); 4064 memcpy(v1->cpuid_80000002_registers, v18, 0x30u);
4065 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/ 4065 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/
4066 } 4066 }
4067 4067
4068 //----- (00438BDF) --------------------------------------------------------
4069 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
4070 {
4071 unsigned __int8 v2; // zf@15
4072 char v3; // sf@15
4073 unsigned __int8 v4; // of@15
4074 bool result; // eax@33
4075
4076 switch ( eSupertype )
4077 {
4078 case MONSTER_SUPERTYPE_UNDEAD:
4079 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3
4080 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3
4081 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3
4082 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3
4083 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3
4084 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 )
4085 goto ret_true;
4086 if ( (signed int)uMonsterInfoID < MONSTER_GHOUL_1 )
4087 goto ret_false;
4088 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_GHOUL_3);
4089 v2 = uMonsterInfoID == MONSTER_GHOUL_3;
4090 v3 = ((uMonsterInfoID - MONSTER_GHOUL_3) & 0x80000000u) != 0;
4091 goto false_if_outside;
4092 case MONSTER_SUPERTYPE_KREEGAN:
4093 if ( (signed int)uMonsterInfoID < MONSTER_DEVIL_1 )
4094 goto ret_false;
4095 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DEVIL_3);
4096 v2 = uMonsterInfoID == MONSTER_DEVIL_3;
4097 v3 = ((uMonsterInfoID - MONSTER_DEVIL_3) & 0x80000000u) != 0;
4098 goto false_if_outside;
4099 case MONSTER_SUPERTYPE_ELF:
4100 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1
4101 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3
4102 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3 )
4103 goto ret_true;
4104 if ( (signed int)uMonsterInfoID < MONSTER_ELF_SPEARMAN_1 )
4105 goto ret_false;
4106 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELF_SPEARMAN_3);
4107 v2 = uMonsterInfoID == MONSTER_ELF_SPEARMAN_3;
4108 v3 = ((uMonsterInfoID - MONSTER_ELF_SPEARMAN_3) & 0x80000000u) != 0;
4109 goto false_if_outside;
4110 case MONSTER_SUPERTYPE_DRAGON:
4111 if ( (signed int)uMonsterInfoID < MONSTER_DRAGON_1 )
4112 goto ret_false;
4113 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DRAGON_3);
4114 v2 = uMonsterInfoID == MONSTER_DRAGON_3;
4115 v3 = ((uMonsterInfoID - MONSTER_DRAGON_3) & 0x80000000u) != 0;
4116 goto false_if_outside;
4117 case MONSTER_SUPERTYPE_WATER_ELEMENTAL:
4118 if ( (signed int)uMonsterInfoID < MONSTER_ELEMENTAL_WATER_1 )
4119 goto ret_false;
4120 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELEMENTAL_WATER_3);
4121 v2 = uMonsterInfoID == MONSTER_ELEMENTAL_WATER_3;
4122 v3 = ((uMonsterInfoID - MONSTER_ELEMENTAL_WATER_3) & 0x80000000u) != 0;
4123 goto false_if_outside;
4124 case MONSTER_SUPERTYPE_TREANT:
4125 if ( (signed int)uMonsterInfoID < MONSTER_TREANT_1 )
4126 goto ret_false;
4127 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TREANT_3);
4128 v2 = uMonsterInfoID == MONSTER_TREANT_3;
4129 v3 = ((uMonsterInfoID - MONSTER_TREANT_3) & 0x80000000u) != 0;
4130 goto false_if_outside;
4131 case MONSTER_SUPERTYPE_TITAN:
4132 if ( (signed int)uMonsterInfoID < MONSTER_TITAN_1 )
4133 goto ret_false;
4134 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TITAN_3);
4135 v2 = uMonsterInfoID == MONSTER_TITAN_3;
4136 v3 = ((uMonsterInfoID - MONSTER_TITAN_3) & 0x80000000u) != 0;
4137 false_if_outside:
4138 if ( !((unsigned __int8)(v3 ^ v4) | v2) )
4139 goto ret_false;
4140 ret_true:
4141 result = 1;
4142 break;
4143 default:
4144 ret_false:
4145 result = 0;
4146 break;
4147 }
4148 return result;
4149 }
4150
4151 //----- (00438F8F) -------------------------------------------------------- 4068 //----- (00438F8F) --------------------------------------------------------
4152 void __cdecl area_of_effect__damage_evaluate() 4069 void __cdecl area_of_effect__damage_evaluate()
4153 { 4070 {
4154 int v0; // edx@1 4071 int v0; // edx@1
4155 char *v1; // esi@2 4072 char *v1; // esi@2
4374 } 4291 }
4375 stru_50FE08.count = 0; 4292 stru_50FE08.count = 0;
4376 } 4293 }
4377 // 50FE08: using guessed type stru298 stru_50FE08; 4294 // 50FE08: using guessed type stru298 stru_50FE08;
4378 4295
4379 //----- (00439474) --------------------------------------------------------
4380 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity)
4381 {
4382 //signed int v3; // eax@1
4383 SpriteObject *v4; // ebx@1
4384 //int v5; // edx@3
4385 //bool uPlayerID; // eax@3
4386 //Player *pPlayer; // edi@4
4387 Actor *pMonster; // esi@7
4388 //SpriteObject *v9; // ebx@12
4389 int v10; // eax@12
4390 int v11; // ebx@12
4391 unsigned int v12; // ecx@12
4392 int v13; // edx@15
4393 int v14; // edx@17
4394 int v15; // eax@24
4395 unsigned __int16 v16; // cx@25
4396 int v17; // eax@29
4397 int v18; // eax@38
4398 unsigned __int8 v19; // zf@38
4399 unsigned __int8 v20; // sf@38
4400 int v21; // edx@44
4401 int v22; // eax@44
4402 unsigned __int8 v23; // zf@44
4403 unsigned __int8 v24; // sf@44
4404 int v25; // edx@51
4405 int v26; // ecx@51
4406 //signed int v27; // eax@51
4407 //int v28; // eax@53
4408 signed int v29; // eax@76
4409 signed int v30; // eax@84
4410 signed int v31; // eax@92
4411 int v32; // eax@94
4412 int v33; // eax@100
4413 int v34; // eax@104
4414 signed int v35; // eax@104
4415 double v36; // st7@104
4416 float v37; // ST08_4@104
4417 float v38; // ST04_4@104
4418 float v39; // ST00_4@104
4419 int v40; // ebx@107
4420 unsigned int v41; // ebx@109
4421 signed __int64 v42; // qax@125
4422 unsigned __int16 v43; // ax@132
4423 char v44; // bl@132
4424 unsigned __int16 v45; // ax@132
4425 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6
4426 const char *v47; // [sp+14h] [bp-58h]@104
4427 char *pPlayerName; // [sp+18h] [bp-54h]@12
4428 char *pMonsterName; // [sp+1Ch] [bp-50h]@6
4429 int v50; // [sp+20h] [bp-4Ch]@6
4430 //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6
4431 int v52; // [sp+34h] [bp-38h]@12
4432 //int v53; // [sp+38h] [bp-34h]@10
4433 //int v54; // [sp+3Ch] [bp-30h]@1
4434 //int v55; // [sp+40h] [bp-2Ch]@12
4435 signed int a4; // [sp+44h] [bp-28h]@1
4436 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10
4437 //int v58; // [sp+4Ch] [bp-20h]@10
4438 int v59; // [sp+50h] [bp-1Ch]@1
4439 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1
4440 int v61; // [sp+58h] [bp-14h]@1
4441 bool v62; // [sp+5Ch] [bp-10h]@1
4442 int uDamageAmount; // [sp+60h] [bp-Ch]@1
4443 int a2; // [sp+64h] [bp-8h]@27
4444 int a3; // [sp+6Bh] [bp-1h]@6
4445
4446 //v3 = a1;
4447 v4 = 0;
4448 uActorID_Monster_ = uActorID_Monster;
4449 //v54 = a1;
4450 uDamageAmount = 0;
4451 a4 = 0;
4452 v61 = 0;
4453 v59 = 0;
4454 v62 = 0;
4455 if ( PID_TYPE(a1) == OBJECT_Item)
4456 {
4457 v4 = &pSpriteObjects[PID_ID(a1)];
4458 //uDamageAmount = (int)v4;
4459 v61 = v4->field_60_distance_related_prolly_lod;
4460 a1 = v4->spell_caster_pid;
4461 //v54 = v4->field_58_pid;
4462 }
4463 //v5 = a1 & 7;
4464 //uPlayerID = a1 >> 3;
4465 if (PID_TYPE(a1) != OBJECT_Player)
4466 return;
4467
4468 assert(PID_ID(abs(a1)) < 4);
4469 auto player = &pParty->pPlayers[PID_ID(a1)];
4470 pMonster = &pActors[uActorID_Monster_];
4471 //uPlayerID = pMonster->IsAlive();
4472 if (pMonster->IsNotAlive())
4473 return;
4474
4475 BYTE1(pMonster->uAttributes) |= 0xC0u;
4476 if ( pMonster->uAIState == Fleeing )
4477 pMonster->uAttributes |= 0x20000u;
4478 //v57 = 0;
4479 //v53 = 0;
4480 //v58 = 0;
4481 bool hit_will_stun = false,
4482 hit_will_paralyze = false;
4483 if ( !v4 )
4484 {
4485 //v51 = (unsigned __int64 *)player->pEquipment.uMainHand;
4486 int main_hand_idx = player->pEquipment.uMainHand;
4487 v59 = 1;
4488 if ( player->HasItemEquipped(EQUIP_MAIN_HAND) )
4489 {
4490 auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType;
4491 //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType;
4492 //v28 = SkillToMastery(player->pActiveSkills[v55]);
4493 auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]);
4494 //uDamageAmount = v28;
4495 switch (main_hand_skill)
4496 {
4497 case PLAYER_SKILL_STAFF:
4498 if (main_hand_mastery >= 3)
4499 {
4500 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F)) // stun chance when mastery >= 3
4501 hit_will_stun = true;
4502 }
4503 break;
4504
4505 case PLAYER_SKILL_MACE:
4506 if (main_hand_mastery >= 3)
4507 {
4508 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F))
4509 hit_will_stun = true;
4510 }
4511 if (main_hand_mastery >= 4)
4512 {
4513 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F))
4514 hit_will_paralyze = true;
4515 }
4516 break;
4517 }
4518 }
4519 v50 = pMonster->pMonsterInfo.uID;
4520 a2 = 4;
4521 //v27 = player->CalculateMeleeDamageTo(0, 0, v50);
4522 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50);
4523 //if ( !v57 )
4524 goto LABEL_67;
4525 //goto LABEL_69;
4526 }
4527
4528
4529 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER;
4530 v61 = v4->field_60_distance_related_prolly_lod;
4531 if ( !v19 )
4532 {
4533 //v9 = (SpriteObject *)uDamageAmount;
4534 v50 = pParty->vPosition.x - v4->vPosition.x;
4535 //v55 = abs(v50);
4536 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y);
4537 //v51 = (unsigned __int64 *)abs((int)pMonsterName);
4538 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z);
4539 v52 = abs((int)pPlayerName);
4540 v61 = abs(v50);
4541 v10 = abs(v50);
4542 v11 = (int)abs((int)pMonsterName);
4543 v12 = v52;
4544 if ( v10 < v11)
4545 {
4546 v10 = (int)v11;
4547 v11 = v10;
4548 }
4549 if ( v10 < v52 )
4550 {
4551 v13 = v10;
4552 v10 = v52;
4553 v12 = v13;
4554 }
4555 if ( v11 < (signed int)v12 )
4556 {
4557 v14 = v12;
4558 v12 = v11;
4559 v11 = v14;
4560 }
4561 //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10;
4562 v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10;
4563 if ( v61 >= 2560 )
4564 {
4565 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) )
4566 return;
4567 v61 = 2;
4568 }
4569 else
4570 {
4571 v61 = 1;
4572 }
4573 //v4 = (SpriteObject *)uDamageAmount;
4574 }
4575
4576 v15 = v4->spell_id;
4577 if ( v15 == SPELL_LASER_PROJECTILE )
4578 {
4579 v16 = player->pActiveSkills[7];
4580 v61 = 1;
4581 if ( (signed int)SkillToMastery(v16) >= 3 )
4582 a4 = player->pActiveSkills[7] & 0x3F;
4583 a2 = 4;
4584 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0);
4585 goto LABEL_67;
4586 }
4587 if ( v15 != SPELL_BOW_ARROW )
4588 {
4589 if ( v15 == SPELL_101 )
4590 {
4591 a2 = 0;
4592 v18 = player->CalculateRangedDamageTo(0);
4593 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0;
4594 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0;
4595 uDamageAmount = v18;
4596 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
4597 uDamageAmount >>= 1;
4598 v59 = 1;
4599 goto LABEL_67;
4600 }
4601 if ( v15 == SPELL_EARTH_BLADES )
4602 {
4603 a4 = 5 * v4->spell_level;
4604 a2 = player->GetSpellSchool(0x27u);
4605 v21 = v4->spell_level;
4606 v50 = pMonster->sCurrentHP;
4607 pMonsterName = (char *)v4->spell_skill;
4608 v22 = _43AFE3_calc_spell_damage(39, v21, v4->spell_skill, v50);
4609 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0;
4610 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0;
4611 uDamageAmount = v22;
4612 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
4613 uDamageAmount >>= 1;
4614 v59 = 0;
4615 LABEL_67:
4616 if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) )
4617 {
4618 //LABEL_68:
4619 player->PlaySound(SPEECH_52, 0);
4620 return;
4621 }
4622 goto LABEL_69;
4623 }
4624 if ( v15 == SPELL_EARTH_STUN )
4625 {
4626 uDamageAmount = 0;
4627 a2 = 4;
4628 hit_will_stun = 1;
4629 goto LABEL_67;
4630 }
4631 a2 = player->GetSpellSchool(v4->spell_id);
4632 v25 = v4->spell_level;
4633 v26 = v4->spell_id;
4634 v50 = pMonster->sCurrentHP;
4635 pMonsterName = (char *)v4->spell_skill;
4636 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50);
4637 v59 = 0;
4638 //v57 = (PlayerEquipment *)1;
4639 //LABEL_65:
4640 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, v4->spell_skill, v50);
4641 //if ( !v57 )
4642 // goto LABEL_67;
4643 goto LABEL_69;
4644 }
4645 v50 = pMonster->word_000086_some_monster_id;
4646 a2 = 4;
4647 v17 = player->CalculateRangedDamageTo(v50);
4648 v19 = v4->stru_24.uItemID == 0;
4649 uDamageAmount = v17;
4650 v57 = 0;
4651 if ( !v19 && v4->stru_24.uSpecEnchantmentType == 3 )
4652 {
4653 a2 = 0;
4654 v57 = (PlayerEquipment *)1;
4655 }
4656 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0
4657 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
4658 uDamageAmount >>= 1;
4659 v59 = 1;
4660 //LABEL_66:
4661 if ( !v57 )
4662 goto LABEL_67;
4663 LABEL_69:
4664 if (player->Weak())
4665 uDamageAmount /= 1;
4666 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 )
4667 uDamageAmount = 0;
4668 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount);
4669 if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 )
4670 {
4671 v50 = player->pPlayerBuffs[6].uPower;
4672 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50);
4673 v61 += v29;
4674 }
4675 uDamageAmount = v61;
4676 if ( v59 )
4677 {
4678 if ( v4 )
4679 {
4680 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62);
4681 if ( v62 && pMonster->sCurrentHP > 0 )
4682 {
4683 player->sHealth += v61 / 5;
4684 if ( player->sHealth > player->GetMaxHealth() )
4685 player->sHealth = player->GetMaxHealth();
4686 v62 = 0;
4687 }
4688 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4);
4689 uDamageAmount = v61 + v30;
4690 }
4691 else
4692 {
4693 v59 = 0;
4694 v57 = &player->pEquipment;
4695 do
4696 {
4697 if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) )
4698 {
4699 auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1];
4700 a4 = _s->_439DF3_get_additional_damage(&a2, &v62);
4701 if ( v62 && pMonster->sCurrentHP > 0 )
4702 {
4703 player->sHealth += v61 / 5;
4704 if ( player->sHealth > player->GetMaxHealth() )
4705 player->sHealth = player->GetMaxHealth();
4706 v62 = 0;
4707 }
4708 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4);
4709 uDamageAmount += v31;
4710 }
4711 ++v59;
4712 v57 = (PlayerEquipment *)((char *)v57 + 4);
4713 }
4714 while ( v59 <= 1 );
4715 }
4716 }
4717 v32 = uDamageAmount;
4718 pMonster->sCurrentHP -= uDamageAmount;
4719 if ( !v32 && !hit_will_stun )
4720 {
4721 player->PlaySound(SPEECH_52, 0);
4722 return;
4723 }
4724 if ( pMonster->sCurrentHP > 0 )
4725 {
4726 Actor::AI_Stun(uActorID_Monster_, a1, 0);
4727 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1);
4728 if ( bShowDamage )
4729 {
4730 v50 = uDamageAmount;
4731 pMonsterName = (char *)pMonster;
4732 pPlayerName = player->pName;
4733 if ( v4 )
4734 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points"
4735 else
4736 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage"
4737 sprintfex(pTmpBuf.data(), v47, pPlayerName, pMonsterName, v50);
4738 ShowStatusBarString(pTmpBuf.data(), 2u);
4739 }
4740 v41 = 0;
4741 }
4742 else
4743 {
4744 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 )
4745 {
4746 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
4747 //v55 = v33;
4748 if ( pRenderer->pRenderD3D )
4749 {
4750 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
4751 {
4752 v50 = 0;
4753 pMonsterName = 0;
4754 v34 = pMonster->vPosition.z;
4755 *(float *)&pPlayerName = (double)v33;
4756 //v51 = (unsigned __int64 *)v34;
4757 *(float *)&v47 = 0.0;
4758 v35 = pMonster->vPosition.y;
4759 *((float *)&v46 + 1) = 0.0;
4760 *(float *)&v46 = 1.0;
4761 v36 = (double)(signed int)pMonster->vPosition.z;
4762 //v51 = (unsigned __int64 *)v35;
4763 v37 = v36;
4764 //v51 = (unsigned __int64 *)pMonster->vPosition.x;
4765 v38 = (double)v35;
4766 v39 = (double)(signed int)pMonster->vPosition.x;
4767 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0);
4768 }
4769 }
4770 }
4771 Actor::Die(uActorID_Monster_);
4772 Actor::ApplyFineForKillingPeasant(uActorID_Monster_);
4773 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1);
4774 if ( pMonster->pMonsterInfo.uExp )
4775 GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp);
4776 v40 = SPEECH_51;
4777 if ( rand() % 100 < 20 )
4778 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1;
4779 player->PlaySound((PlayerSpeech)v40, 0);
4780 v41 = 0;
4781 if ( bShowDamage )
4782 {
4783 v50 = (int)pMonster;
4784 pMonsterName = (char *)uDamageAmount;
4785 pPlayerName = player->pName; // "%s inflicts %lu points killing %s"
4786 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster);
4787 ShowStatusBarString(pTmpBuf.data(), 2u);
4788 }
4789 }
4790 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41
4791 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41
4792 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41)
4793 && uDamageAmount != v41 )
4794 player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2);
4795 v50 = 24;
4796 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP;
4797 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41)
4798 && stru_50C198.GetMagicalResistance(pMonster, 3u) )
4799 {
4800 LODWORD(v42) = 20;
4801 v59 = 10;
4802 if ( pParty->bTurnBasedModeOn == v41 )
4803 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666);
4804 pMonster->pMonsterInfo.uRecoveryTime += v42;
4805 if ( bShowDamage != v41 )
4806 {
4807 v50 = (int)pMonster;
4808 pMonsterName = player->pName; // "%s stuns %s"
4809 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[635], player->pName, pMonster);
4810 ShowStatusBarString(pTmpBuf.data(), 2u);
4811 }
4812 }
4813 if ( hit_will_paralyze != v41 )
4814 {
4815 if ( pMonster->CanAct() )
4816 {
4817 if ( stru_50C198.GetMagicalResistance(pMonster, 3) )
4818 {
4819 LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE);
4820 v44 = v43;
4821 v45 = SkillToMastery(v43);
4822 //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F));
4823 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335);
4824 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0);
4825 if ( bShowDamage )
4826 {
4827 v50 = (int)pMonster;
4828 pMonsterName = player->pName; // "%s paralyzes %s"
4829 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[636], player->pName, pMonster);
4830 ShowStatusBarString(pTmpBuf.data(), 2u);
4831 }
4832 }
4833 }
4834 }
4835 if ( v59 > 10 )
4836 v59 = 10;
4837 if ( !MonsterStats::BelongsToSupertype(pMonster->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
4838 {
4839 pVelocity->x = (unsigned __int64)(v59 * (signed __int64)pVelocity->x) >> 16;
4840 pVelocity->y = (unsigned __int64)(v59 * (signed __int64)pVelocity->y) >> 16;
4841 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16;
4842 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x);
4843 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y);
4844 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z);
4845 }
4846 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61);
4847 }
4848 // 4D864C: using guessed type char byte_4D864C; 4296 // 4D864C: using guessed type char byte_4D864C;
4849
4850 //----- (00439FCB) --------------------------------------------------------
4851 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4)
4852 {
4853 signed int v4; // esi@1
4854 unsigned int v5; // ecx@1
4855 Player *v6; // ebx@3
4856 Actor *v7; // esi@3
4857 unsigned int v8; // eax@4
4858 char *v9; // eax@5
4859 signed int v10; // eax@6
4860 int v11; // edx@8
4861 int v12; // edx@9
4862 int v13; // edx@10
4863 int v14; // edx@16
4864 int v15; // edx@17
4865 int v16; // edx@18
4866 enum SoundID v17; // eax@24
4867 int v18; // eax@26
4868 unsigned __int8 v19; // zf@26
4869 unsigned __int8 v20; // sf@26
4870 unsigned __int16 v21; // ax@29
4871 signed int v22; // edi@36
4872 int v23; // eax@38
4873 signed int v24; // eax@44
4874 unsigned __int16 v25; // cx@47
4875 signed int v26; // eax@49
4876 int v27; // eax@54
4877 float v28; // ST18_4@58
4878 double v29; // st7@58
4879 float v30; // ST08_4@58
4880 double v31; // st7@58
4881 float v32; // ST04_4@58
4882 float v33; // ST00_4@58
4883 int v34; // edi@61
4884 int v35; // eax@70
4885 double v36; // st7@70
4886 SpriteObject *v37; // ebx@77
4887 int v38; // edi@77
4888 int v39; // esi@77
4889 int v40; // eax@77
4890 int v41; // eax@77
4891 int v42; // eax@78
4892 Player *v43; // eax@81
4893 Actor *v44; // esi@82
4894 Player *v45; // edi@84
4895 unsigned __int16 v46; // ax@84
4896 int v47; // ebx@105
4897 int v48; // eax@107
4898 unsigned __int16 v49; // ax@116
4899 int v50; // ebx@123
4900 unsigned __int16 v51; // ax@124
4901 char v52; // bl@124
4902 int v53; // eax@128
4903 signed int v54; // eax@134
4904 unsigned __int16 v55; // cx@137
4905 signed int v56; // eax@139
4906 int v57; // eax@144
4907 float v58; // ST18_4@148
4908 double v59; // st7@148
4909 float v60; // ST08_4@148
4910 double v61; // st7@148
4911 float v62; // ST04_4@148
4912 float v63; // ST00_4@148
4913 int v64; // ebx@151
4914 int v65; // eax@161
4915 double v66; // st7@161
4916 signed int v67; // ecx@164
4917 signed int v68; // eax@170
4918 int v69; // ecx@170
4919 int v70; // eax@171
4920 enum SoundID v71; // [sp+20h] [bp-34h]@12
4921 int v72; // [sp+30h] [bp-24h]@164
4922 double v73; // [sp+40h] [bp-14h]@72
4923 signed int v74; // [sp+44h] [bp-10h]@1
4924 unsigned int v75; // [sp+48h] [bp-Ch]@3
4925 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1
4926 int v77; // [sp+50h] [bp-4h]@26
4927 signed int a4a; // [sp+60h] [bp+Ch]@162
4928 Player *a4b; // [sp+60h] [bp+Ch]@168
4929
4930 v4 = PID_ID(uObjID);
4931 v5 = PID_TYPE(uObjID) - 2;
4932 v74 = a2;
4933 uActorID = v4;
4934 if ( v5 )
4935 {
4936 if ( v5 != 1
4937 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4],
4938 v75 = v6->sHealth,
4939 !stru_50C198.ActorHitOrMiss(v7, v6)) )
4940 return;
4941 v8 = v6->pEquipment.uArmor;
4942 if ( !v8
4943 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2)
4944 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10)
4945 || v10 > 11 )
4946 {
4947 v14 = rand() % 4;
4948 if ( !v14 )
4949 {
4950 v71 = (SoundID)108;
4951 goto LABEL_24;
4952 }
4953 v15 = v14 - 1;
4954 if ( !v15 )
4955 {
4956 v71 = (SoundID)109;
4957 goto LABEL_24;
4958 }
4959 v16 = v15 - 1;
4960 if ( !v16 )
4961 {
4962 v71 = (SoundID)110;
4963 goto LABEL_24;
4964 }
4965 if ( v16 == 1 )
4966 {
4967 v71 = (SoundID)44;
4968 goto LABEL_24;
4969 }
4970 }
4971 else
4972 {
4973 v11 = rand() % 4;
4974 if ( !v11 )
4975 {
4976 v71 = (SoundID)105;
4977 goto LABEL_24;
4978 }
4979 v12 = v11 - 1;
4980 if ( !v12 )
4981 {
4982 v71 = (SoundID)106;
4983 goto LABEL_24;
4984 }
4985 v13 = v12 - 1;
4986 if ( !v13 )
4987 {
4988 v71 = (SoundID)107;
4989 goto LABEL_24;
4990 }
4991 if ( v13 == 1 )
4992 {
4993 v71 = (SoundID)45;
4994 LABEL_24:
4995 v17 = v71;
4996 goto LABEL_26;
4997 }
4998 }
4999 v17 = (SoundID)a4;
5000 LABEL_26:
5001 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0);
5002 v18 = Actor::_43B3E0_CalcDamage(v7, v74);
5003 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0;
5004 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0;
5005 v77 = v18;
5006 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) )
5007 {
5008 v21 = v7->pActorBuffs[3].uPower;
5009 if ( v21 )
5010 v77 /= (signed int)v21;
5011 }
5012 if ( v74 )
5013 {
5014 if ( v74 == 1 )
5015 {
5016 v22 = v7->pMonsterInfo.uAttack2Type;
5017 }
5018 else
5019 {
5020 if ( v74 == 2 )
5021 {
5022 v23 = v7->pMonsterInfo.uSpell1ID;
5023 }
5024 else
5025 {
5026 if ( v74 != 3 )
5027 {
5028 if ( v74 == 4 )
5029 v22 = v7->pMonsterInfo.field_3C_some_special_attack;
5030 else
5031 v22 = 4;
5032 goto LABEL_43;
5033 }
5034 v23 = v7->pMonsterInfo.uSpell2ID;
5035 }
5036 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool);
5037 }
5038 }
5039 else
5040 {
5041 v22 = v7->pMonsterInfo.uAttack1Type;
5042 }
5043 LABEL_43:
5044 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
5045 {
5046 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22);
5047 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0
5048 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) )
5049 {
5050 v25 = v7->uAIState;
5051 if ( v25 != 5 )
5052 {
5053 if ( v25 != 4 )
5054 {
5055 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24);
5056 v7->sCurrentHP -= v26;
5057 if ( v26 )
5058 {
5059 if ( v7->sCurrentHP >= 1 )
5060 {
5061 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
5062 Actor::AggroSurroundingPeasants(uActorID, 1);
5063 }
5064 else
5065 {
5066 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 )
5067 {
5068 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius;
5069 v74 = v27;
5070 if ( pRenderer->pRenderD3D )
5071 {
5072 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
5073 {
5074 v28 = (double)v74;
5075 v74 = v7->vPosition.z;
5076 v29 = (double)v74;
5077 v74 = v7->vPosition.y;
5078 v30 = v29;
5079 v31 = (double)v74;
5080 v74 = v7->vPosition.x;
5081 v32 = v31;
5082 v33 = (double)v74;
5083 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0);
5084 }
5085 }
5086 }
5087 Actor::Die(uActorID);
5088 Actor::ApplyFineForKillingPeasant(uActorID);
5089 Actor::AggroSurroundingPeasants(uActorID, 1);
5090 if ( v7->pMonsterInfo.uExp )
5091 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp);
5092 v34 = SPEECH_51;
5093 if ( rand() % 100 < 20 )
5094 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1;
5095 v6->PlaySound((PlayerSpeech)v34, 0);
5096 }
5097 }
5098 }
5099 }
5100 }
5101 if ( !(dword_6BE368_debug_settings_2 & 0x10)
5102 && v7->pMonsterInfo.uSpecialAttack
5103 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType )
5104 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7);
5105 }
5106 if ( !pParty->bTurnBasedModeOn )
5107 {
5108 v35 = v6->GetActualEndurance();
5109 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
5110 v6->SetRecoveryTime((signed __int64)v36);
5111 }
5112 if ( v77 )
5113 {
5114 v73 = (double)(signed int)v75;
5115 if ( (double)v6->GetMaxHealth() * 0.25 < v73 )
5116 {
5117 if ( v6->sHealth > 0 )
5118 {
5119 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth )
5120 v6->PlaySound(SPEECH_48, 0);
5121 }
5122 }
5123 }
5124 viewparams->bRedrawGameUI = 1;
5125 return;
5126 }
5127 v37 = &pSpriteObjects[uActorID];
5128 v38 = PID_TYPE(v37->spell_caster_pid);
5129 v39 = PID_ID(v37->spell_caster_pid);
5130 v40 = PID_TYPE(v37->spell_caster_pid);
5131 uActorID = PID_ID(v37->spell_caster_pid);
5132 v41 = v40 - 2;
5133 if ( !v41 )
5134 goto LABEL_80;
5135 v42 = v41 - 1;
5136 if ( !v42 )
5137 {
5138 v44 = &pActors[v39];
5139 if ( a4 == -1 )
5140 a4 = stru_50C198.which_player_would_attack(v44);
5141 v45 = &pParty->pPlayers[a4];
5142 v77 = Actor::_43B3E0_CalcDamage(v44, v74);
5143 v46 = v37->uType;
5144 if ( v37->uType == 545 )
5145 {
5146 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
5147 v52 = v51;
5148 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) )
5149 {
5150 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName);
5151 ShowStatusBarString(pTmpBuf.data(), 2u);
5152 v45->PlaySound(SPEECH_6, 0);
5153 return;
5154 }
5155 }
5156 else
5157 {
5158 if ( v46 != 555
5159 && v46 != 510
5160 && v46 != 500
5161 && v46 != 515
5162 && v46 != 505
5163 && v46 != 530
5164 && v46 != 525
5165 && v46 != 520
5166 && v46 != 535
5167 && v46 != 540 )
5168 goto LABEL_115;
5169 }
5170 if ( !stru_50C198.ActorHitOrMiss(v44, v45) )
5171 return;
5172 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 )
5173 v77 >>= 1;
5174 if ( v45->HasEnchantedItemEquipped(36) )
5175 v77 >>= 1;
5176 if ( v45->HasEnchantedItemEquipped(69) )
5177 v77 >>= 1;
5178 if ( v45->HasItemEquipped(EQUIP_ARMOUR)
5179 && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 )
5180 v77 >>= 1;
5181 v75 = 0;
5182 v47 = (int)&v45->pEquipment;
5183 do
5184 {
5185 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) )
5186 {
5187 v48 = *(int *)&v45[36 * *(int *)v47 + 496];
5188 if ( v48 == 520 )
5189 v77 >>= 1;
5190 if ( v48 == 531 )
5191 v77 >>= 1;
5192 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 )
5193 v77 >>= 1;
5194 }
5195 ++v75;
5196 v47 += 4;
5197 }
5198 while ( (signed int)v75 <= 1 );
5199 LABEL_115:
5200 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 )
5201 {
5202 v49 = v44->pActorBuffs[3].uPower;
5203 if ( v49 )
5204 v77 /= (signed int)v49;
5205 }
5206 if ( !v74 )
5207 {
5208 v50 = v44->pMonsterInfo.uAttack1Type;
5209 goto LABEL_133;
5210 }
5211 if ( v74 == 1 )
5212 {
5213 v50 = v44->pMonsterInfo.uAttack2Type;
5214 goto LABEL_133;
5215 }
5216 if ( v74 == 2 )
5217 {
5218 v53 = v44->pMonsterInfo.uSpell1ID;
5219 }
5220 else
5221 {
5222 if ( v74 != 3 )
5223 {
5224 if ( v74 == 4 )
5225 v50 = v44->pMonsterInfo.field_3C_some_special_attack;
5226 else
5227 v50 = 4;
5228 LABEL_133:
5229 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
5230 {
5231 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50);
5232 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 )
5233 {
5234 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) )
5235 {
5236 v55 = v44->uAIState;
5237 if ( v55 != 5 )
5238 {
5239 if ( v55 != 4 )
5240 {
5241 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54);
5242 v44->sCurrentHP -= v56;
5243 if ( v56 )
5244 {
5245 if ( v44->sCurrentHP >= 1 )
5246 {
5247 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
5248 Actor::AggroSurroundingPeasants(uActorID, 1);
5249 }
5250 else
5251 {
5252 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 )
5253 {
5254 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius;
5255 v75 = v57;
5256 if ( pRenderer->pRenderD3D )
5257 {
5258 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
5259 {
5260 v58 = (double)(signed int)v75;
5261 v75 = v44->vPosition.z;
5262 v59 = (double)(signed int)v75;
5263 v75 = v44->vPosition.y;
5264 v60 = v59;
5265 v61 = (double)(signed int)v75;
5266 v75 = v44->vPosition.x;
5267 v62 = v61;
5268 v63 = (double)(signed int)v75;
5269 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0);
5270 }
5271 }
5272 }
5273 Actor::Die(uActorID);
5274 Actor::ApplyFineForKillingPeasant(uActorID);
5275 Actor::AggroSurroundingPeasants(uActorID, 1);
5276 if ( v44->pMonsterInfo.uExp )
5277 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp);
5278 v64 = SPEECH_51;
5279 if ( rand() % 100 < 20 )
5280 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1;
5281 v45->PlaySound((PlayerSpeech)v64, 0);
5282 }
5283 }
5284 }
5285 }
5286 }
5287 }
5288 }
5289 if ( !v74
5290 && !(dword_6BE368_debug_settings_2 & 0x10)
5291 && v44->pMonsterInfo.uSpecialAttack
5292 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType )
5293 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44);
5294 if ( !pParty->bTurnBasedModeOn )
5295 {
5296 v65 = v45->GetActualEndurance();
5297 v66 = (double)(20 - v45->GetParameterBonus(v65))
5298 * flt_6BE3A4_debug_recmod1
5299 * 2.133333333333333;
5300 v45->SetRecoveryTime((signed __int64)v66);
5301 }
5302 return;
5303 }
5304 v53 = v44->pMonsterInfo.uSpell2ID;
5305 }
5306 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool);
5307 goto LABEL_133;
5308 }
5309 if ( v42 != 1 )
5310 return;
5311 LABEL_80:
5312 if ( a4 != -1 )
5313 {
5314 v43 = &pParty->pPlayers[a4];
5315 LABEL_168:
5316 a4b = v43;
5317 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW)
5318 {
5319 v70 = v43->GetMaxHealth();
5320 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70);
5321 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool);
5322 }
5323 else
5324 {
5325 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
5326 v69 = 0;
5327 }
5328 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69);
5329 if ( v38 == OBJECT_Player && !qword_A750D8 )
5330 {
5331 qword_A750D8 = 256i64;
5332 word_A750E0 = 44;
5333 word_A750E2 = uActorID + 1;
5334 }
5335 return;
5336 }
5337 v74 = 0;
5338 a4a = 1;
5339 do
5340 {
5341 if ( pPlayers[a4a]->CanAct() )
5342 {
5343 v67 = v74++;
5344 *(&v72 + v67) = a4a;
5345 }
5346 ++a4a;
5347 }
5348 while ( a4a <= 4 );
5349 if ( v74 )
5350 {
5351 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552];
5352 goto LABEL_168;
5353 }
5354 }
5355 4297
5356 //----- (0043A97E) -------------------------------------------------------- 4298 //----- (0043A97E) --------------------------------------------------------
5357 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) 4299 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
5358 { 4300 {
5359 if ( PID_TYPE(a2) == OBJECT_BLVDoor) 4301 if ( PID_TYPE(a2) == OBJECT_BLVDoor)
5434 result = flt_4E4A80[0]; 4376 result = flt_4E4A80[0];
5435 } 4377 }
5436 else 4378 else
5437 { 4379 {
5438 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; 4380 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
5439 }
5440 return result;
5441 }
5442
5443 //----- (0043AFE3) --------------------------------------------------------
5444 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4)
5445 {
5446 int result; // eax@1
5447 unsigned int v5; // [sp-4h] [bp-8h]@9
5448
5449 result = 0;
5450 if ( a1 == 7 )
5451 {
5452 if ( a3 <= 0 )
5453 return result;
5454 if ( a3 <= 2 )
5455 {
5456 v5 = 6;
5457 }
5458 else
5459 {
5460 if ( a3 == 3 )
5461 {
5462 v5 = 8;
5463 }
5464 else
5465 {
5466 if ( a3 != 4 )
5467 return result;
5468 v5 = 10;
5469 }
5470 }
5471 result = GetDiceResult(a2, v5);
5472 }
5473 else
5474 {
5475 if ( a1 == 44 )
5476 result = a4 * (LOBYTE(pSpellDatas[40].field_10) + 2 * a2) / 100;
5477 else
5478 result = *((char *)&pSpellDatas[0].field_10 + 20 * a1)
5479 + GetDiceResult(a2, *((char *)&pSpellDatas[0].field_10 + 20 * a1 + 1));
5480 } 4381 }
5481 return result; 4382 return result;
5482 } 4383 }
5483 4384
5484 //----- (0043B057) -------------------------------------------------------- 4385 //----- (0043B057) --------------------------------------------------------
5652 } 4553 }
5653 } 4554 }
5654 } 4555 }
5655 } 4556 }
5656 4557
5657 //----- (0043C91D) --------------------------------------------------------
5658 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
5659 {
5660 int result; // eax@2
5661 char v5; // zf@3
5662 const char *v6; // [sp-Ch] [bp-18h]@88
5663 signed int v7; // [sp-8h] [bp-14h]@61
5664 int v8; // [sp-4h] [bp-10h]@61
5665 signed int v9; // [sp-4h] [bp-10h]@69
5666
5667 result = 0; //BUG fn is void
5668 if ( item_id <= 500 )
5669 {
5670 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0;
5671 v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0;
5672 switch ( item_id )
5673 {
5674 case 516:
5675 v5 = byte_5111F6[2] == 0;
5676 break;
5677 case 505:
5678 v5 = byte_5111F6[1] == 0;
5679 break;
5680 case 504:
5681 v5 = byte_5111F6[0] == 0;
5682 break;
5683 case 533:
5684 v5 = byte_5111F6[16] == 0;
5685 break;
5686 case 512:
5687 v5 = byte_5111F6[3] == 0;
5688 break;
5689 case 521:
5690 v5 = byte_5111F6[4] == 0;
5691 break;
5692 case 522:
5693 v5 = byte_5111F6[5] == 0;
5694 break;
5695 case 523:
5696 v5 = byte_5111F6[6] == 0;
5697 break;
5698 case 532:
5699 v5 = byte_5111F6[7] == 0;
5700 break;
5701 case 544:
5702 v5 = byte_5111F6[8] == 0;
5703 break;
5704 case 524:
5705 v5 = byte_5111F6[9] == 0;
5706 break;
5707 case 535:
5708 v5 = byte_5111F6[10] == 0;
5709 break;
5710 case 525:
5711 v5 = byte_5111F6[11] == 0;
5712 break;
5713 case 530:
5714 v5 = byte_5111F6[12] == 0;
5715 break;
5716 case 547:
5717 v5 = byte_5111F6[13] == 0;
5718 break;
5719 case 548:
5720 v5 = byte_5111F6[14] == 0;
5721 break;
5722 case 550:
5723 v5 = byte_5111F6[15] == 0;
5724 break;
5725 default:
5726 break;
5727 }
5728 if ( v5 )
5729 return result;
5730 result = 516;
5731 if ( item_id < 66 || item_id > 78 )
5732 {
5733 if ( item_id == 516 )
5734 {
5735 if ( !shoulder )
5736 return sprintf(pOut, "item%3.3dv%d", 234, index);
5737 if ( shoulder == 1 )
5738 return sprintf(pOut, "item%3.3dv%da1", 234, index);
5739 if ( shoulder == 2 )
5740 return sprintf(pOut, "item%3.3dv%da2", 234, index);
5741 }
5742 if ( item_id != 504 && item_id != 505 && item_id != 533 )
5743 {
5744 if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 )
5745 {
5746 if ( item_id >= 115 && item_id <= 119 || item_id == 512 )
5747 {
5748 if ( item_id == 512 )
5749 item_id = 312;
5750 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5751 }
5752 if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 )
5753 {
5754 result = 525;
5755 if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 )
5756 return result;
5757 switch ( item_id )
5758 {
5759 case 525:
5760 item_id = 325;
5761 break;
5762 case 530:
5763 item_id = 330;
5764 break;
5765 case 547:
5766 item_id = 347;
5767 break;
5768 case 548:
5769 item_id = 348;
5770 break;
5771 case 550:
5772 item_id = 350;
5773 break;
5774 }
5775 if ( !shoulder )
5776 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5777 return sprintf(pOut, "item%3.3dv%da1", item_id, index);
5778 }
5779 if ( item_id == 521 )
5780 return sprintf(pOut, "item%3.3dv%d", 239, index);
5781 if ( item_id == 522 )
5782 return sprintf(pOut, "item%3.3dv%d", 240, index);
5783 if ( item_id == 523 )
5784 return sprintf(pOut, "item%3.3dv%d", 241, index);
5785 if ( item_id != 532 )
5786 {
5787 if ( item_id == 544 )
5788 item_id = 344;
5789 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5790 }
5791 return sprintf(pOut, "item%3.3dv%d", 93, index);
5792 }
5793 if ( item_id == 524 )
5794 return sprintf(pOut, "item%3.3dv%d", 324, index);
5795 if ( item_id == 535 )
5796 item_id = 104;
5797 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5798 }
5799 }
5800 if ( item_id != 516 )
5801 {
5802 switch ( item_id )
5803 {
5804 case 504:
5805 item_id = 235;
5806 break;
5807 case 505:
5808 item_id = 236;
5809 break;
5810 case 533:
5811 item_id = 73;
5812 break;
5813 }
5814 if ( !shoulder )
5815 return sprintf(pOut, "item%3.3dv%d", item_id, index);
5816 if ( shoulder == 1 )
5817 return sprintf(pOut, "item%3.3dv%da1", item_id, index);
5818 if ( shoulder == 2 )
5819 return sprintf(pOut, "item%3.3dv%da2", item_id, index);
5820 }
5821 if ( !shoulder )
5822 return sprintf(pOut, "item%3.3dv%d", 234, index);
5823 if ( shoulder == 1 )
5824 return sprintf(pOut, "item%3.3dv%da1", 234, index);
5825 if ( shoulder == 2 )
5826 return sprintf(pOut, "item%3.3dv%da2", 234, index);
5827 }
5828 result = item_id - 504;
5829 return result;
5830 }
5831
5832 //----- (0043ED6F) --------------------------------------------------------
5833 bool _43ED6F_check_party_races(bool a1)
5834 {
5835 bool v6; // zf@5
5836
5837 for (uint i = 0; i < 4; ++i)
5838 {
5839 auto player = pParty->pPlayers + i;
5840 auto race = player->GetRace();
5841
5842 if (race != CHARACTER_RACE_HUMAN &&
5843 race != CHARACTER_RACE_ELF &&
5844 race != CHARACTER_RACE_GOBLIN)
5845 v6 = a1 == 1;
5846 else
5847 v6 = !a1;
5848
5849 if (v6)
5850 return true;
5851 }
5852 return false;
5853 }
5854 // A750D8: using guessed type __int64 qword_A750D8; 4558 // A750D8: using guessed type __int64 qword_A750D8;
5855 4559
5856 //----- (0043EDB9) -------------------------------------------------------- 4560
5857 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1)
5858 {
5859 unsigned int pNum; // ebp@1
5860 Player **pPlayer; // ebx@1
5861 Player *pPlayer2; // esi@2
5862 enum CHARACTER_RACE pRace; // edi@2
5863 bool pSex; // eax@2
5864 char v6; // zf@7
5865
5866 //pPlayer = &pPlayers[1];
5867 /*pNum = a1;
5868
5869 while ( 1 )
5870 {
5871 pPlayer2 = *pPlayer;
5872 pRace = pPlayer2->GetRace();
5873 pSex = pPlayer2->GetSexByVoice();
5874 if ( !pRace )
5875 break;
5876 if ( pRace == 1 || pRace == 2 )
5877 break;
5878 if ( !pSex && pNum == 2 )//
5879 //goto LABEL_15;
5880 {
5881 pSex = 1;
5882 return pSex;
5883 }
5884 v6 = pNum == 3;//
5885 LABEL_11:
5886 if ( v6 )
5887 //goto LABEL_15;
5888 {
5889 pSex = 1;
5890 return pSex;
5891 }
5892 ++pPlayer;
5893 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )//
5894 {
5895 pSex = 0;
5896 return pSex;
5897 }
5898 }
5899 if ( pSex || pNum )
5900 {
5901 v6 = pNum == 1;
5902 goto LABEL_11;
5903 }
5904 //LABEL_15:
5905 pSex = 1;
5906 return pSex;*/
5907 for (uint i = 1; i <= 4; ++i)
5908 {
5909 pRace = pPlayers[i]->GetRace();
5910 pSex = pPlayers[i]->GetSexByVoice();
5911 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 )
5912 return 1;
5913 }
5914 return 0;
5915 }
5916 // A750D8: using guessed type __int64 qword_A750D8; 4561 // A750D8: using guessed type __int64 qword_A750D8;
5917 4562
5918 //----- (0043EE15) -------------------------------------------------------- 4563
5919 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3)
5920 {
5921 if ( !a3 || pParty->pPickedItem.uItemID != uItemID )
5922 {
5923 for ( uint i = 0; i < 126; ++i )
5924 {
5925 if ( pPlayer->pInventoryIndices[i] > 0 )
5926 {
5927 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID )
5928 return true;
5929 }
5930 }
5931 for ( uint i = 0; i < 16; ++i )
5932 {
5933 if ( pPlayer->pEquipment.pIndices[i] )
5934 {
5935 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID )
5936 return true;
5937 }
5938 }
5939 }
5940 return false;
5941 }
5942
5943 //----- (0043EE77) --------------------------------------------------------
5944 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1)
5945 {
5946 bool result; // eax@0
5947 Player *v2; // edx@3
5948 int v3; // ecx@3
5949 Player **pPlayers; // esi@8
5950 unsigned int v5; // ecx@8
5951 Player *v6; // edx@9
5952
5953 if ( a1 < 1 || a1 > 4 )
5954 {
5955 if ( !a1 )
5956 {
5957 pPlayers = &::pPlayers[1];
5958 v5 = 604;
5959 while ( 1 )
5960 {
5961 result = Player_has_item(v5, *pPlayers, 0);
5962 if ( !result )
5963 break;
5964 result = v6->pEquipment.uArmor;
5965 if ( !result )
5966 break;
5967 result *= 9;
5968 if ( *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v5 )
5969 break;
5970 ++pPlayers;
5971 if ( (signed int)pPlayers >= (signed int)&qword_A750D8 )
5972 goto LABEL_13;
5973 }
5974 }
5975 goto LABEL_6;
5976 }
5977 result = Player_has_item(604u, ::pPlayers[a1], 0);
5978 if ( !result
5979 || (result = v2->pEquipment.uArmor) == 0
5980 || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) )
5981 {
5982 LABEL_6:
5983 LOBYTE(result) = 0;
5984 return result;
5985 }
5986 LABEL_13:
5987 LOBYTE(result) = 1;
5988 return result;
5989 }
5990 // A750D8: using guessed type __int64 qword_A750D8; 4564 // A750D8: using guessed type __int64 qword_A750D8;
5991
5992
5993 //----- (0043F333) --------------------------------------------------------
5994 void BspRenderer::MakeVisibleSectorList()
5995 {
5996 int v6; // ebx@3
5997
5998 uNumVisibleNotEmptySectors = 0;
5999 for (uint i = 0; i < num_nodes; ++i)
6000 {
6001 if (!uNumVisibleNotEmptySectors)
6002 {
6003 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID;
6004 continue;
6005 }
6006
6007 v6 = 0;
6008 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID )
6009 {
6010 ++v6;
6011 if ( v6 >= uNumVisibleNotEmptySectors)
6012 {
6013 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID;
6014 }
6015 }
6016
6017 }
6018 }
6019 4565
6020 //----- (0043F515) -------------------------------------------------------- 4566 //----- (0043F515) --------------------------------------------------------
6021 void FindBillboardsLightLevels_BLV() 4567 void FindBillboardsLightLevels_BLV()
6022 { 4568 {
6023 for (uint i = 0; i < uNumBillboardsToDraw; ++i) 4569 for (uint i = 0; i < uNumBillboardsToDraw; ++i)
8059 LABEL_29: 6605 LABEL_29:
8060 result = 0; 6606 result = 0;
8061 return result; 6607 return result;
8062 } 6608 }
8063 6609
8064 //----- (00407A1C) --------------------------------------------------------
8065 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v)
8066 {
8067 unsigned int v4; // esi@1
8068 Vec3_int_ v5; // ST08_12@2
8069 int v6; // edi@2
8070 int v7; // ebx@2
8071 int v8; // esi@2
8072 signed int v9; // ecx@2
8073 int v10; // eax@2
8074 int v11; // ecx@4
8075 int v12; // eax@4
8076 int v13; // ebx@4
8077 int v14; // edx@6
8078 char *v15; // edi@16
8079 ODMFace *v16; // esi@19
8080 int v17; // ST34_4@25
8081 int v18; // ST38_4@25
8082 int v19; // eax@25
8083 char v20; // zf@25
8084 int v21; // ebx@25
8085 int v22; // eax@26
8086 signed int v23; // edi@26
8087 int v24; // ST34_4@30
8088 signed __int64 v25; // qtt@31
8089 int v26; // eax@31
8090 Vec3_int_ v27; // ST08_12@37
8091 Vec3_int_ v28; // ST08_12@37
8092 int v29; // edi@37
8093 int v30; // ebx@37
8094 int v31; // esi@37
8095 signed int v32; // ecx@37
8096 int v33; // eax@37
8097 int v34; // ecx@39
8098 int v35; // eax@39
8099 int v36; // ebx@39
8100 int v37; // edx@41
8101 char *v38; // edi@51
8102 ODMFace *v39; // esi@54
8103 int v40; // ebx@60
8104 int v41; // eax@61
8105 signed int v42; // edi@61
8106 signed __int64 v43; // qtt@66
8107 int v44; // eax@66
8108 Vec3_int_ v45; // ST08_12@73
8109 int v46; // edi@73
8110 int v47; // ebx@73
8111 int v48; // esi@73
8112 signed int v49; // ecx@73
8113 int v50; // eax@73
8114 int v51; // edx@75
8115 int v52; // ecx@75
8116 int v53; // eax@75
8117 int v54; // ebx@75
8118 int v55; // edi@77
8119 int v56; // ecx@77
8120 int v57; // eax@81
8121 int v58; // esi@81
8122 int v59; // eax@90
8123 BLVSector *v60; // edx@90
8124 int v61; // ecx@90
8125 BLVFace *v62; // esi@91
8126 int v63; // ST34_4@98
8127 int v64; // ST30_4@98
8128 int v65; // eax@98
8129 int v66; // ebx@98
8130 int v67; // eax@99
8131 signed int v68; // edi@99
8132 int v69; // ST2C_4@103
8133 signed __int64 v70; // qtt@104
8134 int v71; // eax@104
8135 Vec3_int_ v72; // ST08_12@111
8136 Vec3_int_ v73; // ST08_12@111
8137 int v74; // edi@111
8138 int v75; // ebx@111
8139 int v76; // esi@111
8140 signed int v77; // ecx@111
8141 int v78; // eax@111
8142 int v79; // edx@113
8143 int v80; // ecx@113
8144 int v81; // eax@113
8145 int v82; // ebx@113
8146 int v83; // edi@115
8147 int v84; // ecx@115
8148 int v85; // eax@119
8149 int v86; // esi@119
8150 int v87; // ecx@128
8151 BLVSector *v88; // eax@128
8152 int v89; // ecx@128
8153 BLVFace *v90; // esi@129
8154 int v91; // ebx@136
8155 int v92; // eax@137
8156 signed int v93; // edi@137
8157 signed __int64 v94; // qtt@142
8158 int v95; // eax@142
8159 Vec3_int_ v97; // [sp-18h] [bp-94h]@1
8160 int v98; // [sp-Ch] [bp-88h]@88
8161 int v99; // [sp-Ch] [bp-88h]@126
8162 int v100; // [sp-8h] [bp-84h]@88
8163 int v101; // [sp-8h] [bp-84h]@126
8164 int v102; // [sp-4h] [bp-80h]@88
8165 int v103; // [sp-4h] [bp-80h]@126
8166 int v104; // [sp+Ch] [bp-70h]@13
8167 int v105; // [sp+Ch] [bp-70h]@48
8168 int v106; // [sp+10h] [bp-6Ch]@18
8169 int v107; // [sp+10h] [bp-6Ch]@98
8170 int v108; // [sp+10h] [bp-6Ch]@104
8171 int v109; // [sp+18h] [bp-64h]@25
8172 int v110; // [sp+18h] [bp-64h]@31
8173 int i; // [sp+18h] [bp-64h]@90
8174 int v112; // [sp+18h] [bp-64h]@128
8175 signed int v113; // [sp+20h] [bp-5Ch]@1
8176 signed int v114; // [sp+24h] [bp-58h]@1
8177 unsigned __int64 a4; // [sp+28h] [bp-54h]@1
8178 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1
8179 int v117; // [sp+34h] [bp-48h]@4
8180 int v118; // [sp+34h] [bp-48h]@39
8181 int v119; // [sp+34h] [bp-48h]@75
8182 int v120; // [sp+34h] [bp-48h]@113
8183 int v121; // [sp+38h] [bp-44h]@4
8184 int v122; // [sp+38h] [bp-44h]@39
8185 int v123; // [sp+38h] [bp-44h]@76
8186 int v124; // [sp+38h] [bp-44h]@114
8187 int v125; // [sp+3Ch] [bp-40h]@4
8188 int v126; // [sp+3Ch] [bp-40h]@39
8189 int v127; // [sp+3Ch] [bp-40h]@77
8190 int v128; // [sp+3Ch] [bp-40h]@115
8191 int v129; // [sp+40h] [bp-3Ch]@11
8192 int v130; // [sp+40h] [bp-3Ch]@46
8193 int v131; // [sp+40h] [bp-3Ch]@78
8194 int v132; // [sp+40h] [bp-3Ch]@116
8195 int v133; // [sp+44h] [bp-38h]@10
8196 int v134; // [sp+44h] [bp-38h]@45
8197 int v135; // [sp+44h] [bp-38h]@81
8198 int v136; // [sp+44h] [bp-38h]@119
8199 int v137; // [sp+48h] [bp-34h]@7
8200 int v138; // [sp+48h] [bp-34h]@42
8201 int v139; // [sp+48h] [bp-34h]@82
8202 int v140; // [sp+48h] [bp-34h]@120
8203 int v141; // [sp+4Ch] [bp-30h]@6
8204 int v142; // [sp+4Ch] [bp-30h]@41
8205 int v143; // [sp+4Ch] [bp-30h]@75
8206 int v144; // [sp+4Ch] [bp-30h]@113
8207 int v145; // [sp+50h] [bp-2Ch]@5
8208 int v146; // [sp+50h] [bp-2Ch]@40
8209 int v147; // [sp+50h] [bp-2Ch]@75
8210 int v148; // [sp+50h] [bp-2Ch]@113
8211 int v149; // [sp+54h] [bp-28h]@4
8212 int v150; // [sp+54h] [bp-28h]@39
8213 int v151; // [sp+54h] [bp-28h]@75
8214 int v152; // [sp+54h] [bp-28h]@113
8215 int sDepth; // [sp+58h] [bp-24h]@17
8216 int sDeptha; // [sp+58h] [bp-24h]@52
8217 int sDepthb; // [sp+58h] [bp-24h]@90
8218 char *a5; // [sp+5Ch] [bp-20h]@16
8219 char *a5a; // [sp+5Ch] [bp-20h]@51
8220 signed int a5b; // [sp+5Ch] [bp-20h]@83
8221 signed int a5c; // [sp+5Ch] [bp-20h]@121
8222 signed int v160; // [sp+60h] [bp-1Ch]@12
8223 signed int v161; // [sp+60h] [bp-1Ch]@47
8224 int v162; // [sp+60h] [bp-1Ch]@128
8225 int v163; // [sp+64h] [bp-18h]@2
8226 int outx; // [sp+68h] [bp-14h]@2
8227 int outy; // [sp+6Ch] [bp-10h]@2
8228 int outz; // [sp+70h] [bp-Ch]@2
8229 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2
8230 int ya; // [sp+84h] [bp+8h]@60
8231 int yb; // [sp+84h] [bp+8h]@136
8232 int ve; // [sp+88h] [bp+Ch]@60
8233 int va; // [sp+88h] [bp+Ch]@60
8234 int vb; // [sp+88h] [bp+Ch]@66
8235 int vf; // [sp+88h] [bp+Ch]@136
8236 int vc; // [sp+88h] [bp+Ch]@136
8237 int vd; // [sp+88h] [bp+Ch]@142
8238 int v_4; // [sp+8Ch] [bp+10h]@60
8239 int v_4a; // [sp+8Ch] [bp+10h]@65
8240 int v_4b; // [sp+8Ch] [bp+10h]@136
8241 int v_4c; // [sp+8Ch] [bp+10h]@141
8242 int v_8; // [sp+90h] [bp+14h]@53
8243
8244 a4 = __PAIR__(z, x);
8245 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z);
8246 v114 = 0;
8247 v97.z = y;
8248 v113 = 0;
8249 a4_8 = v4;
8250 *(_QWORD *)&v97.x = a4;
8251 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
8252 {
8253 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz);
8254 v45.z = v.z;
8255 *(_QWORD *)&v45.x = *(_QWORD *)&v;
8256 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163);
8257 v46 = outy - pOut.y;
8258 v47 = v163 - outz;
8259 v48 = outx - pOut.x;
8260 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47);
8261 v50 = 65536;
8262 if ( v49 )
8263 v50 = 65536 / v49;
8264 v51 = outx;
8265 v143 = v48 * v50;
8266 v52 = v46 * v50;
8267 v53 = v47 * v50;
8268 v54 = pOut.x;
8269 v147 = v52;
8270 v151 = v53;
8271 v119 = pOut.x;
8272 if ( pOut.x < outx )
8273 {
8274 v123 = outx;
8275 }
8276 else
8277 {
8278 v119 = outx;
8279 v123 = pOut.x;
8280 }
8281 v55 = pOut.y;
8282 v56 = outy;
8283 v127 = pOut.y;
8284 if ( pOut.y < outy )
8285 {
8286 v131 = outy;
8287 }
8288 else
8289 {
8290 v127 = outy;
8291 v131 = pOut.y;
8292 }
8293 v57 = v163;
8294 v58 = outz;
8295 v135 = outz;
8296 if ( outz < v163 )
8297 {
8298 v139 = v163;
8299 }
8300 else
8301 {
8302 v135 = v163;
8303 v139 = outz;
8304 }
8305 a5b = 0;
8306 while ( !v114 )
8307 {
8308 if ( a5b )
8309 {
8310 v102 = v58;
8311 v100 = v55;
8312 v98 = v54;
8313 }
8314 else
8315 {
8316 v102 = v57;
8317 v100 = v56;
8318 v98 = v51;
8319 }
8320 v59 = pIndoor->GetSector(v98, v100, v102);
8321 v60 = pIndoor->pSectors;
8322 v61 = 116 * v59;
8323 sDepthb = 0;
8324 for ( i = 116 * v59;
8325 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61)
8326 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61);
8327 ++sDepthb )
8328 {
8329 v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]];
8330 if ( v62->Portal()
8331 || v119 > v62->pBounding.x2
8332 || v123 < v62->pBounding.x1
8333 || v127 > v62->pBounding.y2
8334 || v131 < v62->pBounding.y1
8335 || v135 > v62->pBounding.z2
8336 || v139 < v62->pBounding.z1
8337 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16,
8338 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16,
8339 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16,
8340 v20 = v63 + v64 + v65 == 0,
8341 v66 = v63 + v64 + v65,
8342 v107 = v63 + v64 + v65,
8343 v20) )
8344 goto LABEL_107;
8345 v67 = outz * v62->pFacePlane_old.vNormal.z;
8346 v68 = -(v62->pFacePlane_old.dist
8347 + v67
8348 + pOut.y * v62->pFacePlane_old.vNormal.y
8349 + pOut.x * v62->pFacePlane_old.vNormal.x);
8350 if ( v66 <= 0 )
8351 {
8352 if ( v62->pFacePlane_old.dist
8353 + v67
8354 + pOut.y * v62->pFacePlane_old.vNormal.y
8355 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 )
8356 goto LABEL_107;
8357 }
8358 else
8359 {
8360 if ( v62->pFacePlane_old.dist
8361 + v67
8362 + pOut.y * v62->pFacePlane_old.vNormal.y
8363 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 )
8364 goto LABEL_107;
8365 }
8366 v69 = abs(-(v62->pFacePlane_old.dist
8367 + v67
8368 + pOut.y * v62->pFacePlane_old.vNormal.y
8369 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14;
8370 if ( v69 <= abs(v66) )
8371 {
8372 LODWORD(v70) = v68 << 16;
8373 HIDWORD(v70) = v68 >> 16;
8374 v71 = v70 / v107;
8375 v108 = v70 / v107;
8376 if ( v71 >= 0 )
8377 {
8378 if ( sub_4075DB(
8379 pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16),
8380 pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16),
8381 outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16),
8382 v62) )
8383 {
8384 v114 = 1;
8385 break;
8386 }
8387 }
8388 }
8389 v61 = i;
8390 LABEL_107:
8391 v60 = pIndoor->pSectors;
8392 }
8393 ++a5b;
8394 if ( a5b >= 2 )
8395 break;
8396 v57 = v163;
8397 v56 = outy;
8398 v51 = outx;
8399 v58 = outz;
8400 v55 = pOut.y;
8401 v54 = pOut.x;
8402 }
8403 v72.z = y;
8404 *(_QWORD *)&v72.x = a4;
8405 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz);
8406 v73.z = v.z;
8407 *(_QWORD *)&v73.x = *(_QWORD *)&v;
8408 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163);
8409 v74 = outy - pOut.y;
8410 v75 = v163 - outz;
8411 v76 = outx - pOut.x;
8412 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75);
8413 v78 = 65536;
8414 if ( v77 )
8415 v78 = 65536 / v77;
8416 v79 = outx;
8417 v144 = v76 * v78;
8418 v80 = v74 * v78;
8419 v81 = v75 * v78;
8420 v82 = pOut.x;
8421 v148 = v80;
8422 v152 = v81;
8423 v120 = pOut.x;
8424 if ( pOut.x < outx )
8425 {
8426 v124 = outx;
8427 }
8428 else
8429 {
8430 v120 = outx;
8431 v124 = pOut.x;
8432 }
8433 v83 = pOut.y;
8434 v84 = outy;
8435 v128 = pOut.y;
8436 if ( pOut.y < outy )
8437 {
8438 v132 = outy;
8439 }
8440 else
8441 {
8442 v128 = outy;
8443 v132 = pOut.y;
8444 }
8445 v85 = v163;
8446 v86 = outz;
8447 v136 = outz;
8448 if ( outz < v163 )
8449 {
8450 v140 = v163;
8451 }
8452 else
8453 {
8454 v136 = v163;
8455 v140 = outz;
8456 }
8457 a5c = 0;
8458 while ( 1 )
8459 {
8460 if ( v113 )
8461 return !v114 || !v113;
8462 if ( a5c )
8463 {
8464 v103 = v86;
8465 v101 = v83;
8466 v99 = v82;
8467 }
8468 else
8469 {
8470 v103 = v85;
8471 v101 = v84;
8472 v99 = v79;
8473 }
8474 v87 = pIndoor->GetSector(v99, v101, v103);
8475 v88 = pIndoor->pSectors;
8476 v89 = 116 * v87;
8477 v162 = 0;
8478 v112 = v89;
8479 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89)
8480 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 )
8481 break;
8482 LABEL_148:
8483 ++a5c;
8484 if ( a5c >= 2 )
8485 return !v114 || !v113;
8486 v85 = v163;
8487 v84 = outy;
8488 v79 = outx;
8489 v86 = outz;
8490 v83 = pOut.y;
8491 v82 = pOut.x;
8492 }
8493 while ( 1 )
8494 {
8495 v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]];
8496 if ( v90->Portal()
8497 || v120 > v90->pBounding.x2
8498 || v124 < v90->pBounding.x1
8499 || v128 > v90->pBounding.y2
8500 || v132 < v90->pBounding.y1
8501 || v136 > v90->pBounding.z2
8502 || v140 < v90->pBounding.z1
8503 || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16,
8504 v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16,
8505 vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16,
8506 v20 = yb + vf + v_4b == 0,
8507 v91 = yb + vf + v_4b,
8508 vc = yb + vf + v_4b,
8509 v20) )
8510 goto LABEL_145;
8511 v92 = outz * v90->pFacePlane_old.vNormal.z;
8512 v93 = -(v90->pFacePlane_old.dist
8513 + v92
8514 + pOut.y * v90->pFacePlane_old.vNormal.y
8515 + pOut.x * v90->pFacePlane_old.vNormal.x);
8516 if ( v91 <= 0 )
8517 {
8518 if ( v90->pFacePlane_old.dist
8519 + v92
8520 + pOut.y * v90->pFacePlane_old.vNormal.y
8521 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 )
8522 goto LABEL_145;
8523 }
8524 else
8525 {
8526 if ( v90->pFacePlane_old.dist
8527 + v92
8528 + pOut.y * v90->pFacePlane_old.vNormal.y
8529 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 )
8530 goto LABEL_145;
8531 }
8532 v_4c = abs(-(v90->pFacePlane_old.dist
8533 + v92
8534 + pOut.y * v90->pFacePlane_old.vNormal.y
8535 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14;
8536 if ( v_4c <= abs(v91) )
8537 {
8538 LODWORD(v94) = v93 << 16;
8539 HIDWORD(v94) = v93 >> 16;
8540 v95 = v94 / vc;
8541 vd = v94 / vc;
8542 if ( v95 >= 0 )
8543 {
8544 if ( sub_4075DB(
8545 pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16),
8546 pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16),
8547 outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16),
8548 v90) )
8549 {
8550 v113 = 1;
8551 goto LABEL_148;
8552 }
8553 }
8554 }
8555 v89 = v112;
8556 LABEL_145:
8557 v88 = pIndoor->pSectors;
8558 ++v162;
8559 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89)
8560 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) )
8561 goto LABEL_148;
8562 }
8563 }
8564 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz);
8565 v5.z = v.z;
8566 *(_QWORD *)&v5.x = *(_QWORD *)&v;
8567 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163);
8568 v6 = outy - pOut.y;
8569 v7 = v163 - outz;
8570 v8 = outx - pOut.x;
8571 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7);
8572 v10 = 65536;
8573 if ( v9 )
8574 v10 = 65536 / v9;
8575 v125 = v8 * v10;
8576 v11 = v10;
8577 v12 = v7 * v10;
8578 v13 = pOut.x;
8579 v117 = v12;
8580 v121 = v6 * v11;
8581 v149 = pOut.x;
8582 if ( pOut.x < outx )
8583 {
8584 v145 = outx;
8585 }
8586 else
8587 {
8588 v149 = outx;
8589 v145 = pOut.x;
8590 }
8591 v14 = outy;
8592 v141 = pOut.y;
8593 if ( pOut.y < outy )
8594 {
8595 v137 = outy;
8596 }
8597 else
8598 {
8599 v141 = outy;
8600 v137 = pOut.y;
8601 }
8602 v133 = outz;
8603 if ( outz < v163 )
8604 {
8605 v129 = v163;
8606 }
8607 else
8608 {
8609 v133 = v163;
8610 v129 = outz;
8611 }
8612 v160 = 0;
8613 if ( (signed int)pOutdoor->uNumBModels > 0 )
8614 {
8615 v104 = 0;
8616 while ( 1 )
8617 {
8618 v15 = (char *)&pOutdoor->pBModels[v104].pVertices;
8619 a5 = (char *)&pOutdoor->pBModels[v104].pVertices;
8620 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 )
8621 {
8622 sDepth = 0;
8623 if ( *((int *)v15 + 2) > 0 )
8624 break;
8625 }
8626 LABEL_36:
8627 ++v160;
8628 ++v104;
8629 if ( v160 >= (signed int)pOutdoor->uNumBModels )
8630 goto LABEL_37;
8631 v14 = outy;
8632 v13 = pOut.x;
8633 }
8634 v106 = 0;
8635 while ( 1 )
8636 {
8637 v16 = (ODMFace *)(v106 + *((int *)a5 + 4));
8638 if ( v149 > v16->pBoundingBox.x2
8639 || v145 < v16->pBoundingBox.x1
8640 || v141 > v16->pBoundingBox.y2
8641 || v137 < v16->pBoundingBox.y1
8642 || v133 > v16->pBoundingBox.z2
8643 || v129 < v16->pBoundingBox.z1
8644 || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16,
8645 v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16,
8646 v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16,
8647 v20 = v17 + v18 + v19 == 0,
8648 v21 = v17 + v18 + v19,
8649 v109 = v17 + v18 + v19,
8650 v20) )
8651 goto LABEL_33;
8652 v22 = pOut.y * v16->pFacePlane.vNormal.y;
8653 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x);
8654 if ( v21 <= 0 )
8655 {
8656 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 )
8657 goto LABEL_33;
8658 }
8659 else
8660 {
8661 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 )
8662 goto LABEL_33;
8663 }
8664 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14;
8665 if ( v24 <= abs(v21) )
8666 {
8667 LODWORD(v25) = v23 << 16;
8668 HIDWORD(v25) = v23 >> 16;
8669 v26 = v25 / v109;
8670 v110 = v25 / v109;
8671 if ( v26 >= 0 )
8672 {
8673 if ( sub_4077F1(
8674 pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16),
8675 pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16),
8676 outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16),
8677 v16,
8678 (BSPVertexBuffer *)a5) )
8679 {
8680 v114 = 1;
8681 goto LABEL_36;
8682 }
8683 }
8684 }
8685 LABEL_33:
8686 ++sDepth;
8687 v106 += 308;
8688 if ( sDepth >= *((int *)a5 + 2) )
8689 goto LABEL_36;
8690 }
8691 }
8692 LABEL_37:
8693 v27.z = y;
8694 *(_QWORD *)&v27.x = a4;
8695 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz);
8696 v28.z = v.z;
8697 *(_QWORD *)&v28.x = *(_QWORD *)&v;
8698 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163);
8699 v29 = outy - pOut.y;
8700 v30 = v163 - outz;
8701 v31 = outx - pOut.x;
8702 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30);
8703 v33 = 65536;
8704 if ( v32 )
8705 v33 = 65536 / v32;
8706 v126 = v31 * v33;
8707 v34 = v33;
8708 v35 = v30 * v33;
8709 v36 = pOut.x;
8710 v118 = v35;
8711 v122 = v29 * v34;
8712 v150 = pOut.x;
8713 if ( pOut.x < outx )
8714 {
8715 v146 = outx;
8716 }
8717 else
8718 {
8719 v150 = outx;
8720 v146 = pOut.x;
8721 }
8722 v37 = outy;
8723 v142 = pOut.y;
8724 if ( pOut.y < outy )
8725 {
8726 v138 = outy;
8727 }
8728 else
8729 {
8730 v142 = outy;
8731 v138 = pOut.y;
8732 }
8733 v134 = outz;
8734 if ( outz < v163 )
8735 {
8736 v130 = v163;
8737 }
8738 else
8739 {
8740 v134 = v163;
8741 v130 = outz;
8742 }
8743 v161 = 0;
8744 if ( (signed int)pOutdoor->uNumBModels > 0 )
8745 {
8746 v105 = 0;
8747 while ( 1 )
8748 {
8749 v38 = (char *)&pOutdoor->pBModels[v105].pVertices;
8750 a5a = (char *)&pOutdoor->pBModels[v105].pVertices;
8751 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 )
8752 {
8753 sDeptha = 0;
8754 if ( *((int *)v38 + 2) > 0 )
8755 break;
8756 }
8757 LABEL_71:
8758 ++v161;
8759 ++v105;
8760 if ( v161 >= (signed int)pOutdoor->uNumBModels )
8761 return !v114 || !v113;
8762 v37 = outy;
8763 v36 = pOut.x;
8764 }
8765 v_8 = 0;
8766 while ( 1 )
8767 {
8768 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4));
8769 if ( v150 > v39->pBoundingBox.x2
8770 || v146 < v39->pBoundingBox.x1
8771 || v142 > v39->pBoundingBox.y2
8772 || v138 < v39->pBoundingBox.y1
8773 || v134 > v39->pBoundingBox.z2
8774 || v130 < v39->pBoundingBox.z1
8775 || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16,
8776 ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16,
8777 v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16,
8778 v20 = ya + ve + v_4 == 0,
8779 v40 = ya + ve + v_4,
8780 va = ya + ve + v_4,
8781 v20) )
8782 goto LABEL_68;
8783 v41 = pOut.y * v39->pFacePlane.vNormal.y;
8784 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x);
8785 if ( v40 <= 0 )
8786 {
8787 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 )
8788 goto LABEL_68;
8789 }
8790 else
8791 {
8792 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 )
8793 goto LABEL_68;
8794 }
8795 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14;
8796 if ( v_4a <= abs(v40) )
8797 {
8798 LODWORD(v43) = v42 << 16;
8799 HIDWORD(v43) = v42 >> 16;
8800 v44 = v43 / va;
8801 vb = v43 / va;
8802 if ( v44 >= 0 )
8803 {
8804 if ( sub_4077F1(
8805 pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16),
8806 pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16),
8807 outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16),
8808 v39,
8809 (BSPVertexBuffer *)a5a) )
8810 {
8811 v113 = 1;
8812 goto LABEL_71;
8813 }
8814 }
8815 }
8816 LABEL_68:
8817 ++sDeptha;
8818 v_8 += 308;
8819 if ( sDeptha >= *((int *)a5a + 2) )
8820 goto LABEL_71;
8821 }
8822 }
8823 return !v114 || !v113;
8824 }
8825
8826 //----- (00408768) --------------------------------------------------------
8827 void InitializeActors()
8828 {
8829 signed int v5; // [sp+Ch] [bp-10h]@1
8830 signed int v6; // [sp+10h] [bp-Ch]@1
8831 signed int v7; // [sp+14h] [bp-8h]@1
8832 signed int v8; // [sp+18h] [bp-4h]@1
8833
8834 v8 = 0;
8835 v6 = 0;
8836 v7 = 0;
8837 v5 = 0;
8838 if ( !_stricmp(pCurrentMapName.data(), "d25.blv") )
8839 v8 = 1;
8840 if ( !_stricmp(pCurrentMapName.data(), "d26.blv") )
8841 v6 = 1;
8842 if (_449B57_test_bit(pParty->_quest_bits, 99))
8843 v7 = 1;
8844 if (_449B57_test_bit(pParty->_quest_bits, 100))
8845 v5 = 1;
8846
8847 Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0; original code behaviour is identical
8848 for (uint i = 0; i < uNumActors; ++i)
8849 {
8850 auto actor = &pActors[i];
8851
8852 if (actor->CanAct() || actor->uAIState == Disabled)
8853 {
8854 actor->vPosition.x = actor->vInitialPosition.x;
8855 actor->vPosition.y = actor->vInitialPosition.y;
8856 actor->vPosition.z = actor->vInitialPosition.z;
8857 actor->sCurrentHP = actor->pMonsterInfo.uHP;
8858 if (actor->uAIState != Disabled)
8859 {
8860 Actor::AI_Stand(i, ai_near_actors_targets_pid[i], actor->pMonsterInfo.uRecoveryTime, 0);
8861 }
8862 }
8863
8864 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
8865
8866 if (!v8 || v7)
8867 if (!v6 || v5)
8868 if (actor->IsPeasant())
8869 BYTE2(actor->uAttributes) &= 0xF7u;
8870
8871 BYTE2(actor->uAttributes) &= 0x7Fu;
8872 if (BYTE2(actor->uAttributes) & 0x40)
8873 Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1);
8874 }
8875 }
8876
8877 //----- (00408896) --------------------------------------------------------
8878 void InitializeSpriteObjects()
8879 {
8880 for (uint i = 0; i < uNumSpriteObjects; ++i)
8881 {
8882 auto item = &pSpriteObjects[i];
8883
8884 if (item->uType &&
8885 (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & 0x10))
8886 SpriteObject::OnInteraction(i);
8887 }
8888
8889 for (uint i = 0; i < 100; ++i)
8890 array_5118E8.pElements[i].field_C_time_left = 0;
8891 }
8892
8893 //----- (004088E9) -------------------------------------------------------- 6610 //----- (004088E9) --------------------------------------------------------
8894 signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6) 6611 signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6)
8895 { 6612 {
8896 int v6; // esi@1 6613 int v6; // esi@1
8897 int v7; // edi@1 6614 int v7; // edi@1
8909 if ( result ) 6626 if ( result )
8910 result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result); 6627 result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result);
8911 return result; 6628 return result;
8912 } 6629 }
8913 6630
8914 //----- (00408A27) --------------------------------------------------------
8915 unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors)
8916 {
8917 unsigned int *v1; // esi@1
8918 int v2; // eax@1
8919 unsigned int v3; // ebp@1
8920 signed int v4; // ebx@1
8921 Actor *v5; // edi@2
8922 unsigned int v6; // eax@3
8923 int v8; // [sp+Ch] [bp-4h]@1
8924
8925 v1 = pTotalActors;
8926 v2 = GetAlertStatus();
8927 v3 = 0;
8928 v4 = 0;
8929 *v1 = 0;
8930 v8 = v2;
8931 if ( (signed int)uNumActors > 0 )
8932 {
8933 v5 = pActors.data();
8934 do
8935 {
8936 v6 = v5->uAttributes;
8937 if ( (v6 & 0x100000) == v8 )
8938 {
8939 ++*v1;
8940 if ( v5->IsNotAlive() == 1 )
8941 ++v3;
8942 }
8943 ++v4;
8944 ++v5;
8945 }
8946 while ( v4 < (signed int)uNumActors );
8947 }
8948 return v3;
8949 }
8950
8951 //----- (00408A7E) --------------------------------------------------------
8952 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID)
8953 {
8954 unsigned int *v2; // esi@1
8955 signed int v3; // ebx@1
8956 Actor *v4; // edi@2
8957 int v5; // eax@3
8958 int v7; // [sp+8h] [bp-Ch]@1
8959 int v8; // [sp+Ch] [bp-8h]@1
8960 unsigned int v9; // [sp+10h] [bp-4h]@1
8961
8962 v7 = uMonsterID;
8963 v2 = pTotalActors;
8964 v3 = 0;
8965 v8 = GetAlertStatus();
8966 *v2 = 0;
8967 v9 = 0;
8968 if ( (signed int)uNumActors > 0 )
8969 {
8970 v4 = pActors.data();//[0].pMonsterInfo.uID;
8971 do
8972 {
8973 v5 = v4->uAttributes; // actor::attributes
8974 if ( (v5 & 0x100000) == v8 )
8975 {
8976 if ( v4->pMonsterInfo.field_33 == v7 )
8977 {
8978 ++*v2;
8979 if ( v4->IsNotAlive() == 1 )
8980 ++v9;
8981 }
8982 }
8983 ++v3;
8984 ++v4;
8985 }
8986 while ( v3 < (signed int)uNumActors );
8987 }
8988 return v9;
8989 }
8990
8991 //----- (00408AE7) --------------------------------------------------------
8992 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup)
8993 {
8994 unsigned int *v2; // esi@1
8995 signed int v3; // ebx@1
8996 Actor *v4; // edi@2
8997 int v5; // eax@3
8998 unsigned int v7; // [sp+8h] [bp-Ch]@1
8999 int v8; // [sp+Ch] [bp-8h]@1
9000 unsigned int v9; // [sp+10h] [bp-4h]@1
9001
9002 v7 = uGroup;
9003 v2 = pTotalActors;
9004 v3 = 0;
9005 v8 = GetAlertStatus();
9006 *v2 = 0;
9007 v9 = 0;
9008 if ( (signed int)uNumActors > 0 )
9009 {
9010 v4 = pActors.data();//[0].uGroup;
9011 do
9012 {
9013 v5 = v4->uAttributes;
9014 if ( (v5 & 0x100000) == v8 )
9015 {
9016 if ( v4->uGroup == v7 )
9017 {
9018 ++*v2;
9019 if ( v4->IsNotAlive() == 1 )
9020 ++v9;
9021 }
9022 }
9023 ++v3;
9024 ++v4;
9025 }
9026 while ( v3 < (signed int)uNumActors );
9027 }
9028 return v9;
9029 }
9030
9031 //----- (00408B54) --------------------------------------------------------
9032 unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2)
9033 {
9034 unsigned int v2; // edi@1
9035 unsigned int *v3; // esi@1
9036 int v4; // eax@1
9037 unsigned int v5; // ebx@1
9038 unsigned int v6; // edx@1
9039
9040 v2 = a2;
9041 v3 = pTotalActors;
9042 v4 = GetAlertStatus();
9043 v5 = 0;
9044 *v3 = 0;
9045 v6 = pActors[v2].uAttributes;
9046 if ( (v6 & 0x100000) == v4 )
9047 {
9048 *v3 = 1;
9049 if ( pActors[v2].IsNotAlive() == 1 )
9050 v5 = 1;
9051 }
9052 return v5;
9053 }
9054
9055
9056
9057
9058
9059 //----- (0040DEDB) -------------------------------------------------------- 6631 //----- (0040DEDB) --------------------------------------------------------
9060 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) 6632 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor)
9061 { 6633 {
9062 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); 6634 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor));
9063 } 6635 }
9066 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) 6638 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b )
9067 { 6639 {
9068 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + 6640 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) +
9069 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + 6641 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) +
9070 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); 6642 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8));
9071 }
9072
9073 //----- (0040DF3D) --------------------------------------------------------
9074 void __cdecl CallRenderPresent()
9075 {
9076 pRenderer->Present();
9077 } 6643 }
9078 6644
9079 //----- (0040DFA7) -------------------------------------------------------- 6645 //----- (0040DFA7) --------------------------------------------------------
9080 int __stdcall retzero_sub_40DFA7(int a1) 6646 int __stdcall retzero_sub_40DFA7(int a1)
9081 { 6647 {
9183 if ( v3->uDecompressedSize ) 6749 if ( v3->uDecompressedSize )
9184 free(v4); 6750 free(v4);
9185 } 6751 }
9186 } 6752 }
9187 6753
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201 //----- (00410AF5) --------------------------------------------------------
9202 void __cdecl SetMoonPhaseNames()
9203 {
9204 aMoonPhaseNames[0] = pGlobalTXT_LocalizationStrings[150];
9205 aMoonPhaseNames[1] = pGlobalTXT_LocalizationStrings[171];
9206 aMoonPhaseNames[2] = pGlobalTXT_LocalizationStrings[102];
9207 aMoonPhaseNames[3] = pGlobalTXT_LocalizationStrings[169];
9208 aMoonPhaseNames[4] = pGlobalTXT_LocalizationStrings[92];
9209 }
9210
9211
9212 //----- (00410D99) -------------------------------------------------------- 6754 //----- (00410D99) --------------------------------------------------------
9213 signed int __fastcall sub_410D99_get_map_index(int a1) 6755 signed int __fastcall sub_410D99_get_map_index(int a1)
9214 { 6756 {
9215 int v1; // edi@1 6757 int v1; // edi@1
9216 signed int v2; // ebp@1 6758 signed int v2; // ebp@1
9234 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); 6776 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) );
9235 } 6777 }
9236 return v2; 6778 return v2;
9237 } 6779 }
9238 6780
9239 //----- (00410DEC) --------------------------------------------------------
9240 unsigned int __cdecl DrawLloydBeaconsScreen()
9241 {
9242 Player *pPlayer; // esi@1
9243 char *v1; // eax@1
9244 unsigned __int16 v2; // ax@6
9245 unsigned int result; // eax@11
9246 unsigned int v4; // esi@13
9247 unsigned int v5; // ecx@13
9248 char v6; // zf@13
9249 LloydBeacon *v7; // esi@14
9250 int v8; // eax@14
9251 unsigned __int64 v9; // kr08_8@14
9252 unsigned int v10; // esi@14
9253 unsigned int v11; // eax@14
9254 char *v12; // eax@19
9255 char *v13; // ecx@22
9256 int v14; // eax@27
9257 Texture *v19; // [sp-4h] [bp-8Ch]@4
9258 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
9259 unsigned int v23; // [sp+64h] [bp-24h]@14
9260 __int64 v24; // [sp+68h] [bp-20h]@14
9261 unsigned int v25; // [sp+70h] [bp-18h]@13
9262 char *Str; // [sp+74h] [bp-14h]@14
9263 int v27; // [sp+78h] [bp-10h]@11
9264 LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12
9265 RGBTexture *v29; // [sp+80h] [bp-8h]@12
9266 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
9267
9268 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
9269 pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
9270 v1 = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon
9271 pWindow.uFrameX = game_viewport_x;
9272 pWindow.uFrameY = game_viewport_y;
9273 pWindow.uFrameWidth = 428;
9274 pWindow.uFrameHeight = game_viewport_height;
9275 pWindow.uFrameZ = 435;
9276 pWindow.uFrameW = game_viewport_w;
9277 if ( !bRecallingBeacon )
9278 v1 = pGlobalTXT_LocalizationStrings[375]; // Set Beacon
9279 sprintf(pTmpBuf.data(), "%s", v1);
9280 pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3u);
9281 if ( bRecallingBeacon )
9282 {
9283 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
9284 v19 = pTex_tab_an_6a__zoom_off;
9285 }
9286 else
9287 {
9288 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off);
9289 v19 = pTex_tab_an_6b__zoom_on;
9290 }
9291 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
9292 v2 = pPlayer->pActiveSkills[14];
9293 uNumMaxBeacons = 1;
9294 if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 )
9295 {
9296 uNumMaxBeacons = 5;
9297 }
9298 else
9299 {
9300 if ( v2 & 0x40 )
9301 uNumMaxBeacons = 3;
9302 }
9303 result = 0;
9304 v27 = 0;
9305 if ( uNumMaxBeacons > 0 )
9306 {
9307 v29 = pSavegameThumbnails.data();
9308 v28 = pPlayer->pInstalledBeacons;
9309 while ( 1 )
9310 {
9311 pWindow.uFrameWidth = 92;
9312 v4 = result;
9313 pWindow.uFrameHeight = 68;
9314 v5 = pLloydsBeaconsPreviewXs[result];
9315 pWindow.uFrameY = pLloydsBeaconsPreviewYs[result];
9316 v25 = pWindow.uFrameY;
9317 pWindow.uFrameX = v5;
9318 pWindow.uFrameW = pWindow.uFrameY + 67;
9319 v6 = v29->pPixels == 0;
9320 pWindow.uFrameZ = v5 + 91;
9321 if ( !v6 )
9322 break;
9323 if ( !bRecallingBeacon )
9324 {
9325 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
9326 v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
9327 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);
9328 }
9329 LABEL_29:
9330 ++v29;
9331 ++v28;
9332 result = v27++ + 1;
9333 if ( v27 >= uNumMaxBeacons )
9334 goto LABEL_30;
9335 }
9336 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
9337 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29);
9338 v7 = v28;
9339 Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName;
9340 v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
9341 pWindow.uFrameY += -6 - v8;
9342 pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u);
9343 v9 = v7->uBeaconTime - pParty->uTimePlayed;
9344 LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed);
9345 HIDWORD(v24) = HIDWORD(v9);
9346 v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32;
9347 v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60;
9348 v11 = v10 / 0x18;
9349 if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 )
9350 {
9351 v13 = pGlobalTXT_LocalizationStrings[57]; // Days
9352 if ( v11 > 1 )
9353 {
9354 sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
9355 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
9356 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
9357 goto LABEL_29;
9358 }
9359 }
9360 else
9361 {
9362 if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 )
9363 {
9364 if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 )
9365 v12 = pGlobalTXT_LocalizationStrings[109];// Hour
9366 else
9367 v12 = pGlobalTXT_LocalizationStrings[110];// Hours
9368 sprintf(pTmpBuf.data(), "%lu %s", v10 + 1, v12);
9369 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
9370 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
9371 goto LABEL_29;
9372 }
9373 }
9374 v13 = pGlobalTXT_LocalizationStrings[56]; // Day
9375 sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
9376 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
9377 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
9378 goto LABEL_29;
9379 }
9380 LABEL_30:
9381 if ( byte_506360 )
9382 {
9383 /*result = pMessageQueue_50CBD0->uNumMessages;
9384 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
9385 {
9386 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon;
9387 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
9388 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
9389 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
9390 ++pMessageQueue_50CBD0->uNumMessages;
9391 }*/
9392 pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
9393 }
9394 return result;
9395 }
9396
9397
9398 //----- (00413FF1) --------------------------------------------------------
9399 void SetMonthNames()
9400 {
9401 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415];
9402 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416];
9403 aMonthNames[2] = pGlobalTXT_LocalizationStrings[417];
9404 aMonthNames[3] = pGlobalTXT_LocalizationStrings[418];
9405 aMonthNames[4] = pGlobalTXT_LocalizationStrings[419];
9406 aMonthNames[5] = pGlobalTXT_LocalizationStrings[420];
9407 aMonthNames[6] = pGlobalTXT_LocalizationStrings[421];
9408 aMonthNames[7] = pGlobalTXT_LocalizationStrings[422];
9409 aMonthNames[8] = pGlobalTXT_LocalizationStrings[423];
9410 aMonthNames[9] = pGlobalTXT_LocalizationStrings[424];
9411 aMonthNames[10] = pGlobalTXT_LocalizationStrings[425];
9412 aMonthNames[11] = pGlobalTXT_LocalizationStrings[426];
9413 }
9414
9415 //----- (0041406F) --------------------------------------------------------
9416 void SetDayNames()
9417 {
9418 aDayNames[0] = pGlobalTXT_LocalizationStrings[145];
9419 aDayNames[1] = pGlobalTXT_LocalizationStrings[230];
9420 aDayNames[2] = pGlobalTXT_LocalizationStrings[243];
9421 aDayNames[3] = pGlobalTXT_LocalizationStrings[227];
9422 aDayNames[4] = pGlobalTXT_LocalizationStrings[91];
9423 aDayNames[5] = pGlobalTXT_LocalizationStrings[188];
9424 aDayNames[6] = pGlobalTXT_LocalizationStrings[222];
9425 }
9426
9427 //----- (004140BB) --------------------------------------------------------
9428 void SetSpellSchoolNames()
9429 {
9430 aSpellSchoolNames[0] = pGlobalTXT_LocalizationStrings[87];
9431 aSpellSchoolNames[1] = pGlobalTXT_LocalizationStrings[6];
9432 aSpellSchoolNames[2] = pGlobalTXT_LocalizationStrings[240];
9433 aSpellSchoolNames[3] = pGlobalTXT_LocalizationStrings[70];
9434 aSpellSchoolNames[4] = pGlobalTXT_LocalizationStrings[214];
9435 aSpellSchoolNames[5] = pGlobalTXT_LocalizationStrings[142];
9436 aSpellSchoolNames[6] = pGlobalTXT_LocalizationStrings[29];
9437 aSpellSchoolNames[7] = pGlobalTXT_LocalizationStrings[133];
9438 aSpellSchoolNames[8] = pGlobalTXT_LocalizationStrings[54];
9439 }
9440
9441 //----- (0041411B) --------------------------------------------------------
9442 void SetAttributeNames()
9443 {
9444 aAttributeNames[0] = pGlobalTXT_LocalizationStrings[144];
9445 aAttributeNames[1] = pGlobalTXT_LocalizationStrings[116];
9446 aAttributeNames[2] = pGlobalTXT_LocalizationStrings[163];
9447 aAttributeNames[3] = pGlobalTXT_LocalizationStrings[75];
9448 aAttributeNames[4] = pGlobalTXT_LocalizationStrings[1];
9449 aAttributeNames[5] = pGlobalTXT_LocalizationStrings[211];
9450 aAttributeNames[6] = pGlobalTXT_LocalizationStrings[136];
9451 }
9452
9453 //----- (00414162) --------------------------------------------------------
9454 void uGameUIFontMain_initialize()
9455 {
9456 uGameUIFontMain = TargetColor(0xAu, 0, 0);
9457 }
9458
9459 //----- (00414174) --------------------------------------------------------
9460 void uGameUIFontShadow_initialize()
9461 {
9462 uGameUIFontShadow = TargetColor(0xE6u, 214u, 193u);
9463 }
9464
9465
9466
9467
9468 //----- (0041420D) --------------------------------------------------------
9469 void __cdecl sub_41420D_press_esc()
9470 {
9471 GUIWindow v0; // [sp+4h] [bp-54h]@1
9472
9473 sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
9474 v0.Hint = pTmpBuf2.data();
9475 v0.uFrameWidth = 400;
9476 v0.uFrameHeight = 100;
9477 v0.uFrameX = 120;
9478 v0.uFrameY = 140;
9479 v0.uFrameZ = 519;
9480 v0.uFrameW = 239;
9481 v0.DrawMessageBox(0);
9482 }
9483
9484 //----- (0041426F) --------------------------------------------------------
9485 void __cdecl sub_41426F()
9486 {
9487 GUIWindow *v0; // ecx@1
9488
9489 v0 = ptr_507BDC;
9490 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0);
9491
9492 v0->Release();
9493 ptr_507BDC = 0;
9494 pCurrentScreen = dword_506F0C[0];
9495 pEventTimer->Resume();
9496 }
9497 // 4E28F8: using guessed type int pCurrentScreen; 6781 // 4E28F8: using guessed type int pCurrentScreen;
9498
9499
9500 6782
9501 void LoadFonts_and_DrawCopyrightWindow() 6783 void LoadFonts_and_DrawCopyrightWindow()
9502 { 6784 {
9503 MainMenuUI_LoadFontsAndSomeStuff(); 6785 MainMenuUI_LoadFontsAndSomeStuff();
9504 DrawCopyrightWindow(); 6786 DrawCopyrightWindow();
9505 } 6787 }
9506 6788
9507 //----- (00415485) --------------------------------------------------------
9508 void DrawCopyrightWindow()
9509 {
9510 GUIWindow Dst; // [sp+8h] [bp-54h]@1
9511
9512 memset(&Dst, 0, 0x54u);
9513 Dst.uFrameWidth = 624;
9514 Dst.uFrameHeight = 256;
9515 Dst.uFrameX = 8;
9516 Dst.uFrameY = 30; // c 1999 The 3DO Company.
9517 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0)
9518 + 2 * LOBYTE(pFontSmallnum->uFontHeight)
9519 + 24;
9520 Dst.uFrameY = 470 - Dst.uFrameHeight;
9521 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
9522 Dst.uFrameW = 469;
9523 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef";
9524 Dst.DrawMessageBox(0);
9525
9526 Dst.uFrameWidth -= 24;
9527 Dst.uFrameX += 12;
9528 Dst.uFrameY += 12;
9529 Dst.uFrameHeight -= 12;
9530 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
9531 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
9532 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
9533 }
9534
9535
9536
9537 //----- (004156F0) --------------------------------------------------------
9538 void GUI_UpdateWindows()
9539 {
9540 GUIWindow *pWindow; // esi@4
9541 //unsigned int pWindowType; // eax@4
9542 const char *pHint; // edx@66
9543 GUIButton *pButtonPtr_1C; // ebp@79
9544 char *pHint1; // edx@80
9545 int v26; // eax@98
9546 unsigned int v27; // ebp@106
9547 GUIWindow *pGUIWindow2; // ecx@109
9548 GUIFont *pGUIFont; // ST1C_4@115
9549 int v31; // eax@115
9550 GUIButton *pButton; // ebp@118
9551 int v39; // eax@129
9552 unsigned int pNumMessages; // eax@142
9553 GUIButton *pGUIButton; // ebp@146
9554 //unsigned int pX; // [sp-1Ch] [bp-124h]@17
9555 //unsigned int pY; // [sp-18h] [bp-120h]@17
9556 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17
9557 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86
9558 int i; // [sp+0h] [bp-108h]@3
9559 ItemGen pItemGen; // [sp+4h] [bp-104h]@98
9560 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133
9561 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129
9562
9563 if (GetCurrentMenuID() != MENU_CREATEPARTY)
9564 UI_OnKeyDown(VK_NEXT);
9565
9566 for ( i = 1; i <= uNumVisibleWindows; ++i )
9567 {
9568 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
9569 switch (pWindow->eWindowType)
9570 {
9571 case WINDOW_OptionsButtons:
9572 {
9573 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y,
9574 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options));
9575 viewparams->bRedrawGameUI = 1;
9576 continue;
9577 }
9578 case WINDOW_CharacterRecord:
9579 {
9580 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
9581 continue;
9582 }
9583 case WINDOW_Options:
9584 {
9585 GameMenuUI_Options_Draw();
9586 continue;
9587 }
9588 case WINDOW_Book:
9589 {
9590 BookUI_Draw((WindowType)(int)pWindow->ptr_1C);
9591 continue;
9592 }
9593 case WINDOW_Dialogue:
9594 {
9595 GameUI_DrawDialogue();
9596 continue;
9597 }
9598 case WINDOW_QuickReference:
9599 {
9600 GameUI_QuickRef_Draw();
9601 continue;
9602 }
9603 case WINDOW_Rest:
9604 {
9605 RestUI_Draw();
9606 continue;
9607 }
9608 case WINDOW_ChangeLocation:
9609 {
9610 TravelUI_Draw();
9611 continue;
9612 }
9613 case WINDOW_SpellBook:
9614 {
9615 DrawSpellBookContent(pPlayers[uActiveCharacter]);
9616 continue;
9617 }
9618 case WINDOW_GreetingNPC:
9619 {
9620 GameUI_DrawBranchlessDialogue();
9621 continue;
9622 }
9623 case WINDOW_Chest:
9624 {
9625 if ( pCurrentScreen == SCREEN_CHEST )
9626 {
9627 Chest::DrawChestUI((unsigned int)pWindow->ptr_1C);
9628 }
9629 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
9630 {
9631 pRenderer->ClearZBuffer(0, 479);
9632 draw_leather();
9633 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
9634 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId));
9635 }
9636 continue;
9637 }
9638 case WINDOW_SaveLoadButtons:
9639 {
9640 SaveUI_Draw();
9641 continue;
9642 }
9643 case WINDOW_MainMenu_Load:
9644 {
9645 LoadUI_Draw();
9646 continue;
9647 }
9648 case WINDOW_HouseInterior:
9649 {
9650 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
9651 if ( !window_SpeakInHouse )
9652 continue;
9653 if ( (signed int)window_SpeakInHouse->ptr_1C >= 53 )
9654 continue;
9655 if ( pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] <=pParty->uTimePlayed )
9656 {
9657 if ( (signed int)window_SpeakInHouse->ptr_1C < 53 )
9658 {
9659 pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] = 0;
9660 }
9661 continue;
9662 }
9663 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
9664 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
9665 continue;
9666 }
9667 case WINDOW_Transition:
9668 {
9669 TransitionUI_Draw();
9670 continue;
9671 }
9672 case WINDOW_Scroll:
9673 {
9674 CreateScrollWindow();
9675 continue;
9676 }
9677 case WINDOW_CastSpell_InInventory:
9678 {
9679 pRenderer->ClearZBuffer(0, 479);
9680 draw_leather();
9681 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
9682 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]);
9683 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
9684 continue;
9685 }
9686 case WINDOW_FinalWindow:
9687 {
9688 sub_41420D_press_esc();
9689 continue;
9690 }
9691 case WINDOW_50:
9692 {
9693 v27 = TargetColor(255, 255, 255);
9694 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
9695 {
9696 ptr_507BD0->DrawMessageBox(0);
9697 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
9698 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
9699 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
9700 continue;
9701 }
9702 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
9703 {
9704 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
9705 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
9706 pEventTimer->Resume();
9707 ptr_507BD0->Release();
9708 pCurrentScreen = SCREEN_GAME;
9709 viewparams->bRedrawGameUI = true;
9710 continue;
9711 }
9712 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
9713 {
9714 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
9715 pEventTimer->Resume();
9716 ptr_507BD0->Release();
9717 continue;
9718 }
9719 }
9720 case WINDOW_59:
9721 {
9722 pWindow->DrawMessageBox(0);
9723 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
9724 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
9725 if ( !pKeyActionMap->field_204 )
9726 {
9727 ItemGen2.Reset();
9728 pWindow->Release();
9729 pEventTimer->Resume();
9730 pCurrentScreen = 0;
9731 viewparams->bRedrawGameUI = true;
9732 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
9733 if ( v26 > 0 )
9734 {
9735 if ( v26 < 800 )
9736 {
9737 ItemGen2.uAttributes |= 1u;
9738 ItemGen2.uItemID = v26;
9739 if ( pItemsTable->pItems[v26].uEquipType == 12 )
9740 {
9741 ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1;
9742 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges);
9743 }
9744 else
9745 {
9746 if ( v26 >= 221 && v26 < 271 )
9747 ItemGen2.uEnchantmentType = rand() % 10 + 1;
9748 }
9749 pItemsTable->SetSpecialBonus(&ItemGen2);
9750 pParty->SetHoldingItem(&ItemGen2);
9751 }
9752 }
9753 }
9754 continue;
9755 }
9756 case WINDOW_PressedButton2:
9757 {
9758 if ( pWindow->Hint != (char *)1 )
9759 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
9760 pButton = (GUIButton *)pWindow->ptr_1C;
9761 if ( pButton->uX >= 0 && pButton->uX <= 640 )
9762 {
9763 if ( pButton->uY >= 0 && pButton->uY <= 480 )
9764 {
9765 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
9766 viewparams->bRedrawGameUI = 1;
9767 if ( pWindow->Hint )
9768 {
9769 if ( pWindow->Hint != (char *)1 )
9770 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
9771 }
9772 pWindow->Release();
9773 continue;
9774 }
9775 }
9776 viewparams->bRedrawGameUI = 1;
9777 if ( pWindow->Hint )
9778 {
9779 if ( pWindow->Hint != (char *)1 )
9780 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
9781 }
9782 pWindow->Release();
9783 continue;
9784 }
9785 case WINDOW_CharactersPressedButton:
9786 {
9787 if ( pWindow->Hint != (char *)1 )
9788 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
9789 pButton = (GUIButton *)pWindow->ptr_1C;
9790 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
9791 viewparams->bRedrawGameUI = 1;
9792 if ( pWindow->Hint )
9793 {
9794 if ( pWindow->Hint != (char *)1 )
9795 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
9796 }
9797 pWindow->Release();
9798 continue;
9799 }
9800 case WINDOW_PressedButton:
9801 {
9802 if ( pWindow->Hint != (char *)1 )
9803 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
9804 pButton = (GUIButton *)pWindow->ptr_1C;
9805 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
9806 viewparams->bRedrawGameUI = 1;
9807 if ( pWindow->Hint )
9808 {
9809 if ( pWindow->Hint != (char *)1 )
9810 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
9811 }
9812 pWindow->Release();
9813 continue;
9814 }
9815 case WINDOW_5D:
9816 {
9817 if ( pWindow->Hint != (char *)1 )
9818 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
9819 pButton = (GUIButton *)pWindow->ptr_1C;
9820 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
9821 viewparams->bRedrawGameUI = 1;
9822 pWindow->Release();
9823 continue;
9824 }
9825 case WINDOW_SaveLoadBtn:
9826 {
9827 if (pWindow->Hint != (char *)1)
9828 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
9829 pButton = (GUIButton *)pWindow->ptr_1C;
9830 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
9831 pHint = pWindow->Hint;
9832 viewparams->bRedrawGameUI = 1;
9833 if ( pHint && pHint != (char *)1 )
9834 pButton->DrawLabel(pHint, pFontCreate, 0, 0);
9835 pWindow->Release();
9836 if (pCurrentScreen == SCREEN_SAVEGAME)
9837 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
9838 else
9839 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
9840 continue;
9841 }
9842 case WINDOW_LoadGame_CancelBtn:
9843 {
9844 if ( pWindow->Hint != (char *)1 )
9845 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
9846 pButton = (GUIButton *)pWindow->ptr_1C;
9847 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
9848 viewparams->bRedrawGameUI = 1;
9849 if ( pWindow->Hint && pWindow->Hint != (char *)1 )
9850 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
9851 pWindow->Release();
9852 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
9853 continue;
9854 }
9855 case WINDOW_CloseRestWindowBtn:
9856 {
9857 if ( pWindow->Hint != (char *)1 )
9858 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
9859 pGUIButton = (GUIButton *)pWindow->ptr_1C;
9860 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]);
9861 pHint = pWindow->Hint;
9862 viewparams->bRedrawGameUI = 1;
9863 if ( pHint && pHint != (char *)1 )
9864 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0);
9865 pWindow->Release();
9866 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
9867 continue;
9868 }
9869 case WINDOW_ExitCharacterWindow:
9870 {
9871 if ( pWindow->Hint != (char *)1 )
9872 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
9873 pButton = (GUIButton *)pWindow->ptr_1C;
9874 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
9875 pHint = pWindow->Hint;
9876 viewparams->bRedrawGameUI = 1;
9877 if ( pHint && pHint != (char *)1 )
9878 pButton->DrawLabel(pHint, pFontCreate, 0, 0);
9879 pWindow->Release();
9880 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
9881 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
9882 continue;
9883 }
9884 case WINDOW_RestWindow:
9885 {
9886 memset(&GUIButton2, 0, 0xBCu);
9887 GUIButton2.uZ = 197;
9888 GUIButton2.uW = 197;
9889 GUIButton2.uX = 27;
9890 GUIButton2.uY = 161;
9891 GUIButton2.uWidth = 171;
9892 GUIButton2.uHeight = 37;
9893 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
9894 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
9895 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15));
9896 viewparams->bRedrawGameUI = 1;
9897 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов
9898 GUIButton2.pParent = 0;
9899 pGUIWindow2 = pWindow;
9900 pGUIWindow2->Release();
9901 continue;
9902 }
9903 case WINDOW_BooksWindow:
9904 {
9905 pButton = (GUIButton *)pWindow->ptr_1C;
9906 pRenderer->DrawTextureIndexed(pWindow->uFrameY,
9907 pWindow->uFrameX, pButton->pTextures[0]);
9908 viewparams->bRedrawGameUI = true;
9909 continue;
9910 }
9911 case WINDOW_CharacterWindow_Inventory:
9912 {
9913 pWindow->DrawMessageBox(0);
9914 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
9915 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
9916 if ( !pKeyActionMap->field_204 )
9917 {
9918 ItemGen2.Reset();
9919 pWindow->Release();
9920 pEventTimer->Resume();
9921 pCurrentScreen = SCREEN_GAME;
9922 viewparams->bRedrawGameUI = 1;
9923 v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
9924 if ( v39 > 0 )
9925 {
9926 if ( v39 < 800 )
9927 SpawnActor(v39);
9928 }
9929 }
9930 continue;
9931 }
9932 case WINDOW_KeyMappingOptions:
9933 {
9934 GameMenuUI_DrawKeyBindings();
9935 continue;
9936 }
9937 case WINDOW_VideoOptions:
9938 {
9939 GameMenuUI_DrawVideoOptions();
9940 continue;
9941 }
9942 default:
9943 {
9944 continue;
9945 }
9946 }
9947 }
9948 if ( GetCurrentMenuID() == -1 )
9949 GameUI_DrawFoodAndGold();
9950 if ( sub_4637E0_is_there_popup_onscreen() )
9951 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
9952 }
9953 6789
9954 //----- (00416196) -------------------------------------------------------- 6790 //----- (00416196) --------------------------------------------------------
9955 void identify_item() 6791 void identify_item()
9956 { 6792 {
9957 Player *v0; // esi@2 6793 Player *v0; // esi@2
10375 v0->PlaySound(SPEECH_16, 0); 7211 v0->PlaySound(SPEECH_16, 0);
10376 dword_4E455C = 0; 7212 dword_4E455C = 0;
10377 } 7213 }
10378 } 7214 }
10379 7215
10380 //----- (004178FE) --------------------------------------------------------
10381 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2)
10382 {
10383 unsigned __int16 v2; // dx@2
10384 unsigned __int16 v3; // cx@2
10385 int v5; // eax@5
10386 unsigned __int16 v6; // [sp-4h] [bp-8h]@2
10387
10388 if ( a1 <= a2 )
10389 {
10390 if ( a1 == a2 )
10391 return 0;
10392 v5 = 100 * a1 / a2;
10393 v3 = 255;
10394 if ( v5 >= 25 )
10395 {
10396 v6 = 100;
10397 v2 = 255;
10398 }
10399 else
10400 {
10401 v6 = 0;
10402 v2 = 0;
10403 }
10404 }
10405 else
10406 {
10407 v6 = 0;
10408 v2 = 255;
10409 v3 = 0;
10410 }
10411 return TargetColor(v3, v2, v6);
10412 }
10413
10414 //----- (00417939) --------------------------------------------------------
10415 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx)
10416 {
10417 unsigned int v1; // ebx@1
10418 signed int v2; // edi@1
10419 unsigned int v3; // esi@1
10420 unsigned int v4; // eax@1
10421 unsigned int v6; // [sp+Ch] [bp-4h]@1
10422
10423 v1 = uConditionIdx;
10424 v2 = 65535;
10425 v3 = TargetColor(0xE1u, 0xCDu, 0x23u);
10426 v6 = TargetColor(0xFFu, 0x23u, 0);
10427 v4 = TargetColor(0, 0xFFu, 0);
10428 switch ( v1 )
10429 {
10430 case 0u:
10431 case 1u:
10432 case 3u:
10433 case 4u:
10434 case 5u:
10435 case 6u:
10436 case 7u:
10437 v2 = v4;
10438 break;
10439 case 2u:
10440 case 8u:
10441 case 9u:
10442 case 0xCu:
10443 case 0xDu:
10444 v2 = v3;
10445 break;
10446 case 0xAu:
10447 case 0xBu:
10448 case 0xEu:
10449 case 0xFu:
10450 case 0x10u:
10451 v2 = v6;
10452 break;
10453 default:
10454 return v2;
10455 }
10456 return v2;
10457 }
10458
10459 //----- (004179BC) -------------------------------------------------------- 7216 //----- (004179BC) --------------------------------------------------------
10460 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 ) 7217 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 )
10461 { 7218 {
10462 const char *v2; // ebx@1 7219 const char *v2; // ebx@1
10463 const char *v3; // edi@1 7220 const char *v3; // edi@1