Mercurial > mm7
diff Party.cpp @ 82:1faa29fd4c2d
many type, memory, boundary fixes
author | zipi |
---|---|
date | Sun, 03 Feb 2013 23:37:17 +0000 |
parents | 9c0607679772 |
children | be45fc285970 |
line wrap: on
line diff
--- a/Party.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/Party.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -870,13 +870,13 @@ //----- (004909F4) -------------------------------------------------------- void Party::_4909F4() { - char *v1; // esi@2 + Player *v1; // esi@2 unsigned int v2; // eax@3 __int16 v3; // cx@5 int v4; // edx@27 signed int v5; // eax@52 PlayerFrame *v6; // edx@53 - char *v7; // esi@60 + NPCData *v7; // esi@60 signed int v8; // ebp@61 int v9; // ebx@62 unsigned int v10; // edi@62 @@ -885,21 +885,21 @@ if ( dword_A75070 != stru_51076C.field_8 ) { dword_A75070 = stru_51076C.field_8; - v1 = (char *)&this->pPlayers[0].uExpressionID; + v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID; v11 = 4; do { v2 = ((Player *)(v1 - 6812))->GetMajorConditionIdx(); if ( v2 == 18 || v2 == 17 ) { - *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); - if ( *((short *)v1 + 1) >= *((short *)v1 + 2) ) + v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed); + if ( (unsigned __int16)v1->uExpressionTimePassed >= v1->uExpressionTimeLength ) { - if ( *(short *)v1 != 1 || rand() % 5 ) + if ( v1->uExpressionID != 1 || rand() % 5 ) { - *((short *)v1 + 1) = 0; - *(short *)v1 = 1; - *((short *)v1 + 2) = rand() % 256 + 32; + v1->uExpressionTimePassed = 0; + v1->uExpressionID = 1; + v1->uExpressionTimeLength = rand() % 256 + 32; } else { @@ -927,67 +927,67 @@ if ( v4 >= 82 ) { if ( v4 >= 88 ) - *(short *)v1 = (v4 >= 94) + 29; + v1->uExpressionID = (v4 >= 94) + 29; else - *(short *)v1 = 57; + v1->uExpressionID = 57; } else { - *(short *)v1 = 56; + v1->uExpressionID = 56; } } else { - *(short *)v1 = 55; + v1->uExpressionID = 55; } } else { - *(short *)v1 = 54; + v1->uExpressionID = 54; } } else { - *(short *)v1 = 20; + v1->uExpressionID = 20; } } else { - *(short *)v1 = 19; + v1->uExpressionID = 19; } } else { - *(short *)v1 = 18; + v1->uExpressionID = 18; } } else { - *(short *)v1 = 17; + v1->uExpressionID = 17; } } else { - *(short *)v1 = 16; + v1->uExpressionID = 16; } } else { - *(short *)v1 = 15; + v1->uExpressionID = 15; } } else { - *(short *)v1 = 14; + v1->uExpressionID = 14; } } else { - *(short *)v1 = 13; + v1->uExpressionID = 13; } v5 = 0; - *((short *)v1 + 1) = 0; - if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) + v1->uExpressionTimePassed = 0; + if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) { LABEL_56: v5 = 0; @@ -995,7 +995,7 @@ else { v6 = pPlayerFrameTable->pFrames; - while ( v6->uSequenceID != *(short *)v1 ) + while ( v6->uSequenceID != v1->uExpressionID ) { ++v5; ++v6; @@ -1003,62 +1003,62 @@ goto LABEL_56; } } - *((short *)v1 + 2) = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; + v1->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; } } } else { - v3 = *(short *)v1; - if ( *(short *)v1 != 34 && v3 != 35 && v3 != 36 - || (signed int)(pMiscTimer->uTimeElapsed + *((short *)v1 + 1)) >= *((short *)v1 + 2) ) + v3 = v1->uExpressionID; + if ( v1->uExpressionID != 34 && v3 != 35 && v3 != 36 + || (signed int)(pMiscTimer->uTimeElapsed + v1->uExpressionTimePassed) >= v1->uExpressionTimeLength ) { - *((short *)v1 + 2) = 0; - *((short *)v1 + 1) = 0; + v1->uExpressionTimeLength = 0; + v1->uExpressionTimePassed = 0; switch ( v2 ) { case 0xEu: - *(short *)v1 = 98; + v1->uExpressionID = 98; break; case 0xFu: - *(short *)v1 = 12; + v1->uExpressionID = 12; break; case 0x10u: - *(short *)v1 = 99; + v1->uExpressionID = 99; break; case 0u: - *(short *)v1 = 2; + v1->uExpressionID = 2; break; case 1u: - *(short *)v1 = 3; + v1->uExpressionID = 3; break; case 2u: - *(short *)v1 = 4; + v1->uExpressionID = 4; break; case 3u: - *(short *)v1 = 5; + v1->uExpressionID = 5; break; case 4u: - *(short *)v1 = 6; + v1->uExpressionID = 6; break; case 5u: - *(short *)v1 = 7; + v1->uExpressionID = 7; break; case 6u: case 8u: case 0xAu: - *(short *)v1 = 8; + v1->uExpressionID = 8; break; case 7u: case 9u: case 0xBu: - *(short *)v1 = 9; + v1->uExpressionID = 9; break; case 0xCu: - *(short *)v1 = 10; + v1->uExpressionID = 10; break; case 0xDu: - *(short *)v1 = 11; + v1->uExpressionID = 11; break; default: break; @@ -1066,38 +1066,38 @@ } else { - *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); - } + v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed); + } } - v1 += 6972; + ++v1; --v11; } while ( v11 ); - v7 = (char *)&pParty->pHirelings[0].evtb; + v7 = pParty->pHirelings;//(char *)&pParty->pHirelings[0].evtb; do { - v8 = *((int *)v7 + 1); + v8 = v7->evtc; if ( v8 ) { - v9 = *((int *)v7 - 1); - v10 = pMiscTimer->uTimeElapsed + *(int *)v7; + v9 = v7->bDrawSomeAnim; + v10 = pMiscTimer->uTimeElapsed + v7->evtb; if ( (signed int)v10 >= v8 ) { v9 = 0; v8 = 0; v10 = 0; - memset(v7 - 44, 0, 0x4Cu); + memset(v7, 0, 0x4Cu); pParty->field_709 = 0; //sub_44A56A();Ritor1: it's temporarily viewparams->bRedrawGameUI = 1; } - *(int *)v7 = v10; - *((int *)v7 + 1) = v8; - *((int *)v7 - 1) = v9; + v7->evtb = v10; + v7->evtc = v8; + v7->bDrawSomeAnim = v9; } - v7 += 76; + ++v7; } - while ( (signed int)v7 < (signed int)&pParty->field_777C[1] ); + while ( v7 <= &pParty->pHirelings[1] ); } } // A75070: using guessed type int dword_A75070;