changeset 947:99aa9c8464cf

Improved conditions handling.
author Nomad
date Wed, 01 May 2013 14:30:02 +0200
parents eb3bb0f2e1b9
children 5a2dbb00c399
files Player.h mm7_2.cpp
diffstat 2 files changed, 45 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/Player.h	Wed May 01 14:10:16 2013 +0200
+++ b/Player.h	Wed May 01 14:30:02 2013 +0200
@@ -577,6 +577,26 @@
   inline bool Cursed()     {return pConditions[Condition::Condition_Cursed] != 0;}
   inline bool Pertified()  {return pConditions[Condition::Condition_Pertified] != 0;}
 
+  inline void SetCursed(bool state)      {pConditions[Condition::Condition_Cursed] = state;}
+  inline void SetWeak(bool state)        {pConditions[Condition::Condition_Weak] = state;}
+  inline void SetAsleep(bool state)      {pConditions[Condition::Condition_Sleep] = state;}
+  inline void SetAfraid(bool state)      {pConditions[Condition::Condition_Fear] = state;}
+  inline void SetDrunk(bool state)       {pConditions[Condition::Condition_Drunk] = state;}
+  inline void SetInsane(bool state)      {pConditions[Condition::Condition_Insane] = state;}
+  inline void SetPoison1(bool state)     {pConditions[Condition::Condition_Poison1] = state;}
+  inline void SetDisease1(bool state)    {pConditions[Condition::Condition_Disease1] = state;}
+  inline void SetPoison2(bool state)     {pConditions[Condition::Condition_Poison2] = state;}
+  inline void SetDisease2(bool state)    {pConditions[Condition::Condition_Disease2] = state;}
+  inline void SetPoison3(bool state)     {pConditions[Condition::Condition_Poison3] = state;}
+  inline void SetDisease3(bool state)    {pConditions[Condition::Condition_Disease3] = state;}
+  inline void SetParalyzed(bool state)   {pConditions[Condition::Condition_Paralyzed] = state;}
+  inline void SetUnconcious(bool state)  {pConditions[Condition::Condition_Unconcious] = state;}
+  inline void SetDead(bool state)        {pConditions[Condition::Condition_Dead] = state;}
+  inline void SetPertified(bool state)   {pConditions[Condition::Condition_Pertified] = state;}
+  inline void SetEradicated(bool state)  {pConditions[Condition::Condition_Eradicated] = state;}
+  inline void SetZombie(bool state)      {pConditions[Condition::Condition_Zombie] = state;}
+
+
 
 
   __int64 pConditions[20];
