# HG changeset patch # User zipi # Date 1362573838 0 # Node ID 829fb49eee05516abb784bc706fcd42ef6f1e646 # Parent fb0e105683e9f74b00bc1bbce38738be072242e2 OnGameViewportClick cleaned partly diff -r fb0e105683e9 -r 829fb49eee05 mm7_1.cpp --- a/mm7_1.cpp Wed Mar 06 12:23:52 2013 +0000 +++ b/mm7_1.cpp Wed Mar 06 12:43:58 2013 +0000 @@ -4892,14 +4892,13 @@ if (!player->CanAct()) { - if ( pPlayers[uActiveCharacter]->CanAct()) - goto LABEL_9; player = pPlayers[uActiveCharacter]; } - player->PlaySound(SPEECH_NoRoom, 0); + if(playerCanAct() || !pPlayers[uActiveCharacter]->CanAct()) + player->PlaySound(SPEECH_NoRoom, 0); } -LABEL_9: +//LABEL_9: if (pCurrentScreen == SCREEN_GAME) { viewparams->bRedrawGameUI = true; @@ -5059,7 +5058,8 @@ memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); v0->RemoveItemAtInventoryIndex(a4); v9 = pParty->pPickedItem.uItemID; - goto LABEL_24; + pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); + return; } v13 = v8; if ( v8 ) @@ -5080,7 +5080,6 @@ } v9 = this_.uItemID; memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); -LABEL_24: pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); return; } @@ -5166,7 +5165,10 @@ SpriteObject::OnInteraction(a2.y); return; } - goto LABEL_13; + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; } if ( (v0 & 7) != OBJECT_Actor) { @@ -5174,7 +5176,12 @@ { v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) - goto LABEL_13; + { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; + } v14 = v13->field_16_event_id; if ( !v14 ) { @@ -5192,7 +5199,12 @@ else { if ( (v0 & 7) != OBJECT_BModel || (unsigned int)v0 >= 0x2000000 ) - goto LABEL_13; + { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; + } v2 = (signed int)(unsigned __int16)v0 >> 3; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { @@ -5200,61 +5212,61 @@ if ( !(v3->uAttributes & 0x2000000) ) { LABEL_11: - v4 = pParty->pPickedItem.uItemID; - if ( pParty->pPickedItem.uItemID ) - { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + { + ShowNothingHereStatus(); + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + } LABEL_14: - v5 = pItemsTable->pItems[v4].uSpriteID; - v6 = 0; - a1.uType = v5; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_18: - LOWORD(v6) = 0; - } - else - { - v7 = (char *)&pObjectList->pObjects->uObjectID; - while ( v5 != *(short *)v7 ) - { - ++v6; - v7 += 56; - if ( v6 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_18; - } - } - a1.uObjectDescID = v6; - a1.vPosition.y = pParty->vPosition.y; - a1.field_58_pid = OBJECT_Player; - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; - a1.uSoundID = 0; - a1.uFacing = 0; - a1.uAttributes = 8; - a1.uSectorID = pIndoor->GetSector( - pParty->vPosition.x, - pParty->vPosition.y, - pParty->sEyelevel + pParty->vPosition.z); - a1.uSpriteFrameID = 0; - memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); - v8 = (int *)pMouse->GetCursorPos(&v25); - v9 = UnprojectX(*v8); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); - v10 = pIcons_LOD->LoadTexture( - pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, - TEXTURE_16BIT_PALETTE); - if (v10 != -1) - pIcons_LOD->pTextures[v10].Release(); - pMouse->RemoveHoldingItem(); - pIcons_LOD->_40F9C5(); - return; - } - ShowNothingHereStatus(); -LABEL_13: - v4 = pParty->pPickedItem.uItemID; - if ( !pParty->pPickedItem.uItemID ) - return; - goto LABEL_14; + v5 = pItemsTable->pItems[v4].uSpriteID; + v6 = 0; + a1.uType = v5; + if ( (signed int)pObjectList->uNumObjects <= 0 ) + { + LOWORD(v6) = 0; + } + else + { + v7 = (char *)&pObjectList->pObjects->uObjectID; + while ( v5 != *(short *)v7 ) + { + ++v6; + v7 += 56; + if ( v6 >= (signed int)pObjectList->uNumObjects ) + { + LOWORD(v6) = 0; + break; + } + } + } + a1.uObjectDescID = v6; + a1.vPosition.y = pParty->vPosition.y; + a1.field_58_pid = OBJECT_Player; + a1.vPosition.x = pParty->vPosition.x; + a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; + a1.uSoundID = 0; + a1.uFacing = 0; + a1.uAttributes = 8; + a1.uSectorID = pIndoor->GetSector( + pParty->vPosition.x, + pParty->vPosition.y, + pParty->sEyelevel + pParty->vPosition.z); + a1.uSpriteFrameID = 0; + memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); + v8 = (int *)pMouse->GetCursorPos(&v25); + v9 = UnprojectX(*v8); + a1.Create(pParty->sRotationY + v9, 184, 200, 0); + v10 = pIcons_LOD->LoadTexture( + pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, + TEXTURE_16BIT_PALETTE); + if (v10 != -1) + pIcons_LOD->pTextures[v10].Release(); + pMouse->RemoveHoldingItem(); + pIcons_LOD->_40F9C5(); + return; } v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID; } @@ -5279,14 +5291,22 @@ stru_50C198.LootActor(&pActors[v16]); return; } - goto LABEL_13; + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; } if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) { if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) ) { if ( (unsigned int)v0 >= 0x2000000 ) - goto LABEL_13; + { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; + } if ( !v17->CanAct() ) return; v18 = a2.y;