DM: Add f255_timelineProcessEvent13_ViAltarRebirth

This commit is contained in:
Bendegúz Nagy 2016-07-12 08:44:15 +02:00
parent 800100e2bc
commit 3e40cc46e3
5 changed files with 75 additions and 1 deletions

View File

@ -1196,6 +1196,28 @@ void ChampionMan::f293_drawAllChampionStates() {
}
}
void ChampionMan::f283_viAltarRebirth(uint16 champIndex) {
uint16 L0831_ui_Multiple;
#define AL0831_ui_Cell L0831_ui_Multiple
#define AL0831_ui_MaximumHealth L0831_ui_Multiple
Champion* L0832_ps_Champion;
L0832_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex];
if (_vm->_championMan->f285_getIndexInCell(L0832_ps_Champion->_cell) != kM1_ChampionNone) {
AL0831_ui_Cell = k0_CellNorthWest;
while (_vm->_championMan->f285_getIndexInCell(AL0831_ui_Cell) != kM1_ChampionNone) {
AL0831_ui_Cell++;
}
L0832_ps_Champion->_cell = (ViewCell)AL0831_ui_Cell;
}
AL0831_ui_MaximumHealth = L0832_ps_Champion->_maxHealth;
L0832_ps_Champion->_currHealth = (L0832_ps_Champion->_maxHealth = MAX(25, AL0831_ui_MaximumHealth - (AL0831_ui_MaximumHealth >> 6) - 1)) >> 1;
_vm->_menuMan->f393_drawSpellAreaControls(_vm->_championMan->_g514_magicCasterChampionIndex);
L0832_ps_Champion->_dir = _vm->_dungeonMan->_g308_partyDir;
setFlag(L0832_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon);
_vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex);
}
ChampionIndex ChampionMan::f285_getIndexInCell(int16 cell) {
for (uint16 i = 0; i < _g305_partyChampionCount; ++i) {
if ((_gK71_champions[i]._cell == cell) && _gK71_champions[i]._currHealth)

View File

@ -524,6 +524,7 @@ public:
bool f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex,
uint16 ammunitionSlotIndex); // @ F0294_CHAMPION_IsAmmunitionCompatibleWithWeapon
void f293_drawAllChampionStates(); // @ F0293_CHAMPION_DrawAllChampionStates
void f283_viAltarRebirth(uint16 champIndex); // @ F0283_CHAMPION_ViAltarRebirth

View File

@ -493,6 +493,7 @@ public:
uint16 getDoNotDiscard() { return (_attributes >> 7) & 1; }
Thing getNextThing() { return _nextThing; }
void setNextThing(Thing thing) { _nextThing = thing; }
}; // @ JUNK
#define kM1_soundModeDoNotPlaySound -1 // @ CM1_MODE_DO_NOT_PLAY_SOUND

View File

@ -34,6 +34,7 @@
#include "movesens.h"
#include "text.h"
#include "eventman.h"
#include "objectman.h"
namespace DM {
@ -368,7 +369,7 @@ T0261053:
_vm->_championMan->f322_championPoison(AL0680_ui_ChampionIndex, L0682_s_Event._B._attack);
break;
case k13_TMEventTypeViAltarRebirth:
//F0255_TIMELINE_ProcessEvent13_ViAltarRebirth(L0681_ps_Event);
f255_timelineProcessEvent13_ViAltarRebirth(L0681_ps_Event);
break;
case k79_TMEventTypeFootprints:
_vm->_championMan->_g407_party._event79Count_Footprints--;
@ -1038,4 +1039,52 @@ void Timeline::f260_timelineRefreshAllChampionStatusBoxes() {
}
_vm->_championMan->f293_drawAllChampionStates();
}
void Timeline::f255_timelineProcessEvent13_ViAltarRebirth(TimelineEvent* event) {
int16 L0664_i_MapX;
int16 L0665_i_MapY;
uint16 L0666_ui_Cell;
Thing L0667_T_Thing;
Junk* L0668_ps_Junk;
int16 L0669_i_IconIndex;
uint16 L0670_ui_Step;
uint16 L0671_ui_ChampionIndex;
L0664_i_MapX = event->_B._location._mapX;
L0665_i_MapY = event->_B._location._mapY;
L0665_i_MapY = event->_B._location._mapY;
L0666_ui_Cell = event->_C.A._cell;
L0671_ui_ChampionIndex = event->_priority;
switch (L0670_ui_Step = event->_C.A._effect) { /* Rebirth is a 3 steps process (Step 2 -> Step 1 -> Step 0). Step is stored in the Effect value of the event */
case 2:
_vm->_projexpl->f213_explosionCreate(Thing::_explRebirthStep1, 0, L0664_i_MapX, L0665_i_MapY, L0666_ui_Cell);
event->_mapTime += 5;
T0255002:
L0670_ui_Step--;
event->_C.A._effect = L0670_ui_Step;
_vm->_timeline->f238_addEventGetEventIndex(event);
break;
case 1:
L0667_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(L0664_i_MapX, L0665_i_MapY);
while (L0667_T_Thing != Thing::_endOfList) {
if ((L0667_T_Thing.getCell() == L0666_ui_Cell) && (L0667_T_Thing.getType() == k10_JunkThingType)) {
L0669_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0667_T_Thing);
if (L0669_i_IconIndex == k147_IconIndiceJunkChampionBones) {
L0668_ps_Junk = (Junk*)_vm->_dungeonMan->f156_getThingData(L0667_T_Thing);
if (L0668_ps_Junk->getChargeCount() == L0671_ui_ChampionIndex) {
_vm->_dungeonMan->f164_unlinkThingFromList(L0667_T_Thing, Thing(0), L0664_i_MapX, L0665_i_MapY); /* BUG0_25 When a champion dies, no bones object is created so it is not possible to bring the champion back to life at an altar of Vi. Each time a champion is brought back to life, the bones object is removed from the dungeon but it is not marked as unused and thus becomes an orphan. After a large number of champion deaths, all JUNK things are exhausted and the game cannot create any more. This also affects the creation of JUNK things dropped by some creatures when they die (Screamer, Rockpile, Magenta Worm, Pain Rat, Red Dragon) */
L0668_ps_Junk->setNextThing(Thing::_none);
event->_mapTime += 1;
goto T0255002;
}
}
}
L0667_T_Thing = _vm->_dungeonMan->f159_getNextThing(L0667_T_Thing);
}
break;
case 0:
_vm->_championMan->f283_viAltarRebirth(event->_priority);
}
}
}

View File

@ -186,6 +186,7 @@ public:
void f254_timelineProcessEvent12_hideDamageReceived(uint16 champIndex); // @ F0254_TIMELINE_ProcessEvent12_HideDamageReceived
void f257_timelineProcessEvent70_light(TimelineEvent *event); // @ F0257_TIMELINE_ProcessEvent70_Light
void f260_timelineRefreshAllChampionStatusBoxes(); // @ F0260_TIMELINE_RefreshAllChampionStatusBoxes
void f255_timelineProcessEvent13_ViAltarRebirth(TimelineEvent *event); // @ F0255_TIMELINE_ProcessEvent13_ViAltarRebirth
};