--- a/mm7_2.cpp	Wed May 01 14:10:16 2013 +0200
+++ b/mm7_2.cpp	Wed May 01 14:30:02 2013 +0200
@@ -6823,7 +6823,9 @@
     {
       switch (wParam)
       {
-        case 101:
+        case 103:  pRenderer->SavePCXScreenshot();  return 0;
+
+        case 101:  // Quit game
         case 40001:
         {
           v38 = 0;
@@ -6834,9 +6836,6 @@
         }
         return 0;
 
-        case 103:
-          pRenderer->SavePCXScreenshot();
-        return 0;
 
         case 104:
           pRenderer->ChangeBetweenWinFullscreenModes();
@@ -6844,95 +6843,33 @@
             pArcomageGame->field_F6 = 1;
         return 0;
 
-        case 40007:
-          pParty->SetGold(pParty->uNumGold + 10000);
-        return 0;
-
-        case 40008:
-          GivePartyExp(20000);
-        return 0;
-
-        case 40013:
-          pParty->SetGold(0);
-        return 0;
+        case 40007:  pParty->SetGold(pParty->uNumGold + 10000); return 0;
+        case 40008:  GivePartyExp(20000);  return 0;
+        case 40013:  pParty->SetGold(0);   return 0;
 
         case 40059:
           for (uint i = 0; i < 4; ++i)
             pParty->pPlayers[i].uSkillPoints = 50;
         return 0;
-
-        case 40044://condition Afraid/fear
-          pPlayers[uActiveCharacter]->pConditions[3] = 1;
-        return 0;
-
-        case 40043://condition Asleep
-          pPlayers[uActiveCharacter]->pConditions[2] = 1;
-        return 0;
-
-        case 40037://condition Curse
-          pPlayers[uActiveCharacter]->pConditions[0] = 1;
-        return 0;
-
-        case 40036://condition Disease1
-          pPlayers[uActiveCharacter]->pConditions[7] = 1;
-        return 0;
-
-        case 40035://condition Disease2
-          pPlayers[uActiveCharacter]->pConditions[9] = 1;
-        return 0;
-
-        case 40034://condition Disease3
-          pPlayers[uActiveCharacter]->pConditions[11] = 1;
-        return 0;
-
-        case 40041://condition Dead
-          pPlayers[uActiveCharacter]->pConditions[14] = 1;
-        return 0;
-
-        case 40039://condition Drunk
-          pPlayers[uActiveCharacter]->pConditions[4] = 1;
-        return 0;
-
-        case 40042://condition Eradicated
-          pPlayers[uActiveCharacter]->pConditions[16] = 1;
-        return 0;
-
-        case 40038://condition Isane
-          pPlayers[uActiveCharacter]->pConditions[5] = 1;
-        return 0;
-
-        case 40045://condition Paralized
-          pPlayers[uActiveCharacter]->pConditions[12] = 1;
-        return 0;
-
-        case 40033://condition Poison1
-          pPlayers[uActiveCharacter]->pConditions[6] = 1;
-        return 0;
-
-        case 40032://condition Poison2
-          pPlayers[uActiveCharacter]->pConditions[8] = 1;
-        return 0;
-
-        case 40031://condition Poison3
-          pPlayers[uActiveCharacter]->pConditions[10] = 1;
-        return 0;
-
-        case 40029://condition Stone
-          pPlayers[uActiveCharacter]->pConditions[15] = 1;
-        return 0;
-
-        case 40040://condition Unconscious
-          pPlayers[uActiveCharacter]->pConditions[13] = 1;
-        return 0;
-
-        case 40030://condition Weak
-          pPlayers[uActiveCharacter]->pConditions[1] = 1;
-        return 0;
-
-        case 40073://condition Zombie
-          pPlayers[uActiveCharacter]->pConditions[17] = 1;
-        return 0;
-
+        
+        case 40029:  pPlayers[uActiveCharacter]->SetPertified(true);  return 0;
+        case 40030:  pPlayers[uActiveCharacter]->SetWeak(true);       return 0;
+        case 40031:  pPlayers[uActiveCharacter]->SetPoison3(true);    return 0;
+        case 40032:  pPlayers[uActiveCharacter]->SetPoison2(true);    return 0;
+        case 40033:  pPlayers[uActiveCharacter]->SetPoison1(true);    return 0;
+        case 40034:  pPlayers[uActiveCharacter]->SetDisease3(true);   return 0;
+        case 40035:  pPlayers[uActiveCharacter]->SetDisease2(true);   return 0;
+        case 40036:  pPlayers[uActiveCharacter]->SetDisease1(true);   return 0;
+        case 40037:  pPlayers[uActiveCharacter]->SetCursed(true);     return 0;
+        case 40038:  pPlayers[uActiveCharacter]->SetInsane(true);     return 0;
+        case 40039:  pPlayers[uActiveCharacter]->SetDrunk(true);      return 0;
+        case 40040:  pPlayers[uActiveCharacter]->SetUnconcious(true); return 0;
+        case 40041:  pPlayers[uActiveCharacter]->SetDead(true);       return 0;
+        case 40042:  pPlayers[uActiveCharacter]->SetEradicated(true); return 0;
+        case 40043:  pPlayers[uActiveCharacter]->SetAsleep(true);     return 0;
+        case 40044:  pPlayers[uActiveCharacter]->SetAfraid(true);     return 0;
+        case 40045:  pPlayers[uActiveCharacter]->SetParalyzed(true);  return 0;
+        case 40073:  pPlayers[uActiveCharacter]->SetZombie(true);     return 0;
       }
     }
     return DefWindowProcA(hWnd, Msg, wParam, lParam);