Mercurial > mm7
changeset 1419:9a1adf08f4ed
more label cleaning 2
author | zipi |
---|---|
date | Sun, 28 Jul 2013 18:54:40 +0100 |
parents | 483b1b453986 |
children | e11c498c0dc6 |
files | mm7_4.cpp mm7_5.cpp mm7_6.cpp |
diffstat | 3 files changed, 197 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
--- a/mm7_4.cpp Sun Jul 28 17:45:21 2013 +0100 +++ b/mm7_4.cpp Sun Jul 28 18:54:40 2013 +0100 @@ -389,37 +389,41 @@ } v22 = 0; v38 = v5; - if ( v39 <= (signed int)v5 ) - goto LABEL_54; - v23 = 0; - do + if ( v39 > (signed int)v5 ) { - v24 = dword_720F20[v5 / 4]; - v25 = *(int *)((char *)dword_720F20.data() + v23); - if ( v24 == v25 ) - goto LABEL_50; - if ( v25 > a3 + 15 ) - { - if ( v24 >= v25 ) - goto LABEL_51; -LABEL_50: - v22 = v38; - v23 = v5; - goto LABEL_51; - } - if ( v24 > v25 && v24 <= a3 + 15 ) - goto LABEL_50; -LABEL_51: - ++v38; - v5 += 4; + v23 = 0; + do + { + v24 = dword_720F20[v5 / 4]; + v25 = *(int *)((char *)dword_720F20.data() + v23); + if ( v24 == v25 ) + { + v22 = v38; + v23 = v5; + } + else if ( v25 > a3 + 15 ) + { + if ( v24 < v25 ) + { + v22 = v38; + v23 = v5; + } + } + else if ( v24 > v25 && v24 <= a3 + 15 ) + { + v22 = v38; + v23 = v5; + } + ++v38; + v5 += 4; + } + while ( v38 < v39 ); + if ( v22 ) + { + *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); + return dword_720F20[v22]; + } } - while ( v38 < v39 ); - if ( v22 ) - { - *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); - return dword_720F20[v22]; - } -LABEL_54: *(int *)a4 = 0; return dword_720F20[v22]; } @@ -1231,6 +1235,7 @@ || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) { v58 = 0; + v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); } else { @@ -1245,12 +1250,13 @@ strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]); GameUI_Footer_TimeLeft = 128; } - goto LABEL_39; } - v13 = pPlayers[v12]; + else + { + v13 = pPlayers[v12]; + v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); + } } - v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); -LABEL_39: ++v12; if ( v12 > 4 ) { @@ -1299,18 +1305,19 @@ if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) { - if ( v22 >= 1 ) - goto LABEL_59; - v59 = 0; - v56 = 13; + if ( v22 < 1 ) + { + v59 = 0; + v56 = 13; + v21->SetCondition(v56, v59); + } } else { v59 = 0; v56 = 14; + v21->SetCondition(v56, v59); } - v21->SetCondition(v56, v59); -LABEL_59: v23 = (int)&v21->field_E0; if ( v21->field_E0 ) { @@ -1598,7 +1605,6 @@ result = 0; if ( (signed int)this->uNumFrames <= 0 ) { -LABEL_5: result = 0; } else @@ -1609,7 +1615,7 @@ ++result; ++v4; if ( (signed int)result >= (signed int)_uNumFrames ) - goto LABEL_5; + return 0; } } return result; @@ -1851,7 +1857,11 @@ dword_AE336C = a1; v10 = 0; if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) - goto LABEL_17; + { + v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; + } + else + { v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); do { @@ -1870,8 +1880,8 @@ if ( v8 && v8 != v7 ) v3 = v8 + rand() % (v7 - v8); else -LABEL_17: v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; + } } dword_AE3370 = v3; return pNPCStats->pNPCNames[0][v11 + 2 * v3]; @@ -2093,10 +2103,34 @@ goto _continue_strcat; case 11: v25 = GetPartyReputation(); - goto LABEL_46; + if ( v25 >= 25 ) + { + v11 = pGlobalTXT_LocalizationStrings[379]; + } + else + { + if ( v25 < 6 ) + { + if ( v25 >= -5 ) + { + v11 = pGlobalTXT_LocalizationStrings[399]; + } + else + { + if ( v25 < -24 ) + v11 = pGlobalTXT_LocalizationStrings[434]; + else + v11 = pGlobalTXT_LocalizationStrings[402]; + } + } + else + { + v11 = pGlobalTXT_LocalizationStrings[392]; + } + } + goto _continue_strcat; case 12: v25 = npc->rep; -LABEL_46: if ( v25 >= 25 ) { v11 = pGlobalTXT_LocalizationStrings[379];
--- a/mm7_5.cpp Sun Jul 28 17:45:21 2013 +0100 +++ b/mm7_5.cpp Sun Jul 28 18:54:40 2013 +0100 @@ -4712,7 +4712,7 @@ v19 = 0; v29 = 0; if ( v17 <= 0 ) - goto LABEL_29; + return 0; do { if ( a3a >= 2 ) @@ -4747,7 +4747,6 @@ while ( v29 < v28 ); result = 1; if ( a3a != 1 ) -LABEL_29: result = 0; return result; } @@ -4847,7 +4846,7 @@ v25 = 0; v16 = dword_4F5B24_ys[1] >= a3; if ( v15 <= 0 ) - goto LABEL_29; + return 0; do { if ( a5a >= 2 ) @@ -4882,7 +4881,6 @@ while ( v25 < v15 ); result = 1; if ( a5a != 1 ) -LABEL_29: result = 0; return result; } @@ -5193,14 +5191,22 @@ { v35 = v27->uAttributes; if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } LOWORD(v35) = v35 | 0x210; v27->uAttributes = v35; } else { if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) { v27->UpdateTempBonus(pParty->uTimePlayed); @@ -5211,7 +5217,11 @@ || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v33 >= 500 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; a2.y = (int)v29 << 7; v31 = (double)(signed int)((int)v29 << 7); @@ -5227,7 +5237,11 @@ || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v30 >= 500 ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } a2.y = (int)v29 << 7; v27->uSpecEnchantmentType = 40; v31 = (double)a2.y; @@ -5240,7 +5254,9 @@ v27->uAttributes = v32; } _50C9A8_item_enchantment_timer = 256; - goto LABEL_92; + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; } v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; if ( v36 < 0.0 ) @@ -5254,7 +5270,9 @@ v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); v27->uMaxCharges = v37; v27->uNumCharges = (unsigned __int8)v37; - goto LABEL_92; + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; } v14 = v13 - 222; v15 = pParty->pPickedItem.uItemID - 222; @@ -5395,9 +5413,16 @@ if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) - goto LABEL_92; + { + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; + } v0->PlaySound(SPEECH_16, 0); - goto LABEL_91; + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + dword_50CDCC = 1; + return; } if ( v45 ) { @@ -5436,10 +5461,8 @@ if ( v0->CanAct() ) v0->PlaySound(SPEECH_17, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); -LABEL_91: dword_4E455C = 0; } -LABEL_92: pMouse->RemoveHoldingItem(); dword_50CDCC = 1; return;
--- a/mm7_6.cpp Sun Jul 28 17:45:21 2013 +0100 +++ b/mm7_6.cpp Sun Jul 28 18:54:40 2013 +0100 @@ -127,7 +127,20 @@ { v11 = 0; v12 = *(float *)v4 == *((float *)v7 - 5); - goto LABEL_19; + if ( ! (v12 | v11) ) + { + v26 += 48; + ++v24; + v25 += 48; + v27 += 48; + v28 += 48; + v5 += 48; + v4 += 48; + ++v22; + v23 += 48; + v21 = v5; + v20 = v4; + } } } else @@ -136,13 +149,22 @@ { v11 = 0; v12 = *(float *)v4 == *((float *)v7 + 7); -LABEL_19: - if ( v12 | v11 ) - goto LABEL_21; - goto LABEL_20; + if ( !(v12 | v11) ) + { + v26 += 48; + ++v24; + v25 += 48; + v27 += 48; + v28 += 48; + v5 += 48; + v4 += 48; + ++v22; + v23 += 48; + v21 = v5; + v20 = v4; + } } } -LABEL_20: v26 += 48; ++v24; v25 += 48; @@ -155,7 +177,6 @@ v21 = v5; v20 = v4; } -LABEL_21: if ( v19 ) { v13 = v24; @@ -328,28 +349,34 @@ v14 = 0; if ( v3 ) { - if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) - goto LABEL_9; - do - { - ++v2; - v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; - } - while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); + if ( pActor->pMonsterInfo.uTreasureDiceRolls ) + { + do + { + ++v2; + v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; + } + while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); + if ( v14 ) + { + party_finds_gold(v14, 0); + viewparams->bRedrawGameUI = 1; + } + } } else { - if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) - goto LABEL_9; - v14 = pActor->array_000234[3].uSpecEnchantmentType; - pActor->array_000234[3].Reset(); + if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType == 18 ) + { + v14 = pActor->array_000234[3].uSpecEnchantmentType; + pActor->array_000234[3].Reset(); + if ( v14 ) + { + party_finds_gold(v14, 0); + viewparams->bRedrawGameUI = 1; + } + } } - if ( v14 ) - { - party_finds_gold(v14, 0); - viewparams->bRedrawGameUI = 1; - } -LABEL_9: if ( pActor->uCarriedItemID ) { Dst.Reset(); @@ -394,7 +421,6 @@ } pActor->array_000234[1].Reset(); } -LABEL_55: pActor->Remove(); return; } @@ -455,7 +481,9 @@ pActor->array_000234[1].Reset(); } if ( !v13 || rand() % 100 < 90 ) - goto LABEL_55; + { + pActor->Remove(); + } } //----- (00426E10) -------------------------------------------------------- @@ -624,7 +652,7 @@ } while ( v17 ^ v18 ); if ( v2 ) - goto LABEL_61; + return v23[rand() % v2]; } v19 = 0; do @@ -636,7 +664,6 @@ } while ( v19 < 4 ); if ( v2 ) -LABEL_61: result = v23[rand() % v2]; else result = 0; @@ -860,6 +887,8 @@ { v14 = a4 + v9; v15 = ((v7 + 15) >> 1) + v7 + 15; + v13 = __OFSUB__(v14, v15); + v12 = v14 - v15 < 0; } else { @@ -869,14 +898,15 @@ v11 = v7 + 15; v13 = __OFSUB__(v10, v11); v12 = v10 - v11 < 0; - goto LABEL_16; } - v14 = a4 + v9; - v15 = 2 * v7 + 30; + else + { + v14 = a4 + v9; + v15 = 2 * v7 + 30; + v13 = __OFSUB__(v14, v15); + v12 = v14 - v15 < 0; + } } - v13 = __OFSUB__(v14, v15); - v12 = v14 - v15 < 0; -LABEL_16: if ( v12 ^ v13 ) result = 0; else @@ -981,25 +1011,29 @@ break; case 0: v6 = pActor->pMonsterInfo.uResFire; - goto LABEL_12; + v4 = v5; + break; case 1: v6 = pActor->pMonsterInfo.uResAir; - goto LABEL_12; + v4 = v5; + break; case 2: v6 = pActor->pMonsterInfo.uResWater; - goto LABEL_12; + v4 = v5; + break; case 3: v6 = pActor->pMonsterInfo.uResEarth; - goto LABEL_12; + v4 = v5; + break; case 6: v6 = pActor->pMonsterInfo.uResSpirit; break; case 7: v6 = pActor->pMonsterInfo.uResMind; - goto LABEL_12; + v4 = v5; + break; case 8: v6 = pActor->pMonsterInfo.uResBody; -LABEL_12: v4 = v5; break; case 9: @@ -1050,52 +1084,41 @@ case 0u: v3 = pActor; v4 = pActor->pMonsterInfo.uResFire; - goto LABEL_12; case 1u: v3 = pActor; v4 = pActor->pMonsterInfo.uResAir; - goto LABEL_12; case 2u: v3 = pActor; v4 = pActor->pMonsterInfo.uResWater; - goto LABEL_12; case 3u: v3 = pActor; v4 = pActor->pMonsterInfo.uResEarth; - goto LABEL_12; case 7u: v3 = pActor; v4 = pActor->pMonsterInfo.uResMind; - goto LABEL_12; case 6u: v3 = pActor; v4 = pActor->pMonsterInfo.uResSpirit; - goto LABEL_12; case 8u: v3 = pActor; v4 = pActor->pMonsterInfo.uResBody; - goto LABEL_12; case 9u: v3 = pActor; v4 = pActor->pMonsterInfo.uResLight; - goto LABEL_12; case 0xAu: v3 = pActor; v4 = pActor->pMonsterInfo.uResDark; - goto LABEL_12; case 4u: v3 = pActor; v4 = pActor->pMonsterInfo.uResPhysical; -LABEL_12: - if ( v4 < 200 ) - result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; - else - result = 0; break; default: - result = 1; - break; + return 1; } + if ( v4 < 200 ) + result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; + else + result = 0; return result; } @@ -1549,7 +1572,6 @@ v13 = 0; if ( (signed int)uNumActors <= 0 ) { -LABEL_20: result = 0; } else @@ -1597,7 +1619,7 @@ ++v13; ++v1; if ( v13 >= (signed int)uNumActors ) - goto LABEL_20; + return 0; } result = 1; }