Skip to content

Commit

Permalink
Some more work on Monk's Empty Body
Browse files Browse the repository at this point in the history
  • Loading branch information
DudeMcDude committed Apr 9, 2016
1 parent 9b86d1f commit 13484ae
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 11 deletions.
12 changes: 12 additions & 0 deletions TemplePlus/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ int BonusList::AddBonusWithDesc(int value, int bonType, int mesline, char* descr
return 0;
}

PointNode::PointNode(){
absX = 0;
absY = 0;
absZ = 0;
}

PointNode::PointNode(float x, float y, float z){
absX = x;
absZ = z;
absY = y;
}

int BonusList::AddBonus(int value, int bonType, int mesline)
{
return bonusSys.bonusAddToBonusList(this, value, bonType, mesline);
Expand Down
8 changes: 5 additions & 3 deletions TemplePlus/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,10 @@ inline std::ostream& operator<<(std::ostream& os, const ScreenDirections & direc

struct PointNode
{
float absX;
int initTo0;
float absY;
float absX; // world X goes here
float absZ; // always 0 in toee
float absY; // world Y goes here
PointNode();
PointNode(float x, float y, float z);
};
#pragma endregion
31 changes: 26 additions & 5 deletions TemplePlus/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,18 @@ class GenericCallbacks
public:
static int QuerySetReturnVal1(DispatcherCallbackArgs args);
static int QuerySetReturnVal0(DispatcherCallbackArgs);

static int ActionInvalidQueryTrue(DispatcherCallbackArgs);

static int EffectTooltip(DispatcherCallbackArgs args); // SubDispDef data1 denotes the effect type idx, data2 denotes combat.mes line
static int TooltipUnrepeated(DispatcherCallbackArgs); // SubDispDef data1 denotes combat.mes line

static int AddEtherealDamageImmunity(DispatcherCallbackArgs args);
static int EtherealOnAdd(DispatcherCallbackArgs args);
static int EtherealOnD20StatusInit(DispatcherCallbackArgs args);
static int EtherealDamageDealingNull(DispatcherCallbackArgs);
static int EtherealOnRemove(DispatcherCallbackArgs);




} genericCallbacks;

Expand Down Expand Up @@ -553,6 +556,12 @@ int GenericCallbacks::QuerySetReturnVal0(DispatcherCallbackArgs args)
return 0;
}

int GenericCallbacks::ActionInvalidQueryTrue(DispatcherCallbackArgs args){
auto dispIo = dispatch.DispIoCheckIoType7(args.dispIO);
dispIo->return_val = 1;
return 0;
}

int GenericCallbacks::AddEtherealDamageImmunity(DispatcherCallbackArgs args){
auto dispIo = dispatch.DispIoCheckIoType4(args.dispIO);
dispIo->damage.AddEtherealImmunity();
Expand All @@ -566,6 +575,11 @@ int GenericCallbacks::EtherealOnAdd(DispatcherCallbackArgs args)
return 0;
}

int GenericCallbacks::EtherealOnD20StatusInit(DispatcherCallbackArgs args){
objects.FadeTo(args.objHndCaller, 60, 10, 30, 0);
return 0;
}

int GenericCallbacks::EtherealDamageDealingNull(DispatcherCallbackArgs args){
auto dispIo = dispatch.DispIoCheckIoType4(args.dispIO);
dispIo->damage.AddEtherealImmunity();
Expand Down Expand Up @@ -2842,10 +2856,17 @@ void Conditions::AddConditionsToTable(){
ethereal.AddHook(dispTypeEffectTooltip, DK_NONE, genericCallbacks.EffectTooltip, 82, 210);
ethereal.AddHook(dispTypeD20Query, DK_QUE_Critter_Is_Invisible, genericCallbacks.QuerySetReturnVal1);
ethereal.AddHook(dispTypeConditionAdd, DK_NONE, genericCallbacks.EtherealOnAdd);
ethereal.AddHook(dispTypeConditionAddFromD20StatusInit, DK_NONE, genericCallbacks.EtherealOnAdd);
ethereal.AddHook(dispTypeConditionAddFromD20StatusInit, DK_NONE, genericCallbacks.EtherealOnD20StatusInit);
ethereal.AddHook(dispTypeConditionRemove, DK_NONE, genericCallbacks.EtherealOnRemove);
ethereal.AddHook(dispTypeTooltip, DK_NONE, genericCallbacks.TooltipUnrepeated);

ethereal.AddHook(dispTypeTooltip, DK_NONE, genericCallbacks.TooltipUnrepeated, 210, 0);
ethereal.AddHook(dispTypeD20Query, DK_QUE_IsActionInvalid_CheckAction, genericCallbacks.ActionInvalidQueryTrue);
ethereal.AddHook(dispTypeD20Query, DK_QUE_Critter_Is_Immune_Poison, genericCallbacks.QuerySetReturnVal1);
ethereal.AddHook(dispTypeD20Query, DK_QUE_AOOWillTake, genericCallbacks.QuerySetReturnVal0);
ethereal.AddHook(dispTypeD20Query, DK_QUE_AOOIncurs, genericCallbacks.QuerySetReturnVal0);
ethereal.AddHook(dispTypeD20Query, DK_QUE_ActionTriggersAOO,genericCallbacks.QuerySetReturnVal0);
ethereal.AddHook(dispTypeD20Query, DK_QUE_Critter_Has_Freedom_of_Movement, genericCallbacks.QuerySetReturnVal1);
ethereal.AddHook(dispTypeD20Query, DK_QUE_CanBeAffected_PerformAction, genericCallbacks.QuerySetReturnVal0);
ethereal.AddHook(dispTypeD20Query, DK_QUE_CanBeAffected_ActionFrame, genericCallbacks.QuerySetReturnVal0);

// New Conditions!
conds.hashmethods.CondStructAddToHashtable((CondStruct*)conds.mConditionDisableAoO);
Expand Down
1 change: 1 addition & 0 deletions TemplePlus/d20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ uint32_t LegacyD20System::d20Query(objHndl objHnd, D20DispatcherKey dispKey)
dispIO.return_val = 0;
dispIO.data1 = 0;
dispIO.data2 = 0;

objects.dispatch.DispatcherProcessor(dispatcher, dispTypeD20Query, dispKey, &dispIO);
if (dispKey == DK_QUE_Critter_Is_Charmed || dispKey == DK_QUE_Critter_Is_Afraid || dispKey == DK_QUE_Critter_Is_Held) {
// in these cases the information stored is an objhandle; make sure it's a valid handle!
Expand Down
37 changes: 34 additions & 3 deletions TemplePlus/radialmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class RadialMenuReplacements : public TempleFix
return "Radial Menu Replacements";
}

static int RmbReleasedHandler(TigMsg* msg);

void apply() override {
// RadialMenuUpdate
replaceFunction<void(__cdecl)(objHndl)>(0x1004D1F0, [](objHndl objHnd){
Expand Down Expand Up @@ -126,17 +128,23 @@ class RadialMenuReplacements : public TempleFix

if (radialMenus.GetActiveRadialMenuNode() == -1)
return 0;




// keypress
if (evtType != TigMsgType::MOUSE){
if (evtType == TigMsgType::KEYSTATECHANGE){
return radialMenus.RadialMenuKeypressHandler(msg);
}
return 0;
}

auto mouseFlags = static_cast<MouseStateFlags>(msg->arg4);
if (! (mouseFlags&MSF_LMB_RELEASED )){
if (mouseFlags & MSF_RMB_RELEASED){
//return RmbReleasedHandler(msg);
RmbReleasedHandler(msg);
}
}

auto result = orgMsgHandler(msg);
return result;
});
Expand All @@ -145,6 +153,23 @@ class RadialMenuReplacements : public TempleFix
}
};

int RadialMenuReplacements::RmbReleasedHandler(TigMsg* msg)
{
float radX, radY;
radialMenus.GetRadialMenuXY(radX, radY);

float screenX, screenY;
auto worldToLocalScreen = temple::GetRef<void(__cdecl)(PointNode, float&, float&)>(0x10029040);
worldToLocalScreen(PointNode(radX, 0, radY), screenX, screenY);

auto& intgameRadialmenuIgnoreClose = temple::GetRef<BOOL>(0x10BE6D80);
auto& intgameRadialmenuIgnoreCloseTillMove = temple::GetRef<BOOL>(0x10BE6D70);

// todo: finish rest of this

return 1;
}

RadialMenuReplacements radMenuReplace;


Expand Down Expand Up @@ -406,6 +431,12 @@ int RadialMenus::RadialMenuKeypressHandler(TigMsg* msg)

}

void RadialMenus::GetRadialMenuXY(float& radX, float& radY) const
{
radX = temple::GetRef<float>(0x10BD022C);
radY = temple::GetRef<float>(0x10BD0228);
}

RadialMenuEntry::RadialMenuEntry(){
SetDefaults();
}
Expand Down
4 changes: 4 additions & 0 deletions TemplePlus/radialmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ class RadialMenus {

void ClearActiveRadialMenu();
int RadialMenuKeypressHandler(TigMsg* msg);
/*
gets the radial menu coordinates in absolute worldspace coords
*/
void GetRadialMenuXY(float& radX, float& radY) const;
};

extern RadialMenus radialMenus;
10 changes: 10 additions & 0 deletions tpdata/templeplus/lib/templeplus/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
D20DAP_SLASHING = 0x800
D20DAP_MITHRIL = 0x1000
D20DAP_COLD = 0x2000
D20DAP_FORCE = 0x4000

D20DT_UNSPECIFIED = -1
D20DT_BLUDGEONING = 0
Expand Down Expand Up @@ -695,6 +696,12 @@
Q_Item_Has_Keen_Bonus = 111
Q_AI_Has_Spell_Override = 112
Q_Weapon_Get_Keen_Bonus = 113
Q_Disarmed = 114
# 115 belongs to a S_ constant, oops - SA
Q_Can_Perform_Disarm = 116
Q_Craft_Wand_Spell_Level = 117
Q_Is_Ethereal = 118
Q_Empty_Body_Num_Rounds = 119

RADIAL_MENU_PARAM_MIN_SETTING = 1
RADIAL_MENU_PARAM_MAX_SETTING = 2
Expand Down Expand Up @@ -788,6 +795,9 @@
S_Web_Burning = 56
S_Anim_CastConjureEnd = 57
S_Item_Remove_Enhancement = 58
S_Disarmed_Weapon_Retrieve = 59
S_Disarm = 60 # reset the "took damage-> abort" flag
S_AID_ANOTHER_WAKE_UP = 61

TAG_TUT_REST_CAMP = 1
TAG_TUT_PORTRAITS = 2
Expand Down
Binary file modified tpdata/tpgamefiles.dat
Binary file not shown.

0 comments on commit 13484ae

Please sign in to comment.