Mercurial > mm7
annotate Level/Decoration.cpp @ 1689:133a5f62bc8c
Player::_48DCF6 fixing use of uninitialized vars
author | Grumpy7 |
---|---|
date | Sun, 22 Sep 2013 07:34:02 +0200 |
parents | c4ab816fcc5e |
children | 628a0ad87136 |
rev | line source |
---|---|
1480 | 1 #include "Decoration.h" |
2 #include "../Party.h" | |
1545 | 3 #include "../ErrorHandling.h" |
1480 | 4 |
5 //----- (004583B0) -------------------------------------------------------- | |
6 LevelDecoration::LevelDecoration() | |
7 { | |
1489 | 8 memset(this, 0, sizeof(this)); |
1480 | 9 } |
10 | |
11 //----- (00450929) -------------------------------------------------------- | |
12 int LevelDecoration::GetGlobalEvent() | |
13 { | |
1489 | 14 //LevelDecoration *v1; // esi@1 |
15 //signed int v2; // eax@1 | |
16 //int v3; // eax@5 | |
17 //int v4; // eax@6 | |
18 //int v5; // eax@7 | |
19 //int v6; // eax@8 | |
20 //int v7; // eax@9 | |
21 //int result; // eax@14 | |
22 //int v9; // eax@18 | |
23 //int v10; // eax@19 | |
24 //int v11; // eax@20 | |
25 //int v12; // eax@21 | |
26 //int v13; // eax@22 | |
1480 | 27 |
28 switch (uDecorationDescID) | |
29 { | |
30 case 0: case 1: | |
31 case 2: case 3: | |
32 return 0; | |
33 | |
34 case 4: return 16; // dec01 "Trash Pile" | |
35 case 5: return 32; // dec02 "Campfire" | |
36 case 6: return 12 + rand() % 4; // dec03 "Cauldron" | |
37 case 7: case 8: | |
38 case 9: case 10: | |
39 return 0; | |
40 | |
41 case 11: return 34; // dec08 "Fruit plate" | |
42 case 12: | |
43 return 0; | |
44 | |
45 case 13: return 17; // dec10 "Trash Pile" | |
46 case 14: return 18; // dec11 "Filth" | |
47 case 15: case 16: case 17: | |
48 case 18: case 19: case 20: | |
49 case 21: case 22: case 23: | |
50 return 0; | |
51 | |
52 case 24: return 36; // dec21 "Keg" | |
53 case 25: case 26: case 27: case 28: case 29: | |
54 case 30: case 31: case 32: case 33: | |
55 return 0; | |
56 | |
57 case 34: return 4 + rand() % 6; // dec32 "Barrel" | |
58 case 35: case 36: case 37: case 38: case 39: | |
59 case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: | |
60 case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: | |
61 case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69: | |
62 case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79: | |
63 case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: | |
64 case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99: | |
65 case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: | |
66 case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: | |
67 case 120: case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: | |
68 case 130: case 131: case 132: case 133: case 134: case 135: case 136: case 137: case 138: case 139: | |
69 case 140: case 141: case 142: case 143: case 144: case 145: case 146: case 147: case 148: case 149: | |
70 case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: | |
71 case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: | |
72 case 170: case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: | |
73 case 180: case 181: case 182: case 183: | |
74 | |
75 case 184: return 33; // dec24 "Campfire" | |
76 case 185: case 186: | |
77 return 0; | |
78 | |
79 case 187: // dec88 "Mushroom" | |
80 case 190: // dec91 "Mushroom" | |
81 return 37; | |
82 | |
83 case 188: case 189: | |
84 case 191: case 192: case 193: case 194: case 195: case 196: | |
85 case 197: case 198: case 199: case 200: case 201: case 202: | |
86 case 203: case 204: case 205: | |
87 return 0; | |
88 | |
89 case 206: return 162 + rand() % 7; // dec60 | |
90 case 207: return 169 + rand() % 7; // dec61 | |
91 case 208: return 176 + rand() % 7; // dec62 | |
92 case 209: return 183 + rand() % 7; // dec63 | |
1492 | 93 case 210: return 150; // dec64 "Magic pedestal" |
94 case 211: return 151; // dec65 "Magic pedestal" | |
95 case 212: return 152; // dec66 "Magic pedestal" | |
96 case 213: return 153; // dec67 "Magic pedestal" | |
97 case 214: return 154; // dec68 "Magic pedestal" | |
98 case 215: return 155; // dec69 "Magic pedestal" | |
99 case 216: return 156; // dec70 "Magic pedestal" | |
100 case 217: return 157; // dec71 "Magic pedestal" | |
101 case 218: return 158; // dec72 "Magic pedestal" | |
102 case 219: return 159; // dec73 "Magic pedestal" | |
103 case 220: return 160; // dec74 "Magic pedestal" | |
104 case 221: return 161; // dec75 "Magic pedestal" | |
1480 | 105 |
106 case 222: case 223: case 224: | |
107 case 225: case 226: case 227: | |
108 return 0; | |
109 | |
1545 | 110 default: Error("Invalid DecorationDescID: %u", uDecorationDescID); |
1480 | 111 } |
112 } | |
113 | |
114 //----- (0047A825) -------------------------------------------------------- | |
1491
6d21ef91cb2d
Rename LevelDecoration::_47A825 to LevelDecoration::IsObeliskChestActive().
yoctozepto
parents:
1489
diff
changeset
|
115 bool LevelDecoration::IsObeliskChestActive() |
1480 | 116 { |
117 //bool v1; // ebx@1 | |
118 //LevelDecoration *v2; // edi@1 | |
119 | |
1495 | 120 static const std::array<const PARTY_QUEST_BITS, 14> aObeliskQuests = { |
121 PARTY_QUEST_OBELISK_HARMONDALE, | |
122 PARTY_QUEST_OBELISK_ERATHIA, | |
123 PARTY_QUEST_OBELISK_TULAREAN_FOREST, | |
124 PARTY_QUEST_OBELISK_DEYJA, | |
125 PARTY_QUEST_OBELISK_BRACADA_DESERT, | |
126 PARTY_QUEST_OBELISK_CELESTE, | |
127 PARTY_QUEST_OBELISK_THE_PIT, | |
128 PARTY_QUEST_OBELISK_EVENMORN_ISLAND, | |
129 PARTY_QUEST_OBELISK_MOUNT_NIGHON, | |
130 PARTY_QUEST_OBELISK_BARROW_DOWNS, | |
131 PARTY_QUEST_OBELISK_LAND_OF_THE_GIANTS, | |
132 PARTY_QUEST_OBELISK_TATALIA, | |
133 PARTY_QUEST_OBELISK_AVLEE, | |
134 PARTY_QUEST_OBELISK_STONE_CITY | |
135 }; | |
136 | |
1480 | 137 if (pParty->uCurrentHour == 0 |
1495 | 138 && !TestPartyQuestBit(PARTY_QUEST_OBELISK_TREASURE_FOUND) |
139 && std::all_of(aObeliskQuests.begin(), aObeliskQuests.end(), TestPartyQuestBit)) | |
1480 | 140 { |
1489 | 141 this->uFlags &= ~LEVEL_DECORATION_INVISIBLE; |
1480 | 142 return true; |
143 } | |
144 | |
1489 | 145 this->uFlags |= LEVEL_DECORATION_INVISIBLE; |
1480 | 146 return false; |
147 } | |
148 | |
149 //----- (0044C2F4) -------------------------------------------------------- | |
150 bool LevelDecoration::IsInteractive() | |
151 { | |
152 switch (uDecorationDescID) | |
153 { | |
154 case 4: // trash pile | |
155 case 5: // campfire | |
156 case 6: // cauldron | |
157 case 11: // fruit plate | |
158 case 13: // trash pile | |
159 case 14: // dirt | |
160 case 24: // keg | |
161 case 184: // fire | |
162 case 187: // fire | |
163 case 190: // fire | |
164 return true; | |
165 } | |
166 | |
167 if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire | |
168 return true; | |
1492 | 169 if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedestal |
1480 | 170 return true; |
171 | |
172 return false; | |
173 } |