From: <ave...@us...> - 2007-06-22 15:17:52
|
Revision: 4703 http://gemrb.svn.sourceforge.net/gemrb/?rev=4703&view=rev Author: avenger_teambg Date: 2007-06-22 08:17:47 -0700 (Fri, 22 Jun 2007) Log Message: ----------- added possibility to disable 'DeathOnZeroStat' feature Modified Paths: -------------- gemrb/trunk/gemrb/includes/globals.h gemrb/trunk/gemrb/override/iwd2/gemrb.ini gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp Modified: gemrb/trunk/gemrb/includes/globals.h =================================================================== --- gemrb/trunk/gemrb/includes/globals.h 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/includes/globals.h 2007-06-22 15:17:47 UTC (rev 4703) @@ -126,9 +126,10 @@ #define GF_CHALLENGERATING 29 //iwd2 #define GF_SPELLBOOKICONHACK 30 //bg2 #define GF_ENHANCED_EFFECTS 31 //iwd2 (maybe iwd/how too) +#define GF_DEATH_ON_ZERO_STAT 32 //not in iwd2 //update this -#define GF_COUNT 32 +#define GF_COUNT 33 //the number of item usage fields (used in CREItem and STOItem) #define CHARGE_COUNTERS 3 Modified: gemrb/trunk/gemrb/override/iwd2/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/iwd2/gemrb.ini 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/override/iwd2/gemrb.ini 2007-06-22 15:17:47 UTC (rev 4703) @@ -73,3 +73,4 @@ CharNameIsGabber = 1 MagicBit = 1 ChallengeRating = 1 +DeathOnZeroStat = 0 Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-22 15:17:47 UTC (rev 4703) @@ -85,7 +85,8 @@ ActionButtonRow DefaultButtons = {ACT_TALK, ACT_WEAPON1, ACT_WEAPON2, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_INNATE}; -static int QslotTranslation = false; +static bool QslotTranslation = false; +static bool DeathOnZeroStat = true; static char iwd2gemrb[32] = { 0,0,20,2,22,25,0,14, @@ -180,8 +181,8 @@ static int spllevels; //for every game except IWD2 we need to reverse TOHIT -static bool REVERSE_TOHIT=true; -static bool CHECK_ABILITIES=false; +static bool ReverseToHit=true; +static bool CheckAbilities=false; //internal flags for calculating to hit #define WEAPON_FIST 0 @@ -636,26 +637,52 @@ } } -void pcf_con(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +void pcf_stat(Actor *actor, ieDword newValue, ieDword stat) { if ((signed) newValue<=0) { - actor->Die(NULL); + if (DeathOnZeroStat) { + actor->Die(NULL); + } else { + actor->Modified[stat]=1; + } } - //passing 0 because it is ignored anyway + if (actor->InParty) { + core->SetEventFlag(EF_PORTRAIT); + } +} + +void pcf_stat_str(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_STR); +} + +void pcf_stat_int(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_INT); +} + +void pcf_stat_wis(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_WIS); +} + +void pcf_stat_dex(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_DEX); +} + +void pcf_stat_con(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_CON); pcf_hitpoint(actor, 0, actor->Modified[IE_HITPOINTS]); } -void pcf_stat(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +void pcf_stat_cha(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { - if ((signed) newValue<=0) { - actor->Die(NULL); - } - if (actor->InParty) { - core->SetEventFlag(EF_PORTRAIT); - } + pcf_stat(actor, newValue, IE_CHR); } -void pcf_gold(Actor *actor, ieDword /*Value*/, ieDword /*newValue*/) +void pcf_gold(Actor *actor, ieDword /*oldValue*/, ieDword /*newValue*/) { //this function will make a party member automatically donate their //gold to the party pool, not the same as in the original engine @@ -829,8 +856,8 @@ NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, //0f NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL,NULL, NULL, NULL, pcf_fatigue, pcf_intoxication, //1f -NULL,NULL,pcf_level,NULL, pcf_stat, NULL, pcf_stat, pcf_stat, -pcf_stat,pcf_con,NULL,NULL, NULL, pcf_gold, pcf_morale, NULL, //2f +NULL,NULL,pcf_level,NULL, pcf_stat_str, NULL, pcf_stat_int, pcf_stat_wis, +pcf_stat_dex,pcf_stat_con,pcf_stat_cha,NULL, NULL, pcf_gold, pcf_morale, NULL, //2f NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL,NULL, NULL, NULL, pcf_entangle, pcf_sanctuary, //3f pcf_minorglobe, pcf_shieldglobe, pcf_grease, pcf_web, pcf_level, pcf_level, NULL, NULL, @@ -909,8 +936,9 @@ } else { sharexp=SX_DIVIDE; } - REVERSE_TOHIT=(bool) core->HasFeature(GF_REVERSE_TOHIT); - CHECK_ABILITIES=(bool) core->HasFeature(GF_CHECK_ABILITIES); + ReverseToHit=(bool) core->HasFeature(GF_REVERSE_TOHIT); + CheckAbilities=(bool) core->HasFeature(GF_CHECK_ABILITIES); + DeathOnZeroStat=(bool) core->HasFeature(GF_DEATH_ON_ZERO_STAT); //this table lists skill groups assigned to classes //it is theoretically possible to create hybrid classes @@ -942,7 +970,7 @@ maximum_values[IE_CON]=i; maximum_values[IE_CHR]=i; maximum_values[IE_WIS]=i; - if (REVERSE_TOHIT) { + if (ReverseToHit) { //all games except iwd2 maximum_values[IE_ARMORCLASS]=20; } else { @@ -2322,7 +2350,7 @@ int Actor::GetToHit(int bonus, ieDword Flags) { int tohit = GetStat(IE_TOHIT); - if (REVERSE_TOHIT) { + if (ReverseToHit) { tohit = ATTACKROLL-tohit; } tohit += bonus; @@ -2450,7 +2478,7 @@ //get target's defense against attack int defense = target->GetStat(IE_ARMORCLASS); defense += core->GetDexterityBonus(STAT_DEX_AC, target->GetStat(IE_DEX) ); - if (REVERSE_TOHIT) { + if (ReverseToHit) { defense = DEFAULTAC - defense; } @@ -3336,7 +3364,7 @@ bool Actor::IsReverseToHit() { - return REVERSE_TOHIT; + return ReverseToHit; } void Actor::InitButtons(ieDword cls) @@ -3513,7 +3541,7 @@ } } - if (!CHECK_ABILITIES) { + if (!CheckAbilities) { return 0; } Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-06-22 15:17:47 UTC (rev 4703) @@ -2098,7 +2098,7 @@ pl_lowercase[upper]=(ieByte) lower; } -static const char *game_flags[GF_COUNT]={ +static const char *game_flags[GF_COUNT+1]={ "HasKaputz", //0 GF_HAS_KAPUTZ "AllStringsTagged", //1 GF_ALL_STRINGS_TAGGED "HasSongList", //2 GF_HAS_SONGLIST @@ -2131,6 +2131,9 @@ "ChallengeRating", //29GF_CHALLENGERATING "SpellBookIconHack", //30GF_SPELLBOOKICONHACK "EnhancedEffects", //31GF_ENHANCED_EFFECTS + "DeathOnZeroStat", //32GF_DEATH_ON_ZERO_STAT + + NULL //for our own safety, this marks the end of the pole }; /** Loads gemrb.ini */ @@ -2255,6 +2258,10 @@ RedrawTile = ini->GetKeyAsInt( "resources", "RedrawTile", 0 )!=0; for (i=0;i<GF_COUNT;i++) { + if (!game_flags[i]) { + printf("Fix the game flags!\n"); + abort(); + } SetFeature( ini->GetKeyAsInt( "resources", game_flags[i], 0 ), i ); printMessage("Option", "", GREEN); printf("%s = %s\n", game_flags[i], HasFeature(i)?"yes":"no"); Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-22 15:17:47 UTC (rev 4703) @@ -302,20 +302,43 @@ static int fx_death_ward (Actor* Owner, Actor* target, Effect* fx); //407 static int fx_holy_power (Actor* Owner, Actor* target, Effect* fx); //408 static int fx_righteous_wrath (Actor* Owner, Actor* target, Effect* fx); //409 +//static int fx_summon_ally_iwd2 (Actor* Owner, Actor* target, Effect* fx); //410 +//static int fx_summon_enemy_iwd2 (Actor* Owner, Actor* target, Effect* fx); //411 static int fx_control (Actor* Owner, Actor* target, Effect* fx); //412 static int fx_visual_effect_iwd2 (Actor* Owner, Actor* target, Effect* fx); //413 static int fx_resilient_sphere (Actor* Owner, Actor* target, Effect* fx); //414 static int fx_barkskin (Actor* Owner, Actor* target, Effect* fx); //415 +static int fx_bleeding_wounds (Actor* Owner, Actor* target, Effect* fx); //416 static int fx_free_action_iwd2 (Actor* Owner, Actor* target, Effect* fx); //418 static int fx_unconsciousness (Actor* Owner, Actor* target, Effect* fx); //419 static int fx_entropy_shield (Actor* Owner, Actor* target, Effect* fx); //421 static int fx_storm_shell (Actor* Owner, Actor* target, Effect* fx); //422 static int fx_protection_from_elements (Actor* Owner, Actor* target, Effect* fx); //423 - +//424 HoldUndead (same as 0x6d) +//425 ControlUndead static int fx_aegis (Actor* Owner, Actor* target, Effect* fx); //426 static int fx_executioner_eyes (Actor* Owner, Actor* target, Effect* fx); //427 + +static int fx_energy_drain (Actor* Owner, Actor* target, Effect* fx); //431 +static int fx_tortoise_shell (Actor* Owner, Actor* target, Effect* fx); //432 +static int fx_blink (Actor* Owner, Actor* target, Effect* fx); //433 + +static int fx_heroic_inspiration (Actor* Owner, Actor* target, Effect* fx); //438 //static int fx_prevent_ai_slowdown (Actor* Owner, Actor* target, Effect* fx); //439 +static int fx_tenser_transformation (Actor* Owner, Actor* target, Effect* fx); //444 +//static int fx_445 (Actor* Owner, Actor* target, Effect* fx); //445 unused +static int fx_smite_evil (Actor* Owner, Actor* target, Effect* fx); //446 +static int fx_restoration (Actor* Owner, Actor* target, Effect* fx); //447 +static int fx_alicorn_lance (Actor* Owner, Actor* target, Effect* fx); //448 +static int fx_call_lightning (Actor* Owner, Actor* target, Effect* fx); //449 +static int fx_globe_invulnerability (Actor* Owner, Actor* target, Effect* fx); //450 +static int fx_lower_resistance (Actor* Owner, Actor* target, Effect* fx); //451 static int fx_bane (Actor* Owner, Actor* target, Effect* fx); //452 +static int fx_power_attack (Actor* Owner, Actor* target, Effect* fx); //453 +static int fx_expertise (Actor* Owner, Actor* target, Effect* fx); //454 +static int fx_arterial_strike (Actor* Owner, Actor* target, Effect* fx); //455 +static int fx_hamstring (Actor* Owner, Actor* target, Effect* fx); //456 +static int fx_rapid_shot (Actor* Owner, Actor* target, Effect* fx); //457 //No need to make these ordered, they will be ordered by EffectQueue static EffectRef effectnames[] = { @@ -387,10 +410,13 @@ { "DeathWard", fx_death_ward, 0}, //407 { "HolyPower", fx_holy_power, 0}, //408 { "RighteousWrath", fx_righteous_wrath, 0}, //409 + { "Control2", fx_control, 0}, //412 { "VisualEffectIWD2", fx_visual_effect_iwd2, 0}, //413 { "ResilientSphere", fx_resilient_sphere, 0}, //414 { "BarkSkin", fx_barkskin, 0}, //415 + { "BleedingWounds", fx_bleeding_wounds, 0},//416 + { "FreeAction2", fx_free_action_iwd2, 0}, //418 { "Unconsciousness", fx_unconsciousness, 0}, //419 { "EntropyShield", fx_entropy_shield, 0}, //421 @@ -399,9 +425,24 @@ { "ControlUndead2", fx_control_undead, 0}, //425 { "Aegis", fx_aegis, 0}, //426 { "ExecutionerEyes", fx_executioner_eyes, 0}, //427 - + { "EnergyDrain", fx_energy_drain, 0}, //431 + { "TortoiseShell", fx_tortoise_shell, 0}, //432 + { "Blink", fx_blink, 0},//433 + { "HeroicInspiration", fx_heroic_inspiration, 0},//438 //{ "PreventAISlowDown", fx_prevent_ai_slowdown, 0}, //439 same as bg2 - { "Bane", fx_bane, 0}, + { "TensersTransformation", fx_tenser_transformation, 0}, //444 + { "SmiteEvil", fx_smite_evil, 0}, //446 + { "Restoration", fx_restoration, 0}, //447 + { "AlicornLance", fx_alicorn_lance, 0}, //448 + { "CallLightning", fx_call_lightning, 0}, //449 + { "GlobeInvulnerability", fx_globe_invulnerability, 0}, //450 + { "LowerResistance", fx_lower_resistance, 0}, //451 + { "Bane", fx_bane, 0}, //452 + { "PowerAttack", fx_power_attack, 0}, //453 + { "Expertise", fx_expertise, 0}, //454 + { "ArterialStrike", fx_arterial_strike, 0}, //455 + { "HamString", fx_hamstring, 0}, //456 + { "RapidShot", fx_rapid_shot, 0}, //457 { NULL, NULL, 0 }, }; @@ -1573,7 +1614,7 @@ int fx_hopelessness (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_hopelessness (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_HOPELESSNESS)) return FX_APPLIED; + if (SetSpellState(target, SS_HOPELESSNESS)) return FX_NOT_APPLIED; target->AddPortraitIcon(PI_HOPELESSNESS); STATE_SET(STATE_HELPLESS); return FX_APPLIED; @@ -2065,11 +2106,21 @@ //same as BG2 OffscreenAIModifier //440 BarbarianRage + //441 MovementRateModifier4 + //442 Unknown (needs research) + //443 MissileDamageReduction +int fx_missile_damage_reduction (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_missile_damage_reduction (%2d)\n", fx->Opcode); + STAT_SET(IE_RESISTMISSILE, fx->Parameter1); + //didn't set the pluses + return FX_APPLIED; +} + //444 TensersTransformation - int fx_tenser_transformation (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_tenser_transformation (%2d)\n", fx->Opcode); @@ -2081,6 +2132,7 @@ } //445 Unknown (empty function in iwd2) + //446 SmiteEvil int fx_smite_evil (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -2144,9 +2196,9 @@ } //450 GlobeInvulnerability -int fx_minor_globe (Actor* /*Owner*/, Actor* target, Effect* fx) +int fx_globe_invulnerability (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_minor_globe (%2d)\n", fx->Opcode); + if (0) printf( "fx_globe_invulnerability (%2d)\n", fx->Opcode); int state; int icon; int value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |