Skip to content

Commit

Permalink
improved iwd/iwd2 creature field compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
AvengerTeamBG committed Jan 5, 2013
1 parent 6c6f233 commit 31d4d4b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gemrb/GUIScripts/ie_stats.py
Expand Up @@ -64,7 +64,7 @@

MC_PLOT_CRITICAL = 0x2000
MC_BEENINPARTY = 0x8000
MC_HIDDEN = 0x10000
MC_SEENPARTY = 0x10000

# stats
IE_HITPOINTS = 0
Expand Down
4 changes: 2 additions & 2 deletions gemrb/includes/ie_stats.h
Expand Up @@ -196,8 +196,8 @@ namespace GemRB {
#define MC_HIDE_HP 0x1000 //also 'large creature' according to IE dev info
#define MC_PLOT_CRITICAL 0x2000 //if dies, it means game over, also 'limbo creature' according to IE dev info
#define MC_BEENINPARTY 0x8000
#define MC_HIDDEN 0x10000 //iwd

#define MC_SEENPARTY 0x10000 //iwd2
#define MC_INVULNERABLE 0x20000 //iwd2
#define MC_NO_TALK 0x80000 //ignore dialoginterrupt

//stats
Expand Down
13 changes: 13 additions & 0 deletions gemrb/plugins/AREImporter/AREImporter.cpp
Expand Up @@ -970,6 +970,19 @@ Map* AREImporter::GetMap(const char *ResRef, bool day_or_night)
if ((Flags&AF_NAME_OVERRIDE) || (core->HasFeature(GF_IWD2_SCRIPTNAME)) ) {
ab->SetScriptName(DefaultName);
}
//IWD2 specific hacks
if (core->HasFeature(GF_IWD2_SCRIPTNAME)) {
//This flag is used for something else in IWD2
if (Flags&AF_NAME_OVERRIDE) {
ab->BaseStats[IE_EA]=EA_EVILCUTOFF;
}
if (Flags&AF_SEEN_PARTY) {
ab->SetMCFlag(MC_SEENPARTY,BM_OR);
}
if (Flags&AF_INVULNERABLE) {
ab->SetMCFlag(MC_INVULNERABLE,BM_OR);
}
}

if (Dialog[0]) {
ab->SetDialog(Dialog);
Expand Down
19 changes: 16 additions & 3 deletions gemrb/plugins/CREImporter/CREImporter.cpp
Expand Up @@ -1813,7 +1813,16 @@ void CREImporter::GetActorIWD2(Actor *act)
act->BaseStats[IE_SAVEDYPOS] = tmpWord;
str->ReadWord( &tmpWord );
act->BaseStats[IE_SAVEDFACE] = tmpWord;
str->Seek( 146, GEM_CURRENT_POS );

str->Seek( 15, GEM_CURRENT_POS );
str->Read( &tmpByte, 1);
act->BaseStats[IE_TRANSLUCENT]=tmpByte;
str->Read( &tmpByte, 1); //fade speed
str->Read( &tmpByte, 1); //spec. flags
str->Read( &tmpByte, 1); //invisible
str->ReadWord( &tmpWord); //unknown
str->Read( &tmpByte, 1); //unused skill points
str->Seek( 124, GEM_CURRENT_POS );
str->Read( &tmpByte, 1);
act->BaseStats[IE_EA]=tmpByte;
str->Read( &tmpByte, 1);
Expand Down Expand Up @@ -2745,7 +2754,7 @@ int CREImporter::PutActorIWD2(DataStream *stream, Actor *actor)
ieByte tmpByte;
ieWord tmpWord;
int i;
char filling[146];
char filling[124];

memset(filling,0,sizeof(filling));
tmpByte=(ieByte) actor->BaseStats[IE_AVATARREMOVAL];
Expand All @@ -2766,7 +2775,11 @@ int CREImporter::PutActorIWD2(DataStream *stream, Actor *actor)
stream->WriteWord( &tmpWord);
tmpWord = actor->BaseStats[IE_SAVEDFACE];
stream->WriteWord( &tmpWord);
stream->Write( filling, 146);
stream->Write( filling, 15);
tmpByte = actor->BaseStats[IE_TRANSLUCENT];
stream->Write(&tmpByte, 1);
stream->Write( filling, 6); //fade speed, spec flags, invisible, unused skill points
stream->Write( filling, 124);
//similar in all engines
tmpByte = actor->BaseStats[IE_EA];
stream->Write( &tmpByte, 1);
Expand Down
8 changes: 3 additions & 5 deletions gemrb/plugins/FXOpcodes/FXOpcodes.cpp
Expand Up @@ -5400,8 +5400,7 @@ int fx_power_word_stun (Scriptable* Owner, Actor* target, Effect* fx)
int fx_imprisonment (Scriptable* /*Owner*/, Actor* target, Effect* fx)
{
if(0) print("fx_imprisonment(%2d)", fx->Opcode);
//target->SetMCFlag(MC_HIDDEN, BM_OR);
STAT_BIT_OR( IE_MC_FLAGS, MC_HIDDEN );
STAT_SET(IE_AVATARREMOVAL, 1);
target->AddPortraitIcon(PI_PRISON);
return FX_APPLIED;
}
Expand Down Expand Up @@ -5434,9 +5433,8 @@ int fx_maze (Scriptable* /*Owner*/, Actor* target, Effect* fx)
fx->Duration = game->GameTime+target->LuckyRoll(dice, size, 0, 0)*100;
}
}

//target->SetMCFlag(MC_HIDDEN, BM_OR);
STAT_BIT_OR( IE_MC_FLAGS, MC_HIDDEN );

STAT_SET(IE_AVATARREMOVAL, 1);
target->AddPortraitIcon(PI_MAZE);
return FX_APPLIED;
}
Expand Down

0 comments on commit 31d4d4b

Please sign in to comment.