comparison mm7_4.cpp @ 198:e6e348d66a75

Some work on spellbook
author Nomad
date Sat, 16 Feb 2013 21:46:07 +0200
parents 650d96af8855
children 0c64754c7fd4
comparison
equal deleted inserted replaced
197:5979fc0de9ae 198:e6e348d66a75
1 #include <io.h> 1 #include <io.h>
2 #include <direct.h> 2 #include <direct.h>
3 #include <assert.h>
3 4
4 #include "MapInfo.h" 5 #include "MapInfo.h"
5 #include "Game.h" 6 #include "Game.h"
6 #include "GUIWindow.h" 7 #include "GUIWindow.h"
7 #include "GUIButton.h" 8 #include "GUIButton.h"
5859 signed int uSpellBookPageCount; // ecx@40 5860 signed int uSpellBookPageCount; // ecx@40
5860 int v13; // eax@40 5861 int v13; // eax@40
5861 signed int uSkillIdx; // eax@45 5862 signed int uSkillIdx; // eax@45
5862 int v15; // eax@70 5863 int v15; // eax@70
5863 signed int v16; // ecx@70 5864 signed int v16; // ecx@70
5864 unsigned int v18; // [sp-4h] [bp-84h]@48 5865 //unsigned int v18; // [sp-4h] [bp-84h]@48
5865 ItemGen item; // [sp+Ch] [bp-74h]@37 5866 ItemGen item; // [sp+Ch] [bp-74h]@37
5866 char v20[32]; // [sp+30h] [bp-50h]@29 5867 char v20[32]; // [sp+30h] [bp-50h]@29
5867 //char v21; // [sp+31h] [bp-4Fh]@29 5868 //char v21; // [sp+31h] [bp-4Fh]@29
5868 //__int16 v22; // [sp+4Dh] [bp-33h]@29 5869 //__int16 v22; // [sp+4Dh] [bp-33h]@29
5869 char v23; // [sp+4Fh] [bp-31h]@29 5870 char v23; // [sp+4Fh] [bp-31h]@29
5997 for ( int i = 0; i < 9; i++) 5998 for ( int i = 0; i < 9; i++)
5998 { 5999 {
5999 if ( pPlayer->pActiveSkills[12+i] ) 6000 if ( pPlayer->pActiveSkills[12+i] )
6000 ++uSpellBookPageCount; 6001 ++uSpellBookPageCount;
6001 } 6002 }
6002 pPlayer->pNumSpellBookPage = uSpellBookPageCount; 6003 pPlayer->lastOpenedSpellbookPage = uSpellBookPageCount;
6003 pItemsTable->GenerateItem(2, 40, &item); 6004 pItemsTable->GenerateItem(2, 40, &item);
6004 pPlayer->AddItem2(-1, &item); 6005 pPlayer->AddItem2(-1, &item);
6005 uSkillIdx = 0; 6006 uSkillIdx = 0;
6006 v24.y = 0; 6007 v24.y = 0;
6007 do 6008 do
6008 { 6009 {
6009 if ( pPlayer->pActiveSkills[uSkillIdx] ) 6010 if ( pPlayer->pActiveSkills[uSkillIdx] )
6010 { 6011 {
6011 switch ( uSkillIdx ) 6012 switch ( uSkillIdx )
6012 { 6013 {
6013 case 0: 6014 case PLAYER_SKILL_STAFF: pPlayer->AddItem(-1, 61); break;
6014 v18 = 61; 6015 case PLAYER_SKILL_SWORD: pPlayer->AddItem(-1, 1); break;
6015 pPlayer->AddItem(-1, v18); 6016 case PLAYER_SKILL_DAGGER: pPlayer->AddItem(-1, 15); break;
6016 break; 6017 case PLAYER_SKILL_AXE: pPlayer->AddItem(-1, 23); break;
6017 case 1: 6018 case PLAYER_SKILL_SPEAR: pPlayer->AddItem(-1, 31); break;
6018 v18 = 1; 6019 case PLAYER_SKILL_BOW: pPlayer->AddItem(-1, 47); break;
6019 pPlayer->AddItem(-1, v18); 6020 case PLAYER_SKILL_MACE: pPlayer->AddItem(-1, 50); break;
6020 break; 6021 case PLAYER_SKILL_BLASTER: assert(false); break;
6021 case 2: 6022 case PLAYER_SKILL_SHIELD: pPlayer->AddItem(-1, 84); break;
6022 v18 = 15; 6023 case PLAYER_SKILL_LEATHER: pPlayer->AddItem(-1, 66); break;
6023 pPlayer->AddItem(-1, v18); 6024 case PLAYER_SKILL_CHAIN: pPlayer->AddItem(-1, 71); break;
6024 break; 6025 case PLAYER_SKILL_PLATE: pPlayer->AddItem(-1, 76); break;
6025 case 3: 6026 case PLAYER_SKILL_FIRE:
6026 v18 = 23;
6027 pPlayer->AddItem(-1, v18);
6028 break;
6029 case 4:
6030 v18 = 31;
6031 pPlayer->AddItem(-1, v18);
6032 break;
6033 case 5:
6034 v18 = 47;
6035 pPlayer->AddItem(-1, v18);
6036 break;
6037 case 6:
6038 v18 = 50;
6039 pPlayer->AddItem(-1, v18);
6040 break;
6041 case 8:
6042 v18 = 84;
6043 pPlayer->AddItem(-1, v18);
6044 break;
6045 case 9:
6046 v18 = 66;
6047 pPlayer->AddItem(-1, v18);
6048 break;
6049 case 10:
6050 v18 = 71;
6051 pPlayer->AddItem(-1, v18);
6052 break;
6053 case 11:
6054 v18 = 76;
6055 pPlayer->AddItem(-1, v18);
6056 break;
6057 case 12:
6058 pPlayer->AddItem(-1, 0x191); 6027 pPlayer->AddItem(-1, 0x191);
6059 pPlayer->spellbook.pFireSpellbook.bIsSpellbookAvailable = 1; 6028 pPlayer->spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;
6060 break; 6029 break;
6061 case 13: 6030 case PLAYER_SKILL_AIR:
6062 pPlayer->AddItem(-1, 0x19C); 6031 pPlayer->AddItem(-1, 0x19C);
6063 pPlayer->spellbook.pAirSpellbook.bIsSpellbookAvailable = 1; 6032 pPlayer->spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
6064 break; 6033 break;
6065 case 14: 6034 case PLAYER_SKILL_WATER:
6066 pPlayer->AddItem(-1, 0x1A7); 6035 pPlayer->AddItem(-1, 0x1A7);
6067 pPlayer->spellbook.pWaterSpellbook.bIsSpellbookAvailable = 1; 6036 pPlayer->spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
6068 break; 6037 break;
6069 case 15: 6038 case PLAYER_SKILL_EARTH:
6070 pPlayer->AddItem(-1, 0x1B2); 6039 pPlayer->AddItem(-1, 0x1B2);
6071 pPlayer->spellbook.pEarthSpellbook.bIsSpellbookAvailable = 1; 6040 pPlayer->spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
6072 break; 6041 break;
6073 case 16: 6042 case PLAYER_SKILL_SPIRIT:
6074 pPlayer->AddItem(-1, 0x1BD); 6043 pPlayer->AddItem(-1, 0x1BD);
6075 pPlayer->spellbook.pSpiritSpellbook.bIsSpellbookAvailable = 1; 6044 pPlayer->spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
6076 break; 6045 break;
6077 case 17: 6046 case PLAYER_SKILL_MIND:
6078 pPlayer->AddItem(-1, 0x1C8); 6047 pPlayer->AddItem(-1, 0x1C8);
6079 pPlayer->spellbook.pMindSpellbook.bIsSpellbookAvailable = 1; 6048 pPlayer->spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
6080 break; 6049 break;
6081 case 18: 6050 case PLAYER_SKILL_BODY:
6082 pPlayer->AddItem(-1, 0x1D3); 6051 pPlayer->AddItem(-1, 0x1D3);
6083 pPlayer->spellbook.pBodySpellbook.bIsSpellbookAvailable = 1; 6052 pPlayer->spellbook.pBodySpellbook.bIsSpellAvailable[0] = true;
6084 break; 6053 break;
6085 case 21: 6054 case PLAYER_SKILL_LIGHT:
6086 case 23: 6055 case PLAYER_SKILL_DARK:
6087 case 25: 6056 case PLAYER_SKILL_DIPLOMACY:
6088 case 26: 6057 assert(false);
6089 case 29: 6058 break;
6090 case 36: 6059 case PLAYER_SKILL_ITEM_ID:
6060 case PLAYER_SKILL_REPAIR:
6061 case PLAYER_SKILL_MEDITATION:
6062 case PLAYER_SKILL_PERCEPTION:
6063 case PLAYER_SKILL_TRAP_DISARM:
6064 case PLAYER_SKILL_LEARNING:
6091 pPlayer->AddItem(-1, 0xDC); 6065 pPlayer->AddItem(-1, 0xDC);
6092 v18 = 5 * (rand() % 3 + 40); 6066 pPlayer->AddItem(-1, 5 * (rand() % 3 + 40));
6093 pPlayer->AddItem(-1, v18); 6067 break;
6094 break; 6068 case PLAYER_SKILL_DODGE:
6095 case 30: 6069 pPlayer->AddItem(-1, 115);
6096 v18 = 115; 6070 break;
6097 pPlayer->AddItem(-1, v18); 6071 case PLAYER_SKILL_UNARMED:
6098 break; 6072 pPlayer->AddItem(-1, 110);
6099 case 31: 6073 break;
6100 v18 = 110;
6101 pPlayer->AddItem(-1, v18);
6102 break;
6103 default: 6074 default:
6104 break; 6075 break;
6105 } 6076 }
6106 for ( int i = 0; i < 138; i++) 6077 for ( int i = 0; i < 138; i++)
6107 { 6078 {