From: <ave...@us...> - 2007-11-02 11:22:40
|
Revision: 4805 http://gemrb.svn.sourceforge.net/gemrb/?rev=4805&view=rev Author: avenger_teambg Date: 2007-11-02 04:22:35 -0700 (Fri, 02 Nov 2007) Log Message: ----------- fixed ApplyEffect guiscript command fixed problems caused by GetFirstSelectedPC when no pc was selected implemented RevealMagic effect, improved other effects rearranged stats Modified Paths: -------------- gemrb/trunk/gemrb/includes/ie_stats.h gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp gemrb/trunk/gemrb/plugins/Core/ActorBlock.h gemrb/trunk/gemrb/plugins/Core/Game.cpp gemrb/trunk/gemrb/plugins/Core/GameControl.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.h gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Map.cpp gemrb/trunk/gemrb/plugins/Core/Triggers.cpp gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/includes/ie_stats.h =================================================================== --- gemrb/trunk/gemrb/includes/ie_stats.h 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/includes/ie_stats.h 2007-11-02 11:22:35 UTC (rev 4805) @@ -396,7 +396,14 @@ #define IE_TITLE2 173 #define IE_DISABLEOVERLAY 174 #define IE_DISABLEBACKSTAB 175 - +//these are unknown, but already used in GemRB +//176 +//177 +//178 +//179 +//180 +//181 +//182 #define IE_ENABLEOFFSCREENAI 183 // bg2 has this on this spot #define IE_EXISTANCEDELAY 184 // (sound2mn) #define IE_ATTACKNUMBERDOUBLE 185 // used by haste option 2 @@ -406,6 +413,7 @@ #define IE_NPCBUMP 190 // not entirely sure what is this #define IE_CANUSEANYITEM 191 #define IE_ALWAYSBACKSTAB 192 +//193 #define IE_SPELLFAILUREINNATE 194 #define IE_NOTRACKING 195 // tracking doesn't detect this #define IE_DEADMAGIC 196 @@ -442,7 +450,7 @@ #define IE_MC_FLAGS 215 #define IE_CLASSLEVELSUM 216 //iwd2 #define IE_ALIGNMENT 217 -#define IE_UNSELECTABLE 218 +//#define IE_UNSELECTABLE 218 #define IE_ARMOR_TYPE 219 #define IE_TEAM 220 #define IE_FACTION 221 Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -3086,11 +3086,18 @@ void GameScript::MakeUnselectable(Scriptable* Sender, Action* parameters) { + Sender->UnselectableTimer=parameters->int0Parameter; + + //update color if (Sender->Type != ST_ACTOR) { return; } Actor* actor = ( Actor* ) Sender; - actor->SetBase(IE_UNSELECTABLE,parameters->int0Parameter); + if (parameters->int0Parameter) { + actor->Select(0); + } + + actor->SetCircleSize(); } void GameScript::Debug(Scriptable* /*Sender*/, Action* parameters) Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -413,7 +413,10 @@ const Color *color; int color_index; - if (Modified[IE_UNSELECTABLE]) { + if (!anims) + return; + + if (UnselectableTimer) { color = &magenta; color_index = 4; } else if (Modified[IE_STATE_ID] & STATE_PANIC) { @@ -445,8 +448,6 @@ } } - if (!anims) - return; int csize = anims->GetCircleSize() - 1; if (csize >= MAX_CIRCLE_SIZE) csize = MAX_CIRCLE_SIZE - 1; @@ -2203,7 +2204,7 @@ if (Modified[IE_STATE_ID] & STATE_DEAD) return false; } if (ga_flags&GA_SELECT) { - if (Modified[IE_UNSELECTABLE]) return false; + if (UnselectableTimer) return false; } return true; } Modified: gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -61,6 +61,7 @@ LastPickLockFailed = 0; DialogName = 0; CurrentAction = NULL; + UnselectableTimer = 0; startTime = 0; interval = ( 1000 / AI_UPDATE_TIME ); WaitCounter = 0; @@ -73,7 +74,6 @@ area = 0; Pos.x = 0; Pos.y = 0; - scriptName[0] = 0; SpellHeader = -1; LastTargetPos.empty(); @@ -223,7 +223,7 @@ } } -void Scriptable::ExecuteScript(GameScript* Script) +void Scriptable::ExecuteScript(int scriptCount) { if (core->GetGameControl()->GetScreenFlags()&SF_CUTSCENE) { return; @@ -231,9 +231,24 @@ if (WaitCounter) { return; } - if (Script) { - Script->Update(); + + bool alive = false; + + for (int i=0;i<scriptCount;i++) + { + GameScript *Script = Scripts[i]; + if (Script) { + alive |= Script->Update(); + } } + if (alive && UnselectableTimer) { + UnselectableTimer--; + if (!UnselectableTimer) { + if (Type==ST_ACTOR) { + ((Actor *) this)->SetCircleSize(); + } + } + } } void Scriptable::AddAction(Action* aC) Modified: gemrb/trunk/gemrb/plugins/Core/ActorBlock.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorBlock.h 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/ActorBlock.h 2007-11-02 11:22:35 UTC (rev 4805) @@ -185,6 +185,7 @@ char* overHeadText; unsigned char textDisplaying; unsigned long timeStartDisplaying; + ieDword UnselectableTimer; ieDword LastTrigger; // also LastClosed ieDword LastEntered; // also LastOpened ieDword LastDisarmed; // also LastAttacker @@ -228,7 +229,7 @@ void SetScriptName(const char* text); //call this to enable script running as soon as possible void ImmediateEvent(); - void ExecuteScript(GameScript* Script); + void ExecuteScript(int scriptCount); void AddAction(Action* aC); void AddActionInFront(Action* aC); Action* GetNextAction(); Modified: gemrb/trunk/gemrb/plugins/Core/Game.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Game.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Game.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -1054,7 +1054,7 @@ CombatCounter++; } } - ExecuteScript( Scripts[0] ); + ExecuteScript( 1 ); ProcessActions(false); size_t idx; Modified: gemrb/trunk/gemrb/plugins/Core/GameControl.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -67,7 +67,7 @@ 0x00, 0x00, 0xff, 0x80 }; -Animation* effect; +//Animation* effect; #define FORMATIONSIZE 10 typedef Point formation_type[FORMATIONSIZE]; @@ -112,7 +112,7 @@ moveX = moveY = 0; DebugFlags = 0; AIUpdateCounter = 1; - effect = NULL; +// effect = NULL; ieDword tmp=0; target_mode = TARGET_MODE_NONE; @@ -318,7 +318,7 @@ return; } if ( game->selected.size() > 0 ) { - ChangeMap(core->GetFirstSelectedPC(), false); + ChangeMap(core->GetFirstSelectedPC(true), false); } Video* video = core->GetVideoDriver(); Region viewport = video->GetViewport(); @@ -441,6 +441,7 @@ //Draw spell effect, this must be stored in the actors //not like this + /* if (effect) { if (( game->selected.size() > 0 )) { Actor* actor = core->GetFirstSelectedPC(); @@ -448,6 +449,7 @@ actor->Pos.y, false ); } } + */ // Show traps if (DebugFlags & DEBUG_SHOW_INFOPOINTS) { @@ -657,16 +659,9 @@ } break; case 'l': - if (game->selected.size() > 0) { - if (!effect) { - AnimationFactory* af = ( AnimationFactory* ) - core->GetResourceMgr()->GetFactoryResource( "S056ICBL", IE_BAM_CLASS_ID ); - - effect = af->GetCycle( 1 ); - } else { - delete( effect ); - effect = NULL; - } + //the original engine was able to swap through all animations + if (lastActor) { + lastActor->AddAnimation("S056ICBL", 0, 0, 0); } break; @@ -982,7 +977,7 @@ } else if (target_mode & TARGET_MODE_PICK) { if (lastActor) { nextCursor = IE_CURSOR_PICK; - if (lastActor == core->GetFirstSelectedPC()) { + if (lastActor == core->GetFirstSelectedPC(false)) { nextCursor |= IE_CURSOR_GRAY; } } else { @@ -1367,16 +1362,16 @@ if (!actor && ( game->selected.size() > 0 )) { if (overDoor) { - HandleDoor(overDoor, core->GetFirstSelectedPC()); + HandleDoor(overDoor, core->GetFirstSelectedPC(false)); return; } if (overInfoPoint) { - if (HandleActiveRegion(overInfoPoint, core->GetFirstSelectedPC(), p)) { + if (HandleActiveRegion(overInfoPoint, core->GetFirstSelectedPC(false), p)) { return; } } if (overContainer) { - HandleContainer(overContainer, core->GetFirstSelectedPC()); + HandleContainer(overContainer, core->GetFirstSelectedPC(false)); return; } @@ -1384,7 +1379,7 @@ if (game->selected.size()==1) { //the player is using an item or spell on the ground if (spellCount) { - TryToCast(core->GetFirstSelectedPC(), p); + TryToCast(core->GetFirstSelectedPC(false), p); return; } @@ -1467,7 +1462,7 @@ if (core->HasFeature(GF_PROTAGONIST_TALKS) ) { source = game->FindPC(1); //protagonist } else { - source = core->GetFirstSelectedPC(); + source = core->GetFirstSelectedPC(false); } TryToTalk(source, actor); } @@ -1481,7 +1476,7 @@ case ACT_CAST: //cast on target or use item on target if (game->selected.size()==1) { Actor *source; - source = core->GetFirstSelectedPC(); + source = core->GetFirstSelectedPC(false); TryToCast(source, actor); } break; @@ -1493,7 +1488,7 @@ case ACT_THIEVING: if (game->selected.size()==1) { Actor *source; - source = core->GetFirstSelectedPC(); + source = core->GetFirstSelectedPC(false); TryToPick(source, actor); } break; Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -1567,30 +1567,23 @@ lastRunTime = 0; } -void nop() {} - -void GameScript::Update() +bool GameScript::Update() { - if (!MySelf || !(MySelf->GetInternalFlag()&IF_ACTIVE) ) { - return; - } + if (!MySelf) + return false; + + if (!script) + return false; + ieDword thisTime = core->GetGame()->Ticks; //GetTime( thisTime ); //this should be gametime too, pause holds it if (( thisTime - lastRunTime ) < scriptRunDelay) { - return; + return false; } lastRunTime = thisTime; - if (!script) { - return; + if(!(MySelf->GetInternalFlag()&IF_ACTIVE) ) { + return true; } - // this is only for testing purposes - /* - if (!memcmp(MySelf->GetScriptName(),"cat",4) ) { - if (MySelf->GetNextAction()) { - nop(); - } - } - */ bool continueExecution = false; @@ -1604,11 +1597,11 @@ if (!continueExecution) { if (MySelf->GetNextAction()) { if (MySelf->GetInternalFlag()&IF_NOINT) { - return; + return true; } if (lastAction==a) { - return; + return true; } //movetoobjectfollow would break if this isn't called @@ -1627,6 +1620,7 @@ //continueExecution = false; } } + return true; } void GameScript::EvaluateAllBlocks() Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-11-02 11:22:35 UTC (rev 4805) @@ -609,7 +609,7 @@ unsigned long scriptRunDelay; int scriptlevel; void RunNow(); - void Update(); + bool Update(); void EvaluateAllBlocks(); private: //Internal Functions Script* CacheScript(ieResRef ResRef); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -4737,7 +4737,7 @@ void Interface::SetCurrentContainer(Actor *actor, Container *arg, bool flag) { //abort action if the first selected PC isn't the original actor - if (actor!=GetFirstSelectedPC()) { + if (actor!=GetFirstSelectedPC(false)) { CurrentContainer = NULL; return; } @@ -4898,14 +4898,20 @@ return ret; } -Actor *Interface::GetFirstSelectedPC() +Actor *Interface::GetFirstSelectedPC(bool forced) { - for (int i = 0; i < game->GetPartySize( false ); i++) { + int partySize = game->GetPartySize( false ); + if (!partySize) return NULL; + for (int i = 0; i < partySize; i++) { Actor* actor = game->GetPC( i,false ); if (actor->IsSelected()) { return actor; } } + + if (forced) { + return game->GetPC(0,false); + } return NULL; } Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-11-02 11:22:35 UTC (rev 4805) @@ -567,8 +567,9 @@ bool Exists(const char *ResRef, SClass_ID type); /** creates a vvc/bam animation object at point */ ScriptedAnimation* GetScriptedAnimation( const char *ResRef, bool doublehint); - /** returns the first selected PC */ - Actor *GetFirstSelectedPC(); + /** returns the first selected PC, if forced is set, then it returns + first PC if none was selected */ + Actor *GetFirstSelectedPC(bool forced); /** returns a single sprite (not cached) from a BAM resource */ Sprite2D* GetBAMSprite(const ieResRef ResRef, int cycle, int frame); /** returns a cursor sprite (not cached) */ Modified: gemrb/trunk/gemrb/plugins/Core/Map.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Map.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Map.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -593,7 +593,7 @@ } if (ip->Scripts[0]) { ip->LastTrigger = ip->LastEntered = actor->GetID(); - ip->ExecuteScript( ip->Scripts[0] ); + ip->ExecuteScript( 1 ); ip->ProcessActions(true); } } @@ -607,9 +607,8 @@ } //Run the Map Script - if (Scripts[0]) { - ExecuteScript( Scripts[0] ); - } + ExecuteScript( 1 ); + //Execute Pending Actions //if it is only here, then the drawing will fail ProcessActions(false); @@ -636,15 +635,7 @@ if (timestop && actor!=timestop_owner && actor->Modified[IE_DISABLETIMESTOP] ) { continue; } - for (unsigned int i = 0; i < MAX_SCRIPTS; i++) { - if (actor->Scripts[i]) { - /* this will be handled by ExecuteScript - if (actor->GetNextAction()) - break; - */ - actor->ExecuteScript( actor->Scripts[i] ); - } - } + actor->ExecuteScript( MAX_SCRIPTS ); actor->ProcessActions(false); actor->inventory.CalculateWeight(); @@ -681,7 +672,7 @@ break; if (!door->Scripts[0]) continue; - door->ExecuteScript( door->Scripts[0] ); + door->ExecuteScript( 1 ); //Execute Pending Actions door->ProcessActions(false); } @@ -706,7 +697,7 @@ //Check if this InfoPoint was activated if (ip->LastTrigger) { //Run the InfoPoint script - ip->ExecuteScript( ip->Scripts[0] ); + ip->ExecuteScript( 1 ); //Execute Pending Actions ip->ProcessActions(false); } @@ -737,7 +728,7 @@ } if (ip->Type==ST_PROXIMITY) { - ip->ExecuteScript( ip->Scripts[0] ); + ip->ExecuteScript( 1 ); //Execute Pending Actions ip->ProcessActions(false); } Modified: gemrb/trunk/gemrb/plugins/Core/Triggers.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -2561,11 +2561,13 @@ if (!tar) { return 0; } + /* if (tar->Type != ST_ACTOR) { return 0; } Actor* actor = ( Actor* ) tar; - return actor->GetStat(IE_UNSELECTABLE) == (unsigned) parameters->int0Parameter; + */ + return tar->UnselectableTimer == (unsigned) parameters->int0Parameter; } int GameScript::UnselectableVariableGT(Scriptable* Sender, Trigger* parameters) @@ -2574,21 +2576,13 @@ if (!tar) { return 0; } - if (tar->Type != ST_ACTOR) { - return 0; - } - Actor* actor = ( Actor* ) tar; - return actor->GetStat(IE_UNSELECTABLE) > (unsigned) parameters->int0Parameter; + return tar->UnselectableTimer > (unsigned) parameters->int0Parameter; } int GameScript::UnselectableVariableLT(Scriptable* Sender, Trigger* parameters) { Scriptable* tar = GetActorFromObject( Sender, parameters->objectParameter ); - if (!tar || tar->Type != ST_ACTOR) { - return 0; - } - Actor* actor = ( Actor* ) tar; - return actor->GetStat(IE_UNSELECTABLE) < (unsigned) parameters->int0Parameter; + return tar->UnselectableTimer < (unsigned) parameters->int0Parameter; } int GameScript::AreaCheck(Scriptable* Sender, Trigger* parameters) Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -57,6 +57,7 @@ #define PI_BLOODRAGE 76 //iwd2 #define PI_MAZE 78 #define PI_PRISON 79 +#define PI_DEAFNESS 83 //iwd2 #define PI_SEQUENCER 92 #define PI_BLUR 109 #define PI_IMPROVEDHASTE 110 @@ -157,6 +158,7 @@ int fx_set_diseased_state (Actor* Owner, Actor* target, Effect*fx);//4e int fx_cure_diseased_state (Actor* Owner, Actor* target, Effect* fx);//4f int fx_set_deaf_state (Actor* Owner, Actor* target, Effect* fx); //50 +int fx_set_deaf_state_iwd2 (Actor* Owner, Actor* target, Effect* fx); //50 int fx_cure_deaf_state (Actor* Owner, Actor* target, Effect* fx);//51 int fx_set_ai_script (Actor* Owner, Actor* target, Effect*fx);//52 int fx_protection_from_projectile (Actor* Owner, Actor* target, Effect*fx);//53 @@ -683,6 +685,7 @@ { "State:Charmed", fx_set_charmed_state, -1 }, //0x05 { "State:Confused", fx_set_confused_state, -1 }, { "State:Deafness", fx_set_deaf_state, -1 }, + { "State:DeafnessIWD2", fx_set_deaf_state_iwd2, -1 }, //this is a modified version { "State:Diseased", fx_set_diseased_state, -1 }, { "State:Feeblemind", fx_set_feebleminded_state, -1 }, { "State:Hasted", fx_set_hasted_state, -1 }, @@ -1257,6 +1260,9 @@ } // 0x12 MaximumHPModifier +// 0 and 3 differ in that 3 doesn't modify current hitpoints +// 1,4 are the same +// 2,5 are the same int fx_maximum_hp_modifier (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_maximum_hp_modifier (%2d): Stat Modif: %d ; Modif Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); @@ -1271,27 +1277,11 @@ BASE_ADD( IE_HITPOINTS, fx->Parameter1 ); } else { STAT_ADD( IE_MAXHITPOINTS, fx->Parameter1 ); - STAT_ADD( IE_HITPOINTS, fx->Parameter1 ); + if (fx->FirstApply) { + BASE_ADD( IE_HITPOINTS, fx->Parameter1 ); + } } break; - case 1: - if (base) { - BASE_SET( IE_MAXHITPOINTS, fx->Parameter1 ); - BASE_SET( IE_HITPOINTS, fx->Parameter1 ); - } else { - STAT_SET( IE_MAXHITPOINTS, fx->Parameter1 ); - STAT_SET( IE_HITPOINTS, fx->Parameter1 ); - } - break; - case 2: - if (base) { - BASE_MUL( IE_MAXHITPOINTS, fx->Parameter1 ); - BASE_MUL( IE_HITPOINTS, fx->Parameter1 ); - } else { - STAT_MUL( IE_MAXHITPOINTS, fx->Parameter1 ); - STAT_MUL( IE_HITPOINTS, fx->Parameter1 ); - } - break; case 3: // random value Parameter1 is set by level_check in EffectQueue if (base) { @@ -1299,15 +1289,15 @@ } else { STAT_ADD( IE_MAXHITPOINTS, fx->Parameter1 ); } - break; - case 4: + break; + case 1:case 4: if (base) { BASE_SET( IE_MAXHITPOINTS, fx->Parameter1 ); } else { STAT_SET( IE_MAXHITPOINTS, fx->Parameter1 ); } break; - case 5: + case 2:case 5: if (base) { BASE_MUL( IE_MAXHITPOINTS, fx->Parameter1 ); } else { @@ -1825,6 +1815,7 @@ return FX_NOT_APPLIED; } + // 0x33 Color:DarkenRGB int fx_darken_rgb (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1835,6 +1826,7 @@ fx->Parameter1 >> 16, fx->Parameter1 >> 24); return FX_APPLIED; } + // 0x34 Color:GlowRGB int fx_glow_rgb (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1847,6 +1839,7 @@ return FX_APPLIED; } + // 0x35 AnimationIDModifier static EffectRef fx_animation_id_modifier_ref={"AnimationIDModifier",NULL,-1}; @@ -2344,30 +2337,61 @@ // 0x50 State:Deafness // gemrb extension: modifiable amount +// none of the engines care about stacking int fx_set_deaf_state (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_set_deaf_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); + + //gemrb fix + if (target->SetSpellState(SS_DEAF)) return FX_APPLIED; + if (!fx->Parameter1) { fx->Parameter1 = 50; } STAT_ADD(IE_SPELLFAILUREMAGE, fx->Parameter1); if (!fx->Parameter2) { - fx->Parameter2 = 50; + fx->Parameter1 = 50; } STAT_ADD(IE_SPELLFAILUREPRIEST, fx->Parameter2); - EXTSTATE_SET(EXTSTATE_DEAF); + EXTSTATE_SET(EXTSTATE_DEAF); //iwd1/how needs this + if (enhanced_effects) { + target->AddPortraitIcon(PI_DEAFNESS); + } return FX_APPLIED; } +int fx_set_deaf_state_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_set_deaf_state_iwd2 (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); + + //gemrb fix + if (target->SetSpellState(SS_DEAF)) return FX_APPLIED; + + if (!fx->Parameter1) { + //this is a bad hack + fx->Parameter1 = 20; + } + STAT_ADD(IE_SPELLFAILUREMAGE, fx->Parameter1); + if (!fx->Parameter2) { + fx->Parameter1 = 20; + } + STAT_ADD(IE_SPELLFAILUREPRIEST, fx->Parameter2); + EXTSTATE_SET(EXTSTATE_DEAF); //iwd1/how needs this + target->AddPortraitIcon(PI_DEAFNESS); //iwd2 specific + return FX_APPLIED; +} + // 0x51 Cure:Deafness -static EffectRef fx_deaf_state_ref={"State:Deaf",NULL,-1}; +static EffectRef fx_deaf_state_ref={"State:Deafness",NULL,-1}; +static EffectRef fx_deaf_state_iwd2_ref={"State:DeafnessIWD2",NULL,-1}; -//removes the deaf effect +//removes the deafness effect int fx_cure_deaf_state (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_cure_deaf_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); target->fxqueue.RemoveAllEffects(fx_deaf_state_ref); + target->fxqueue.RemoveAllEffects(fx_deaf_state_iwd2_ref); return FX_NOT_APPLIED; } @@ -2518,7 +2542,17 @@ if (0) printf( "fx_set_regenerating_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); int damage; int tmp = fx->Parameter1; + ieDword gameTime = core->GetGame()->GameTime; + ieDword nextHeal; + if (!fx->Parameter3) { + nextHeal = gameTime; + } else { + nextHeal = fx->Parameter3; + } + + if (nextHeal>gameTime) return FX_APPLIED; + switch(fx->Parameter2) { case RPD_PERCENT: damage = target->GetStat(IE_MAXHITPOINTS) * fx->Parameter1 / 100; @@ -2530,15 +2564,15 @@ tmp *= 30; case RPD_SECONDS: seconds: - if (tmp && (core->GetGame()->GameTime%tmp)) { - return FX_APPLIED; - } + fx->Parameter3 = nextHeal+tmp; damage = 1; break; case RPD_POINTS: damage = fx->Parameter1; + fx->Parameter3++; break; default: + fx->Parameter3++; damage = 1; break; } @@ -3433,6 +3467,11 @@ { if (0) printf( "fx_replace_creature (%2d): Resource: %s\n", fx->Opcode, fx->Resource ); + //this safeguard exists in the original engine too + if (!core->Exists(fx->Resource,IE_CRE_CLASS_ID)) { + return FX_NOT_APPLIED; + } + //FIXME: the monster should appear near the effect position? //or the target position, this needs experiment Point p(fx->PosX, fx->PosY); @@ -3982,6 +4021,7 @@ { if (0) printf( "fx_bounce_opcode (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); STAT_BIT_OR( IE_BOUNCE, BNC_OPCODE ); + target->AddPortraitIcon(PI_BOUNCE2); return FX_APPLIED; } @@ -3990,10 +4030,11 @@ { if (0) printf( "fx_bounce_spellevel (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); STAT_BIT_OR( IE_BOUNCE, BNC_LEVEL ); + target->AddPortraitIcon(PI_BOUNCE2); return FX_APPLIED; } -// 0xc8 Bounce:SpellLevelDecrement +// 0xc8 Bounce:SpellLevelDec int fx_bounce_spelllevel_dec (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_bounce_spellevel_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); @@ -4002,16 +4043,12 @@ return FX_APPLIED; } -//0xc9 //Protection:SpellLevelDecrement -//0xDF //Protection:SchoolDecrement -//0xe2 //Protection:SecondaryTypeDecrement -int fx_generic_decrement_effect (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +//0xc9 //Protection:SpellLevelDec +int fx_immunity_spelllevel_dec (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_generic_decrement_effect (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - if (fx->Parameter1) { - return FX_APPLIED; - } - return FX_NOT_APPLIED; + if (0) printf( "fx_immunity_spelllevel_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + target->AddPortraitIcon(PI_BOUNCE2); + return FX_APPLIED; } // 0xca Bounce:School @@ -4265,8 +4302,19 @@ target->SetPosition( p, true, 0); return FX_NOT_APPLIED; } -//0xDF decrementing school immunity (general) -//0xE0 Cure:LevelDrain + +//0xDF //Protection:SchoolDec +//0xe2 //Protection:SecondaryTypeDec +int fx_generic_decrement_effect (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +{ + if (0) printf( "fx_generic_decrement_effect (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + if (fx->Parameter1) { + return FX_APPLIED; + } + return FX_NOT_APPLIED; +} + +//0xe0 Cure:LevelDrain static EffectRef fx_leveldrain_ref={"LevelDrainModifier",NULL,-1}; int fx_cure_leveldrain (Actor* /*Owner*/, Actor* target, Effect* fx) @@ -4276,15 +4324,26 @@ target->fxqueue.RemoveAllEffects( fx_leveldrain_ref ); return FX_NOT_APPLIED; } -//0xE1 Reveal:Magic + +//0xe1 Reveal:Magic +//gemrb special: speed and color are custom int fx_reveal_magic (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_reveal_magic (%2d)\n", fx->Opcode ); if (target->fxqueue.HasAnyDispellableEffect()) { - // make an one shot color pulse effect on target + if (!fx->Parameter1) { + fx->Parameter1=0xff00; //blue + } + + int speed = (fx->Parameter2 >> 16) & 0xFF; + if (!speed) speed=30; + target->SetColorMod(0xff, RGBModifier::ADD, speed, + fx->Parameter1 >> 8, fx->Parameter1 >> 16, + fx->Parameter1 >> 24, 0); } return FX_NOT_APPLIED; } + //e2 decrementing secondary type immunity (general) //e3 Bounce:SchoolDecrement int fx_bounce_school_dec (Actor* /*Owner*/, Actor* target, Effect* fx) Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-10-22 19:45:58 UTC (rev 4804) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-11-02 11:22:35 UTC (rev 4805) @@ -4343,7 +4343,7 @@ static PyObject* GemRB_GameGetFirstSelectedPC(PyObject * /*self*/, PyObject* /*args*/) { - Actor *actor = core->GetFirstSelectedPC(); + Actor *actor = core->GetFirstSelectedPC(false); if (actor) { return PyInt_FromLong( actor->InParty); } @@ -4806,7 +4806,7 @@ if (PartyID) { actor = game->FindPC( PartyID ); } else { - actor = core->GetFirstSelectedPC(); + actor = core->GetFirstSelectedPC(false); } if (!actor) { return RuntimeError( "Actor not found" ); @@ -4911,7 +4911,7 @@ Map *map = actor->GetCurrentArea(); container = map->TMap->GetContainer(actor->Pos, IE_CONTAINER_PILE); } else { - actor = core->GetFirstSelectedPC(); + actor = core->GetFirstSelectedPC(false); if (!actor) { return RuntimeError( "Actor not found" ); } @@ -7666,7 +7666,6 @@ case TARGET_NONE: //this is always instant casting core->ApplySpell(spelldata.spellname, actor, actor, 0); - //actor->CastSpell(spelldata.spellname, NULL, true); break; case TARGET_AREA: gc->SetupCasting(spelldata.type, spelldata.level, spelldata.slot, actor, GA_POINT, spelldata.TargetNumber); @@ -7907,7 +7906,7 @@ } PyDoc_STRVAR( GemRB_ApplyEffect__doc, -"ApplyEffect(pc, effect, param1, param2[,resref[,resref2, resref3]])\n\n" +"ApplyEffect(pc, effect, param1, param2[,resref,resref2, resref3]])\n\n" "Creates a basic effect and applies it on the player character. " "This function could be used to add stats that are stored in effect blocks. " "The resource fields are optional.\n\n"); @@ -7923,7 +7922,7 @@ const char *resref2 = NULL; const char *resref3 = NULL; - if (!PyArg_ParseTuple( args, "isii|s|ss", &PartyID, &opcodename, ¶m1, ¶m2, &resref1, &resref2, &resref3)) { + if (!PyArg_ParseTuple( args, "isii|sss", &PartyID, &opcodename, ¶m1, ¶m2, &resref1, &resref2, &resref3)) { return AttributeError( GemRB_ApplyEffect__doc ); } Game *game = core->GetGame(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-11-02 15:43:26
|
Revision: 4806 http://gemrb.svn.sourceforge.net/gemrb/?rev=4806&view=rev Author: avenger_teambg Date: 2007-11-02 08:43:25 -0700 (Fri, 02 Nov 2007) Log Message: ----------- Implemented mouse scroll speed (patch by Zefklop) and tooltip delay fixed problem with original game ini not used for 3d Acceleration Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/how/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/iwd/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/iwd2/GamePlay.py gemrb/trunk/gemrb/GUIScripts/pst/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Video.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h Modified: gemrb/trunk/gemrb/GUIScripts/bg1/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/GUIOPT.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/bg1/GUIOPT.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -347,9 +347,11 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 31232) + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 31230) + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) def DisplayHelpKeyboardScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 31231) Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -275,9 +275,9 @@ OptDone ('GameplayOptions', Window, 7) OptCancel ('GameplayOptions', Window, 20) - OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 0) - OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 0) - OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 0) + OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 10) + OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5) + OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5) OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0) OptCheckbox ('DitherAlways', Window, 14, 25, 'Always Dither', 1) @@ -295,9 +295,11 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18017) + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18018) + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) def DisplayHelpKeyboardScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18019) Modified: gemrb/trunk/gemrb/GUIScripts/how/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUIOPT.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/how/GUIOPT.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -308,9 +308,11 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18017) + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18018) + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) def DisplayHelpKeyboardScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18019) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUIOPT.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUIOPT.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -308,9 +308,11 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18017) + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18018) + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) def DisplayHelpKeyboardScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18019) Modified: gemrb/trunk/gemrb/GUIScripts/iwd2/GamePlay.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd2/GamePlay.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/iwd2/GamePlay.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -92,6 +92,7 @@ def DelayPress(): GemRB.SetText(GamePlayWindow, TextAreaControl, 18017) + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) return def KeySpdPress(): @@ -100,6 +101,7 @@ def MouseSpdPress(): GemRB.SetText(GamePlayWindow, TextAreaControl, 18018) + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) return def DifficultyPress(): Modified: gemrb/trunk/gemrb/GUIScripts/pst/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/pst/GUIOPT.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/pst/GUIOPT.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -165,8 +165,8 @@ OptDone ('VideoOptions', Window, 7) OptCancel ('VideoOptions', Window, 8) - OptSlider ('VideoOptions', 'Brightness', Window, 1, 10, 31234, "Brightness Correction") - OptSlider ('VideoOptions', 'Contrast', Window, 2, 11, 31429, "Gamma Correction") + OptSlider ('VideoOptions', 'Brightness', Window, 1, 10, 31234, "Brightness Correction", 5) + OptSlider ('VideoOptions', 'Contrast', Window, 2, 11, 31429, "Gamma Correction", 5) OptCheckbox ('VideoOptions', 'SoftwareBlitting', Window, 6, 15, 30898, "SoftBlt") OptCheckbox ('VideoOptions', 'SoftwareMirroring', Window, 4, 13, 30896, "SoftMirrorBlt") @@ -238,10 +238,10 @@ OptSlider ('AudioOptions', 'AmbientVolume', Window, 1, 10, 31460, "Volume Ambients", "UpdateVolume") - OptSlider ('AudioOptions', 'SoundFXVolume', Window, 2, 11, 31466, "Volume SFX") - OptSlider ('AudioOptions', 'VoiceVolume', Window, 3, 12, 31467, "Volume Voices") + OptSlider ('AudioOptions', 'SoundFXVolume', Window, 2, 11, 31466, "Volume SFX", "UpdateVolume") + OptSlider ('AudioOptions', 'VoiceVolume', Window, 3, 12, 31467, "Volume Voices", "UpdateVolume") OptSlider ('AudioOptions', 'MusicVolume', Window, 4, 13, 31468, "Volume Music", "UpdateVolume") - OptSlider ('AudioOptions', 'MovieVolume', Window, 5, 14, 31469, "Volume Movie") + OptSlider ('AudioOptions', 'MovieVolume', Window, 5, 14, 31469, "Volume Movie", "UpdateVolume") OptCheckbox ('AudioOptions', 'CreativeEAX', Window, 6, 15, 30900, "Environmental Audio") OptCheckbox ('AudioOptions', 'SoundProcessing', Window, 16, 17, 63242, "Sound Processing") @@ -256,8 +256,6 @@ GemRB.UpdateAmbientsVolume () GemRB.UpdateMusicVolume () - - def DisplayHelpAudioOptions (): GemRB.SetText (AudioOptionsWindow, AudioHelpText, 31210) @@ -316,9 +314,9 @@ OptDone ('GameplayOptions', Window, 10) OptCancel ('GameplayOptions', Window, 11) - OptSlider ('GameplayOptions', 'TooltipDelay', Window, 1, 13, 31481, "Tooltip") - OptSlider ('GameplayOptions', 'MouseScrollingSpeed', Window, 2, 14, 31482, "Mouse Scroll Speed") - OptSlider ('GameplayOptions', 'KeyboardScrollingSpeed', Window, 3, 15, 31480, "Keyboard Scroll Speed") + OptSlider ('GameplayOptions', 'TooltipDelay', Window, 1, 13, 31481, "Tooltips", "UpdateTooltips") + OptSlider ('GameplayOptions', 'MouseScrollingSpeed', Window, 2, 14, 31482, "Mouse Scroll Speed", "UpdateMouseSpeed") + OptSlider ('GameplayOptions', 'KeyboardScrollingSpeed', Window, 3, 15, 31480, "Keyboard Scroll Speed", "UpdateKeyboardSpeed") OptSlider ('GameplayOptions', 'Difficulty', Window, 4, 16, 31479, "Difficulty Level") OptCheckbox ('GameplayOptions', 'DitherAlways', Window, 5, 17, 31217, "Always Dither") @@ -330,24 +328,33 @@ GemRB.UnhideGUI () GemRB.ShowModal (Window, MODAL_SHADOW_GRAY) + return - def DisplayHelpGameplayOptions (): GemRB.SetText (GameplayOptionsWindow, GameplayHelpText, 31212) +def UpdateTooltips (): + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) + def DisplayHelpTooltipDelay (): GemRB.SetText (GameplayOptionsWindow, GameplayHelpText, 31232) +def UpdateMouseSpeed (): + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) + def DisplayHelpMouseScrollingSpeed (): GemRB.SetText (GameplayOptionsWindow, GameplayHelpText, 31230) +def UpdateKeyboardSpeed (): + #GemRB.SetKeyboardScrollSpeed (GemRB.GetVar ("Keyboard Scroll Speed") ) + return + def DisplayHelpKeyboardScrollingSpeed (): GemRB.SetText (GameplayOptionsWindow, GameplayHelpText, 31231) def DisplayHelpDifficulty (): GemRB.SetText (GameplayOptionsWindow, GameplayHelpText, 31233) - def DisplayHelpDitherAlways (): GemRB.SetText (GameplayOptionsWindow, GameplayHelpText, 31222) @@ -837,14 +844,14 @@ # control (button, slider ...) and a label -def OptSlider (winname, ctlname, window, slider_id, label_id, label_strref, assoc_var, fn = None): +def OptSlider (winname, ctlname, window, slider_id, label_id, label_strref, assoc_var, fn = None, scale = 1): """Standard slider for option windows""" slider = GemRB.GetControl (window, slider_id) #GemRB.SetEvent (window, slider, IE_GUI_MOUSE_ENTER_BUTTON, "DisplayHelp" + ctlname) #GemRB.SetEvent (window, slider, IE_GUI_MOUSE_LEAVE_BUTTON, "DisplayHelp" + winname) if fn: GemRB.SetEvent (window, slider, IE_GUI_SLIDER_ON_CHANGE, fn) - GemRB.SetVarAssoc (window, slider, assoc_var, 1) + GemRB.SetVarAssoc (window, slider, assoc_var, scale) label = GemRB.GetControl (window, label_id) GemRB.SetText (window, label, label_strref) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2007-11-02 15:43:25 UTC (rev 4806) @@ -275,9 +275,9 @@ OptDone ('GameplayOptions', Window, 7) OptCancel ('GameplayOptions', Window, 20) - OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 0) - OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 0) - OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 0) + OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 10) + OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5) + OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5) OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0) OptCheckbox ('DitherAlways', Window, 14, 25, 'Always Dither', 1) @@ -295,9 +295,11 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18017) + GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18018) + GemRB.SetMouseScrollSpeed (GemRB.GetVar ("Mouse Scroll Speed") ) def DisplayHelpKeyboardScrollingSpeed (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18019) Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-02 15:43:25 UTC (rev 4806) @@ -943,9 +943,14 @@ video->SetDisplayTitle( GameName, GameType ); ieDword brightness = 10; ieDword contrast = 5; + ieDword speed = 10; vars->Lookup("Brightness Correction", brightness); vars->Lookup("Gamma Correction", contrast); - video->SetGamma( brightness, contrast); + vars->Lookup("Mouse Scroll Speed", speed); + video->SetGamma(brightness, contrast); + video->SetMouseScrollSpeed((int) speed); + vars->Lookup("Tooltips", TooltipDelay); + Font* fps = GetFont( ( unsigned int ) 0 ); char fpsstring[40]={"???.??? fps"}; unsigned long frame = 0, time, timebase; @@ -1261,6 +1266,7 @@ return GEM_ERROR; } + vars->SetType( GEM_VARIABLES_INT ); vars->SetAt( "Volume Ambients", 100 ); vars->SetAt( "Volume Movie", 100 ); vars->SetAt( "Volume Music", 100 ); @@ -1327,11 +1333,28 @@ printf( "Cannot Load Chitin.key\nTermination in Progress...\n" ); return GEM_ERROR; } + + printMessage( "Core", "Reading Game Options...\n", WHITE ); if (!LoadGemRBINI()) { printf( "Cannot Load INI\nTermination in Progress...\n" ); return GEM_ERROR; } + + //loading baldur.ini + { + char ini_path[_MAX_PATH]; + PathJoin( ini_path, GamePath, INIConfig, NULL ); + ResolveFilePath( ini_path ); + LoadINI( ini_path ); + int i; + for (i = 0; i < 8; i++) { + if (INIConfig[i] == '.') + break; + GameNameResRef[i] = INIConfig[i]; + } + GameNameResRef[i] = 0; + } printMessage( "Core", "Creating Projectile Server...\n", WHITE ); projserv = new ProjectileServer(); @@ -1469,21 +1492,6 @@ } printStatus( "OK", LIGHT_GREEN ); - printMessage( "Core", "Initializing Variables Dictionary...", WHITE ); - vars->SetType( GEM_VARIABLES_INT ); - { - char ini_path[_MAX_PATH]; - PathJoin( ini_path, GamePath, INIConfig, NULL ); - ResolveFilePath( ini_path ); - LoadINI( ini_path ); - int i; - for (i = 0; i < 8; i++) { - if (INIConfig[i] == '.') - break; - GameNameResRef[i] = INIConfig[i]; - } - GameNameResRef[i] = 0; - } //no need of strdup, variables do copy the key! vars->SetAt( "SkipIntroVideos", (unsigned long)SkipIntroVideos ); printStatus( "OK", LIGHT_GREEN ); @@ -1979,24 +1987,10 @@ DataStream::SetEndianSwitch(atoi(value) ); } else if (stricmp( name, "CaseSensitive" ) == 0) { CaseSensitive = ( atoi( value ) == 0 ) ? false : true; - } else if (stricmp( name, "SmoothFog" ) == 0) { - vars->SetAt( "3D Acceleration", atoi( value ) ); } else if (stricmp( name, "MultipleQuickSaves" ) == 0) { GameControl::MultipleQuickSaves(atoi(value)); - } else if (stricmp( name, "VolumeAmbients" ) == 0) { - vars->SetAt( "Volume Ambients", atoi( value ) ); - } else if (stricmp( name, "VolumeMovie" ) == 0) { - vars->SetAt( "Volume Movie", atoi( value ) ); - } else if (stricmp( name, "VolumeMusic" ) == 0) { - vars->SetAt( "Volume Music", atoi( value ) ); - } else if (stricmp( name, "VolumeSFX" ) == 0) { - vars->SetAt( "Volume SFX", atoi( value ) ); - } else if (stricmp( name, "VolumeVoices" ) == 0) { - vars->SetAt( "Volume Voices", atoi( value ) ); } else if (stricmp( name, "GameOnCD" ) == 0) { GameOnCD = ( atoi( value ) == 0 ) ? false : true; - } else if (stricmp( name, "TooltipDelay" ) == 0) { - TooltipDelay = atoi( value ); } else if (stricmp( name, "GameDataPath" ) == 0) { strncpy( GameData, value, sizeof(GameData) ); } else if (stricmp( name, "GameOverridePath" ) == 0) { Modified: gemrb/trunk/gemrb/plugins/Core/Video.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Video.h 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/plugins/Core/Video.h 2007-11-02 15:43:25 UTC (rev 4806) @@ -223,6 +223,7 @@ virtual bool IsSpritePixelTransparent(Sprite2D* sprite, unsigned short x, unsigned short y) = 0; virtual Sprite2D* SpriteScaleDown( Sprite2D* sprite, unsigned int ratio ) = 0; virtual void SetGamma(int brightness, int contrast) = 0; + virtual void SetMouseScrollSpeed(int speed) = 0; }; #endif Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-11-02 15:43:25 UTC (rev 4806) @@ -7785,6 +7785,43 @@ return Py_None; } +PyDoc_STRVAR( GemRB_SetMouseScrollSpeed__doc, +"SetMouseScrollSpeed(mouseSpeed)\n\n" +"Adjusts mouse scroll speed."); + +static PyObject* GemRB_SetMouseScrollSpeed(PyObject * /*self*/, PyObject* args) +{ + int mouseSpeed; + + if (!PyArg_ParseTuple( args, "i", &mouseSpeed)) { + return AttributeError( GemRB_SetMouseScrollSpeed__doc ); + } + + core->GetVideoDriver()->SetMouseScrollSpeed(mouseSpeed); + + Py_INCREF( Py_None ); + return Py_None; +} + +PyDoc_STRVAR( GemRB_SetTooltipDelay__doc, +"SetTooltipDelay(tooltipDelay)\n\n" +"Adjusts tooltip appearing speed."); + +static PyObject* GemRB_SetTooltipDelay(PyObject * /*self*/, PyObject* args) +{ + int tooltipDelay; + + if (!PyArg_ParseTuple( args, "i", &tooltipDelay)) { + return AttributeError( GemRB_SetTooltipDelay__doc ); + } + + printf("%d\n", tooltipDelay); + core->TooltipDelay = tooltipDelay; + + Py_INCREF( Py_None ); + return Py_None; +} + PyDoc_STRVAR( GemRB_SetFullScreen__doc, "SetFullScreen(int)\n\n" "0 - windowed, 1 - fullscreen, -1 - toggle"); @@ -8301,6 +8338,8 @@ METHOD(UseItem, METH_VARARGS), METHOD(SpellCast, METH_VARARGS), METHOD(SetGamma, METH_VARARGS), + METHOD(SetMouseScrollSpeed, METH_VARARGS), + METHOD(SetTooltipDelay, METH_VARARGS), METHOD(SetFullScreen, METH_VARARGS), METHOD(RestParty, METH_VARARGS), METHOD(HasSpecialItem, METH_VARARGS), Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2007-11-02 15:43:25 UTC (rev 4806) @@ -62,6 +62,7 @@ extra=NULL; subtitlestrref = 0; subtitletext = NULL; + mousescrollspd = 10; } SDLVideoDriver::~SDLVideoDriver(void) @@ -337,11 +338,11 @@ if (DisableMouse) //grayed mouse is disabled in this sense break; if (CursorIndex != 2) - CursorIndex = 0; + CursorIndex = 0; CursorPos.x = event.button.x; CursorPos.y = event.button.y; if (Evnt && !ConsolePopped) - Evnt->MouseUp( event.button.x, event.button.y, 1 << ( event.button.button - 1 ), GetModState(SDL_GetModState()) ); + Evnt->MouseUp( event.button.x, event.button.y, 1 << ( event.button.button - 1 ), GetModState(SDL_GetModState()) ); break; case SDL_ACTIVEEVENT: @@ -381,10 +382,12 @@ backBuf = temp; } - if (!ConsolePopped) { + //handle tooltips + unsigned int delay = core->TooltipDelay; + if (!ConsolePopped && (delay<100) ) { GetTime( time ); /** Display tooltip if mouse is idle */ - if (( time - lastMouseTime ) > core->TooltipDelay) { + if (( time - lastMouseTime ) > delay) { if (Evnt) Evnt->MouseIdle( time - lastMouseTime ); } @@ -2217,6 +2220,8 @@ y=CursorPos.y; } +#define SCROLL_BORDER 5 + void SDLVideoDriver::MouseMovement(int x, int y) { GetTime( lastMouseTime ); @@ -2228,19 +2233,19 @@ moveX = 0; moveY = 0; } else { - if (x <= 1) - moveX = -5; + if (x <= SCROLL_BORDER) + moveX = -mousescrollspd; else { - if (event.motion.x >= ( core->Width - 1 )) - moveX = 5; + if (event.motion.x >= ( core->Width - SCROLL_BORDER )) + moveX = mousescrollspd; else moveX = 0; } - if (y <= 1) - moveY = -5; + if (y <= SCROLL_BORDER) + moveY = -mousescrollspd; else { - if (y >= ( core->Height - 1 )) - moveY = 5; + if (y >= ( core->Height - SCROLL_BORDER )) + moveY = mousescrollspd; else moveY = 0; } @@ -2391,3 +2396,8 @@ { SDL_SetGamma(0.8+brightness/50.0,0.8+brightness/50.0,0.8+brightness/50.0); } + +void SDLVideoDriver::SetMouseScrollSpeed(int speed) +{ + mousescrollspd=(speed+1)*2; +} Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h 2007-11-02 11:22:35 UTC (rev 4805) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h 2007-11-02 15:43:25 UTC (rev 4806) @@ -49,6 +49,7 @@ ieDword subtitlestrref; int width,height,bpp; bool fullscreen; + int mousescrollspd; public: SDLVideoDriver(void); ~SDLVideoDriver(void); @@ -165,6 +166,7 @@ bool IsSpritePixelTransparent (Sprite2D* sprite, unsigned short x, unsigned short y); Sprite2D* SpriteScaleDown( Sprite2D* sprite, unsigned int ratio ); void SetGamma(int brightness, int contrast); + void SetMouseScrollSpeed(int speed); void release(void) { delete this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-11-05 23:29:16
|
Revision: 4813 http://gemrb.svn.sourceforge.net/gemrb/?rev=4813&view=rev Author: avenger_teambg Date: 2007-11-05 15:29:06 -0800 (Mon, 05 Nov 2007) Log Message: ----------- Implemented Party AI (with all the associated hassle) implemented HasBounceEffects trigger implemented Delay trigger correctly Modified Paths: -------------- gemrb/trunk/gemrb/includes/SClassID.h gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp gemrb/trunk/gemrb/plugins/CREImporter/CREImp.h gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp gemrb/trunk/gemrb/plugins/Core/ActorBlock.h gemrb/trunk/gemrb/plugins/Core/ActorMgr.h gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.h gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Triggers.cpp gemrb/trunk/gemrb/plugins/GAMImporter/GAMImp.cpp gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.cpp Modified: gemrb/trunk/gemrb/includes/SClassID.h =================================================================== --- gemrb/trunk/gemrb/includes/SClassID.h 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/includes/SClassID.h 2007-11-05 23:29:06 UTC (rev 4813) @@ -37,6 +37,7 @@ #define IE_ARE_CLASS_ID 0x000003F2 #define IE_BAM_CLASS_ID 0x000003E8 #define IE_BCS_CLASS_ID 0x000003EF +#define IE_BS_CLASS_ID 0x100003EF #define IE_BIF_CLASS_ID 0x00020000 #define IE_BMP_CLASS_ID 0x00000001 #define IE_PNG_CLASS_ID 0x00000003 Modified: gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp 2007-11-05 23:29:06 UTC (rev 4813) @@ -820,7 +820,7 @@ printf("Couldn't read actor: %s!\n", CreResRef); continue; } - ab = actmgr->GetActor(); + ab = actmgr->GetActor(0); if(!ab) continue; map->AddActor(ab); Modified: gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp 2007-11-05 23:29:06 UTC (rev 4813) @@ -325,7 +325,7 @@ { ieResRef aScript; str->ReadResRef( aScript ); - act->SetScript( aScript, ScriptLevel); + act->SetScript( aScript, ScriptLevel, act->InParty!=0); } CRESpellMemorization* CREImp::GetSpellMemorization() @@ -391,14 +391,14 @@ } } -Actor* CREImp::GetActor() +Actor* CREImp::GetActor(unsigned char is_in_party) { if (!str) return NULL; Actor* act = new Actor(); if (!act) return NULL; - act->InParty = 0; + act->InParty = is_in_party; str->ReadDword( &act->LongStrRef ); //Beetle name in IWD needs the allow zero flag char* poi = core->GetString( act->LongStrRef, IE_STR_ALLOW_ZERO ); Modified: gemrb/trunk/gemrb/plugins/CREImporter/CREImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/CREImporter/CREImp.h 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/CREImporter/CREImp.h 2007-11-05 23:29:06 UTC (rev 4813) @@ -63,7 +63,7 @@ CREImp(void); ~CREImp(void); bool Open(DataStream* stream, bool autoFree = true); - Actor* GetActor(); + Actor* GetActor(unsigned char is_in_party); //returns saved size, updates internal offsets before save int GetStoredFileSize(Actor *ac); Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-11-05 23:29:06 UTC (rev 4813) @@ -734,7 +734,7 @@ if (Sender->Type!=ST_ACTOR && parameters->int0Parameter) { return; } - Sender->SetScript( parameters->string0Parameter, parameters->int0Parameter ); + Sender->SetScript( parameters->string0Parameter, parameters->int0Parameter, false ); } void GameScript::ForceAIScript(Scriptable* Sender, Action* parameters) @@ -746,7 +746,7 @@ Actor* actor = ( Actor* ) tar; //changeaiscript clears the queue, i believe // actor->ClearActions(); - actor->SetScript( parameters->string0Parameter, parameters->int0Parameter ); + actor->SetScript( parameters->string0Parameter, parameters->int0Parameter, false ); } void GameScript::SetPlayerSound(Scriptable* Sender, Action* parameters) @@ -2511,7 +2511,8 @@ Actor* act = ( Actor* ) Sender; act->SetBase( IE_EA, EA_PC ); if (core->HasFeature( GF_HAS_DPLAYER )) { - act->SetScript( "DPLAYER2", SCR_DEFAULT ); + act->SetScript( "", AI_SCRIPT_LEVEL, true ); + act->SetScript( "DPLAYER2", SCR_DEFAULT, false ); } int pdtable = core->LoadTable( "pdialog" ); if ( pdtable >= 0 ) { Modified: gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp 2007-11-05 23:29:06 UTC (rev 4813) @@ -62,7 +62,10 @@ DialogName = 0; CurrentAction = NULL; UnselectableTimer = 0; - startTime = 0; + startTime = 0; //executing scripts + lastRunTime = 0; //evaluating scripts + lastDelay = 0; + interval = ( 1000 / AI_UPDATE_TIME ); WaitCounter = 0; playDeadCounter = 0; @@ -132,7 +135,10 @@ area = map; } -void Scriptable::SetScript(const ieResRef aScript, int idx) +//ai is nonzero if this is an actor currently in the party +//if the script level is AI_SCRIPT_LEVEL, then we need to +//load an AI script (.bs) instead of (.bcs) +void Scriptable::SetScript(const ieResRef aScript, int idx, bool ai) { if (idx >= MAX_SCRIPTS) { printMessage("Scriptable","Invalid script index!\n",LIGHT_RED); @@ -145,7 +151,8 @@ // NONE is an 'invalid' script name, never used seriously // This hack is to prevent flooding of the console if (aScript[0] && stricmp(aScript, "NONE") ) { - Scripts[idx] = new GameScript( aScript, Type, locals, idx ); + if (idx!=AI_SCRIPT_LEVEL) ai=false; + Scripts[idx] = new GameScript( aScript, Type, locals, idx, ai ); Scripts[idx]->MySelf = this; } } @@ -216,11 +223,14 @@ void Scriptable::ImmediateEvent() { + lastRunTime=0; + /* for(int i=0;i<MAX_SCRIPTS;i++) { if (Scripts[i]) { Scripts[i]->RunNow(); } } + */ } void Scriptable::ExecuteScript(int scriptCount) @@ -232,10 +242,26 @@ return; } + ieDword thisTime = core->GetGame()->Ticks; + if (( thisTime - lastRunTime ) < 1000) { + return; + } + + lastDelay = lastRunTime; + lastRunTime = thisTime; + bool alive = false; - for (int i=0;i<scriptCount;i++) - { + for (int i=0;i<scriptCount;i++) { + //disable AI script level for actors in party when the player disabled them + if ((i==AI_SCRIPT_LEVEL) && (Type==ST_ACTOR) ) { + if (((Actor *) this)->InParty) { + if (core->GetGame()->ControlStatus&CS_PARTY_AI) { + continue; + } + } + } + GameScript *Script = Scripts[i]; if (Script) { alive |= Script->Update(); Modified: gemrb/trunk/gemrb/plugins/Core/ActorBlock.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorBlock.h 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/ActorBlock.h 2007-11-05 23:29:06 UTC (rev 4813) @@ -177,6 +177,8 @@ Scriptable* CutSceneId; ieResRef Dialog; public: + ieDword lastDelay; + ieDword lastRunTime; Variables* locals; ScriptableType Type; Point Pos; @@ -207,7 +209,7 @@ void SetDialog(const char *resref) { strnuprcpy(Dialog, resref, 8); } - void SetScript(const ieResRef aScript, int idx); + void SetScript(const ieResRef aScript, int idx, bool ai=false); void SetWait(unsigned long time); unsigned long GetWait(); void LeaveDialog(); Modified: gemrb/trunk/gemrb/plugins/Core/ActorMgr.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorMgr.h 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/ActorMgr.h 2007-11-05 23:29:06 UTC (rev 4813) @@ -43,7 +43,7 @@ ActorMgr(void); virtual ~ActorMgr(void); virtual bool Open(DataStream* stream, bool autoFree = true) = 0; - virtual Actor* GetActor() = 0; + virtual Actor* GetActor(unsigned char is_in_party) = 0; //returns saved size, updates internal offsets before save virtual int GetStoredFileSize(Actor *ac) = 0; Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-11-05 23:29:06 UTC (rev 4813) @@ -146,6 +146,8 @@ {"harmlessclosed", GameScript::Closed, 0}, //pst, not sure {"harmlessentered", GameScript::HarmlessEntered, 0}, //??? {"harmlessopened", GameScript::Opened, 0}, //pst, not sure + {"hasbounceeffects", GameScript::HasBounceEffects, 0}, + {"hasimmunityeffects", GameScript::HasImmunityEffects, 0}, {"hasinnateability", GameScript::HaveSpell, 0}, //these must be the same {"hasitem", GameScript::HasItem, 0}, {"hasitemequiped", GameScript::HasItemEquipped, 0}, //typo in bg2 @@ -1188,7 +1190,7 @@ /********************** GameScript *******************************/ GameScript::GameScript(const ieResRef ResRef, ScriptableType ScriptType, - Variables* local, int ScriptLevel) + Variables* local, int ScriptLevel, bool AIScript) { if (local) { locals = local; @@ -1349,11 +1351,12 @@ initialized = 2; } strnlwrcpy( Name, ResRef, 8 ); - script = CacheScript( Name ); + + script = CacheScript( Name, AIScript?IE_BS_CLASS_ID:IE_BCS_CLASS_ID); MySelf = NULL; - scriptRunDelay = 1000; +// scriptRunDelay = 1000; scriptType = ScriptType; - lastRunTime = 0; + //lastRunTime = 0; } GameScript::~GameScript(void) @@ -1397,20 +1400,19 @@ initialized = 0; } -Script* GameScript::CacheScript(ieResRef ResRef) +Script* GameScript::CacheScript(ieResRef ResRef, SClass_ID type) { char line[10]; Script *newScript = (Script *) BcsCache.GetResource(ResRef); - if ( newScript ) { - if (InDebug&ID_REFERENCE) { - printf("Caching %s for the %d. time\n", ResRef, BcsCache.RefCount(ResRef) ); - } - return newScript; -} + if ( newScript ) { + if (InDebug&ID_REFERENCE) { + printf("Caching %s for the %d. time\n", ResRef, BcsCache.RefCount(ResRef) ); + } + return newScript; + } - DataStream* stream = core->GetResourceMgr()->GetResource( ResRef, - IE_BCS_CLASS_ID ); + DataStream* stream = core->GetResourceMgr()->GetResource( ResRef, type ); if (!stream) { return NULL; } @@ -1562,11 +1564,12 @@ //call this whenever a script was triggered by an event //(death, trap entered) +/* void GameScript::RunNow() { lastRunTime = 0; } - +*/ bool GameScript::Update() { if (!MySelf) @@ -1575,12 +1578,13 @@ if (!script) return false; - ieDword thisTime = core->GetGame()->Ticks; - //GetTime( thisTime ); //this should be gametime too, pause holds it - if (( thisTime - lastRunTime ) < scriptRunDelay) { - return false; - } - lastRunTime = thisTime; + //ieDword thisTime = core->GetGame()->Ticks; + //if (( thisTime - lastRunTime ) < scriptRunDelay) { + // return false; + //} + + //lastRunTime = thisTime; + if(!(MySelf->GetInternalFlag()&IF_ACTIVE) ) { return true; } @@ -1628,17 +1632,12 @@ if (!MySelf || !(MySelf->GetInternalFlag()&IF_ACTIVE) ) { return; } - ieDword thisTime = core->GetGame()->Ticks; - //GetTime( thisTime ); //this should be gametime too, pause holds it - if (( thisTime - lastRunTime ) < scriptRunDelay) { - return; - } - lastRunTime = thisTime; + if (!script) { return; } //according to research, cutscenes don't evaluate conditions, and always -//runs the first response, this is a serious cutback on possible +//run the first response, this is a serious cutback on possible //functionality, so i kept the gemrb specific code too. #ifdef GEMRB_CUTSCENES //this is the logical way of executing a cutscene Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-11-05 23:29:06 UTC (rev 4813) @@ -596,6 +596,7 @@ #define MAX_TRIGGERS 0xFF #define MAX_ACTIONS 400 #define MAX_OBJECTS 128 +#define AI_SCRIPT_LEVEL 4 //the script level of special ai scripts extern void SetScriptDebugMode(int arg); extern int RandomNumValue; @@ -606,13 +607,13 @@ Script* script; Scriptable* MySelf; unsigned int lastAction; - unsigned long scriptRunDelay; +// unsigned long scriptRunDelay; int scriptlevel; - void RunNow(); +// void RunNow(); bool Update(); void EvaluateAllBlocks(); private: //Internal Functions - Script* CacheScript(ieResRef ResRef); + Script* CacheScript(ieResRef ResRef, SClass_ID type); ResponseBlock* ReadResponseBlock(DataStream* stream); ResponseSet* ReadResponseSet(DataStream* stream); Response* ReadResponse(DataStream* stream); @@ -624,7 +625,7 @@ static int ParseInt(const char*& src); static void ParseString(const char*& src, char* tmp); private: //Internal variables - unsigned long lastRunTime; + //unsigned long lastRunTime; unsigned long scriptType; private: //Script Internal Variables ieResRef Name; @@ -632,7 +633,7 @@ bool freeLocals; public: GameScript(const ieResRef ResRef, ScriptableType ScriptType, - Variables* local = NULL, int ScriptLevel = 0); + Variables* local = NULL, int ScriptLevel = 0, bool AIScript = false); ~GameScript(); static void ReleaseMemory(); const char *GetName() { return this?Name:"NONE\0\0\0\0"; } @@ -752,6 +753,8 @@ static int HappinessGT(Scriptable* Sender, Trigger* parameters); static int HappinessLT(Scriptable* Sender, Trigger* parameters); static int HarmlessEntered(Scriptable* Sender, Trigger* parameters); + static int HasBounceEffects(Scriptable* Sender, Trigger* parameters); + static int HasImmunityEffects(Scriptable* Sender, Trigger* parameters); static int HasInnateAbility(Scriptable* Sender, Trigger* parameters); static int HasItem(Scriptable* Sender, Trigger* parameters); static int HasItemEquipped(Scriptable* Sender, Trigger* parameters); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-05 23:23:19 UTC (rev 4812) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-05 23:29:06 UTC (rev 4813) @@ -134,21 +134,21 @@ console = NULL; slottypes = NULL; slotmatrix = NULL; - + ModalWindow = NULL; tooltip_x = 0; tooltip_y = 0; tooltip_ctrl = NULL; plugin = NULL; factory = NULL; - + pal16 = NULL; pal32 = NULL; pal256 = NULL; - + CursorCount = 0; Cursors = NULL; - + ConsolePopped = false; CheatFlag = false; FogOfWar = 1; @@ -196,7 +196,7 @@ TooltipColor.b = 0; TooltipColor.a = 255; TooltipMargin = 10; - + TooltipBack = NULL; DraggedItem = NULL; DraggedCursor = NULL; @@ -333,7 +333,7 @@ mm->ReleaseMemory(); FreeInterface(mm); } - + EffectQueue_ReleaseMemory(); CharAnimations::ReleaseMemory(); if (CurrentStore) { @@ -343,9 +343,9 @@ SpellCache.RemoveAll(ReleaseSpell); EffectCache.RemoveAll(ReleaseEffect); PaletteCache.RemoveAll(ReleasePalette); - + FreeResRefTable(DefSound, DSCount); - + if (slottypes) { free( slottypes ); } @@ -371,18 +371,18 @@ } delete[] Cursors; } - + FreeResourceVector( Font, fonts ); FreeResourceVector( Window, windows ); - + if (projserv) { delete( projserv ); } - + if (console) { delete( console ); } - + if (key) { FreeInterface( key ); } @@ -395,37 +395,37 @@ if (pal16) { FreeInterface( pal16 ); } - + if (timer) { delete( timer ); } - + if (windowmgr) { FreeInterface( windowmgr ); } - + if (video) { unsigned int i; - + for(i=0;i<sizeof(ArrowSprites)/sizeof(Sprite2D *);i++ ) { video->FreeSprite(ArrowSprites[i]); } - + for(i=0;i<sizeof(FogSprites)/sizeof(Sprite2D *);i++ ) { //freesprite checks for null pointer video->FreeSprite(FogSprites[i]); } - + for(i=0;i<4;i++) { video->FreeSprite(WindowFrames[i]); } - + for (int size = 0; size < MAX_CIRCLE_SIZE; size++) { for(i=0;i<6;i++) { video->FreeSprite(GroundCircles[size][i]); } } - + if (TooltipBack) { for(i=0;i<3;i++) { //freesprite checks for null pointer @@ -438,7 +438,7 @@ } FreeInterface( video ); } - + if (evntmgr) { delete( evntmgr ); } @@ -471,7 +471,7 @@ ItemTooltipTable->RemoveAll(ReleaseItemTooltip); delete( ItemTooltipTable ); } - + FreeInterfaceVector( Table, tables, tm ); FreeInterfaceVector( Symbol, symbols, sm ); if (opcodemgrs) { @@ -479,7 +479,7 @@ delete opcodemgrs; opcodemgrs=NULL; } - + if (INIquests) { FreeInterface(INIquests); } @@ -492,11 +492,11 @@ Map::ReleaseMemory(); GameScript::ReleaseMemory(); Actor::ReleaseMemory(); - + if (strings) { FreeInterface( strings ); } - + if(plugin) { delete( plugin ); } @@ -537,7 +537,7 @@ guiscript->RunFunction( "OnLoad" ); gc->UnhideGUI(); } - + return gc; } @@ -551,12 +551,12 @@ if (gc && (!gc->Owner || !gc->Owner->Visible)) { gc=NULL; } - + if (EventFlag&EF_UPDATEANIM) { EventFlag&=~EF_UPDATEANIM; guiscript->RunFunction( "UpdateAnimation", false); } - + if (EventFlag&EF_PORTRAIT) { ieDword tmp = (ieDword) ~0; vars->Lookup( "PortraitWindow", tmp ); @@ -565,7 +565,7 @@ guiscript->RunFunction( "UpdatePortraitWindow" ); } } - + if ((EventFlag&EF_CONTROL) && gc) { EventFlag&=~EF_CONTROL; guiscript->RunFunction( "UpdateControlStatus" ); @@ -585,13 +585,13 @@ } return; } - + if (EventFlag&EF_SEQUENCER) { EventFlag&=~EF_SEQUENCER; guiscript->RunFunction( "OpenSequencerWindow" ); return; } - + if (EventFlag&EF_IDENTIFY) { EventFlag&=~EF_IDENTIFY; guiscript->RunFunction( "OpenIdentifyWindow" ); @@ -605,24 +605,24 @@ void Interface::HandleFlags() { EventFlag = EF_CONTROL; //clear events because the context changed - + if (QuitFlag&(QF_QUITGAME|QF_EXITGAME) ) { // when reaching this, quitflag should be 1 or 2 // if Exitgame was set, we'll set Start.py too QuitGame (QuitFlag&QF_EXITGAME); QuitFlag &= ~(QF_QUITGAME|QF_EXITGAME); } - + if (QuitFlag&QF_LOADGAME) { QuitFlag &= ~QF_LOADGAME; LoadGame(LoadGameIndex); } - + if (QuitFlag&QF_ENTERGAME) { QuitFlag &= ~QF_ENTERGAME; if (game) { timer->Init(); - + //rearrange party slots game->ConsolidateParty(); GameControl* gc = StartGameControl(); @@ -639,7 +639,7 @@ QuitFlag = QF_QUITGAME; } } - + if (QuitFlag&QF_CHANGESCRIPT) { QuitFlag &= ~QF_CHANGESCRIPT; guiscript->LoadScript( NextScript ); @@ -650,7 +650,7 @@ bool GenerateAbilityTables() { FreeAbilityTables(); - + //range is: 0 - maximumability int tablesize = MaximumAbility+1; strmod = (ieWordSigned *) malloc (tablesize * 4 * sizeof(ieWordSigned) ); @@ -678,7 +678,7 @@ { TableMgr * tab; int table=LoadTable( tablename ); - + if (table<0) { return false; } @@ -740,7 +740,7 @@ TableMgr* aa; int table; bool flag = true; - + if (ItemExclTable) { ItemExclTable->RemoveAll(NULL); } else { @@ -748,7 +748,7 @@ ItemExclTable->SetType(GEM_VARIABLES_INT); } table = LoadTable( "itemexcl" ); - + if (table < 0) { //don't report error when the file doesn't exist goto aux_1; @@ -762,7 +762,7 @@ idx = aa->GetRowCount(); while (idx--) { ieResRef key; - + strnlwrcpy(key,aa->GetRowName(idx),8); ieDword value = strtol(aa->QueryField(idx,0),NULL,0); ItemExclTable->SetAt(key, value); @@ -782,7 +782,7 @@ ItemDial2Table->SetType(GEM_VARIABLES_STRING); } table = LoadTable( "itemdial" ); - + if (table < 0) { //don't report error when the file doesn't exist goto aux_2; @@ -796,7 +796,7 @@ idx = aa->GetRowCount(); while (idx--) { ieResRef key, dlgres; - + strnlwrcpy(key,aa->GetRowName(idx),8); ieDword value = strtol(aa->QueryField(idx,0),NULL,0); ItemDialTable->SetAt(key, value); @@ -812,7 +812,7 @@ ItemTooltipTable->SetType(GEM_VARIABLES_POINTER); } table = LoadTable( "tooltip" ); - + if (table < 0) { //don't report error when the file doesn't exist goto aux_3; @@ -827,7 +827,7 @@ while (idx--) { ieResRef key; int *tmppoi = (int *) malloc(sizeof(int)*3); - + strnlwrcpy(key,aa->GetRowName(idx),8); for (int i=0;i<3;i++) { tmppoi[i] = atoi(aa->QueryField(idx,i)); @@ -842,7 +842,7 @@ int Interface::GetItemExcl(const ieResRef itemname) const { ieDword value; - + if (ItemExclTable && ItemExclTable->Lookup(itemname, value)) { return (int) value; } @@ -852,7 +852,7 @@ int Interface::GetItemTooltip(const ieResRef itemname, int header) { int *value = NULL; - + if (ItemTooltipTable) { void* lookup = NULL; ItemTooltipTable->Lookup(itemname, lookup); @@ -873,7 +873,7 @@ int Interface::GetItemDialStr(const ieResRef itemname) const { ieDword value; - + if (ItemDialTable && ItemDialTable->Lookup(itemname, value)) { return (int) value; } @@ -897,9 +897,9 @@ AreaAliasTable = new Variables(); AreaAliasTable->SetType(GEM_VARIABLES_INT); } - + int table = LoadTable( tablename ); - + if (table < 0) { //don't report error when the file doesn't exist return true; @@ -912,7 +912,7 @@ int idx = aa->GetRowCount(); while (idx--) { ieResRef key; - + strnlwrcpy(key,aa->GetRowName(idx),8); ieDword value = atoi(aa->QueryField(idx,0)); AreaAliasTable->SetAt(key, value); @@ -925,7 +925,7 @@ int Interface::GetAreaAlias(const ieResRef areaname) const { ieDword value; - + if (AreaAliasTable && AreaAliasTable->Lookup(areaname, value)) { return (int) value; } @@ -959,14 +959,14 @@ Palette* palette = CreatePalette( white, black ); do { //don't change script when quitting is pending - + while (QuitFlag) { HandleFlags(); } if (EventFlag) { HandleEvents(); } - + DrawWindows(); if (DrawFPS) { frame++; @@ -1010,7 +1010,7 @@ int Interface::ReadResRefTable(const ieResRef tablename, ieResRef *&data) { int count = 0; - + if (data) { free(data); data = NULL; @@ -1038,23 +1038,23 @@ ieDword i; int size; int ret = GEM_ERROR; - + AnimationMgr* anim = ( AnimationMgr* ) GetInterface( IE_BAM_CLASS_ID ); if (!anim) { printf( "No BAM Importer Available.\nTermination in Progress...\n" ); return GEM_ERROR; } - + DataStream* str = NULL; int table = -1; if (!IsAvailable( IE_2DA_CLASS_ID )) { printf( "No 2DA Importer Available.\nTermination in Progress...\n" ); goto end_of_init; } - + //loading cursors printMessage( "Core", "Loading Cursors...", WHITE ); - + str = key->GetResource( "cursors", IE_BAM_CLASS_ID ); if (anim->Open( str, true )) { @@ -1064,7 +1064,7 @@ Cursors[i] = anim->GetFrameFromCycle( (ieByte) i, 0 ); } } - + // this is the last existing cursor type if (CursorCount<IE_CURSOR_WAY) { printStatus( "ERROR", LIGHT_RED ); @@ -1095,59 +1095,59 @@ printStatus( "ERROR", LIGHT_RED ); goto end_of_init; } - + FogSprites[0] = NULL; FogSprites[1] = anim->GetFrameFromCycle( 0, 0 ); FogSprites[2] = anim->GetFrameFromCycle( 0, 1 ); FogSprites[3] = anim->GetFrameFromCycle( 0, 2 ); - + FogSprites[4] = video->MirrorSpriteVertical( FogSprites[1], false ); - + FogSprites[5] = NULL; - + FogSprites[6] = video->MirrorSpriteVertical( FogSprites[3], false ); - + FogSprites[7] = NULL; - + FogSprites[8] = video->MirrorSpriteHorizontal( FogSprites[2], false ); - + FogSprites[9] = video->MirrorSpriteHorizontal( FogSprites[3], false ); - + FogSprites[10] = NULL; FogSprites[11] = NULL; - + FogSprites[12] = video->MirrorSpriteHorizontal( FogSprites[6], false ); - + FogSprites[16] = anim->GetFrameFromCycle( 0, 3 ); FogSprites[17] = anim->GetFrameFromCycle( 0, 4 ); FogSprites[18] = anim->GetFrameFromCycle( 0, 5 ); FogSprites[19] = anim->GetFrameFromCycle( 0, 6 ); - + FogSprites[20] = video->MirrorSpriteVertical( FogSprites[17], false ); - + FogSprites[21] = NULL; - + FogSprites[23] = NULL; - + FogSprites[24] = video->MirrorSpriteHorizontal( FogSprites[18], false ); - + FogSprites[25] = anim->GetFrameFromCycle( 0, 7 ); - + { Sprite2D *tmpsprite = video->MirrorSpriteVertical( FogSprites[25], false ); FogSprites[22] = video->MirrorSpriteHorizontal( tmpsprite, false ); video->FreeSprite( tmpsprite ); } - + FogSprites[26] = NULL; FogSprites[27] = NULL; - + { Sprite2D *tmpsprite = video->MirrorSpriteVertical( FogSprites[19], false ); FogSprites[28] = video->MirrorSpriteHorizontal( tmpsprite, false ); video->FreeSprite( tmpsprite ); } - + i = 0; vars->Lookup("3D Acceleration", i); if (i) { @@ -1155,9 +1155,9 @@ video->CreateAlpha( FogSprites[i] ); } } - + printStatus( "OK", LIGHT_GREEN ); - + // Load ground circle bitmaps (PST only) printMessage( "Core", "Loading Ground circle bitmaps...", WHITE ); //block required due to msvc6.0 incompatibility @@ -1170,7 +1170,7 @@ printStatus( "ERROR", LIGHT_RED ); goto end_of_init; } - + for (int i = 0; i < 6; i++) { Sprite2D* sprite = anim->GetFrameFromCycle( (ieByte) i, 0 ); if (GroundCircleScale[size]) { @@ -1182,9 +1182,9 @@ } } } - + printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Loading Fonts...\n", WHITE ); table = LoadTable( "fonts" ); if (table < 0) { @@ -1210,7 +1210,7 @@ } strncpy( fnt->ResRef, ResRef, 8 ); if (needpalette) { - + Color fore = {0xff, 0xff, 0xff, 0}; Color back = {0x00, 0x00, 0x00, 0}; if (!strnicmp( TooltipFont, ResRef, 8) ) { @@ -1233,7 +1233,7 @@ } printMessage( "Core", "Fonts Loaded...", WHITE ); printStatus( "OK", LIGHT_GREEN ); - + if (TooltipBackResRef[0]) { printMessage( "Core", "Initializing Tooltips...", WHITE ); str = key->GetResource( TooltipBackResRef, IE_BAM_CLASS_ID ); @@ -1249,9 +1249,9 @@ } printStatus( "OK", LIGHT_GREEN ); } - + ret = GEM_OK; - + end_of_init: FreeInterface( anim ); return ret; @@ -1265,7 +1265,7 @@ printStatus( "ERROR", LIGHT_RED ); return GEM_ERROR; } - + vars->SetType( GEM_VARIABLES_INT ); vars->SetAt( "Volume Ambients", 100 ); vars->SetAt( "Volume Movie", 100 ); @@ -1273,7 +1273,7 @@ vars->SetAt( "Volume SFX", 100 ); vars->SetAt( "Volume Voices", 100 ); printStatus( "OK", LIGHT_GREEN ); - + if (!LoadConfig()) { return GEM_ERROR; } @@ -1314,7 +1314,7 @@ } Color defcolor={255,255,255,200}; SetInfoTextColor(defcolor); - + printStatus( "OK", LIGHT_GREEN ); printMessage( "Core", "Searching for KEY Importer...", WHITE ); if (!IsAvailable( IE_KEY_CLASS_ID )) { @@ -1355,10 +1355,10 @@ } GameNameResRef[i] = 0; } - + printMessage( "Core", "Creating Projectile Server...\n", WHITE ); projserv = new ProjectileServer(); - + printMessage( "Core", "Checking for Dialogue Manager...", WHITE ); if (!IsAvailable( IE_TLK_CLASS_ID )) { printStatus( "ERROR", LIGHT_RED ); @@ -1380,7 +1380,7 @@ } printStatus( "OK", LIGHT_GREEN ); strings->Open( fs, true ); - + printMessage( "Core", "Loading Palettes...\n", WHITE ); DataStream* bmppal16 = NULL; DataStream* bmppal32 = NULL; @@ -1412,13 +1412,13 @@ pal256 = NULL; } printMessage( "Core", "Palettes Loaded\n", WHITE ); - + if (!IsAvailable( IE_BAM_CLASS_ID )) { printStatus( "ERROR", LIGHT_RED ); printf( "No BAM Importer Available.\nTermination in Progress...\n" ); return GEM_ERROR; } - + printMessage( "Core", "Initializing stock sounds...\n", WHITE ); DSCount = ReadResRefTable ("defsound", DefSound); if (DSCount == 0) { @@ -1426,7 +1426,7 @@ printf( "Cannot find defsound.2da.\nTermination in Progress...\n" ); return GEM_ERROR; } - + printMessage( "Core", "Initializing the Event Manager...", WHITE ); evntmgr = new EventMgr(); printStatus( "OK", LIGHT_GREEN ); @@ -1440,7 +1440,7 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - printMessage( "Core", "Initializing GUI Script Engine...\n", WHITE ); + printMessage( "Core", "Initializing GUI Script Engine...", WHITE ); guiscript = ( ScriptEngine * ) GetInterface( IE_GUI_SCRIPT_CLASS_ID ); if (guiscript == NULL) { printStatus( "ERROR", LIGHT_RED ); @@ -1471,7 +1471,7 @@ } console->SetCursor (tmpsprite); printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Starting up the Sound Manager...", WHITE ); soundmgr = ( SoundMgr * ) GetInterface( IE_WAV_CLASS_ID ); if (soundmgr == NULL) { @@ -1483,7 +1483,7 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Allocating SaveGameIterator...", WHITE ); sgiterator = new SaveGameIterator(); if (sgiterator == NULL) { @@ -1491,11 +1491,11 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - + //no need of strdup, variables do copy the key! vars->SetAt( "SkipIntroVideos", (unsigned long)SkipIntroVideos ); printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing Token Dictionary...", WHITE ); tokens = new Variables(); if (!tokens) { @@ -1504,7 +1504,7 @@ } tokens->SetType( GEM_VARIABLES_STRING ); printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing Music Manager...", WHITE ); music = ( MusicMgr * ) GetInterface( IE_MUS_CLASS_ID ); if (!music) { @@ -1542,7 +1542,7 @@ } else { printStatus( "OK", LIGHT_GREEN ); } - + printMessage( "Core", "Loading quests definition File...", WHITE ); INIquests = ( DataFileMgr * ) GetInterface( IE_INI_CLASS_ID ); @@ -1559,7 +1559,7 @@ } } game = NULL; - + printMessage( "Core", "Bringing up the Global Timer...", WHITE ); timer = new GlobalTimer(); if (!timer) { @@ -1567,24 +1567,24 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing effect opcodes...\n", WHITE ); opcodemgrs = GetInterfaceVector(IE_FX_CLASS_ID); if (!opcodemgrs || !opcodemgrs->size()) { printStatus( "ERROR", LIGHT_RED ); return GEM_ERROR; } - + printf("Loaded %d opcode blocks\n", (int) opcodemgrs->size()); printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing effects...\n", WHITE ); if (! Init_EffectQueue()) { printStatus( "ERROR", LIGHT_RED ); return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing Inventory Management...\n", WHITE ); ret = InitItemTypes(); if (!ret) { @@ -1592,7 +1592,7 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing string constants...\n", WHITE ); ret = ReadStrrefs(); if (!ret) { @@ -1600,7 +1600,7 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing random treasure...\n", WHITE ); ret = ReadRandomItems(); if (ret) { @@ -1609,14 +1609,14 @@ else { printStatus( "ERROR", LIGHT_RED ); } - + printMessage( "Core", "Initializing ability tables...\n", WHITE ); ret = ReadAbilityTables(); if (!ret) { printStatus( "ERROR", LIGHT_RED ); } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Initializing area aliases...\n", WHITE ); ret = ReadAreaAliasTable( "WMAPLAY" ); if (ret) { @@ -1625,16 +1625,16 @@ else { printStatus( "NOT FOUND", YELLOW ); } - + printMessage( "Core", "Reading item tables...\n", WHITE); ret = ReadAuxItemTables(); if (!ret) { printStatus( "ERROR", LIGHT_RED ); } printStatus( "OK", LIGHT_GREEN ); - + printMessage( "Core", "Core Initialization Complete!\n", WHITE ); - + return GEM_OK; } @@ -1685,112 +1685,115 @@ switch (type) { case IE_2DA_CLASS_ID: return ".2da"; - + case IE_ACM_CLASS_ID: return ".acm"; - + case IE_ARE_CLASS_ID: return ".are"; - + case IE_BAM_CLASS_ID: return ".bam"; - + case IE_BCS_CLASS_ID: return ".bcs"; - + + case IE_BS_CLASS_ID: + return ".bs"; + case IE_BIF_CLASS_ID: return ".bif"; - + case IE_BMP_CLASS_ID: return ".bmp"; - + case IE_PNG_CLASS_ID: return ".png"; - + case IE_CHR_CLASS_ID: return ".chr"; - + case IE_CHU_CLASS_ID: return ".chu"; - + case IE_CRE_CLASS_ID: return ".cre"; - + case IE_DLG_CLASS_ID: return ".dlg"; - + case IE_EFF_CLASS_ID: return ".eff"; - + case IE_GAM_CLASS_ID: return ".gam"; - + case IE_IDS_CLASS_ID: return ".ids"; - + case IE_INI_CLASS_ID: return ".ini"; - + case IE_ITM_CLASS_ID: return ".itm"; - + case IE_KEY_CLASS_ID: return ".key"; - + case IE_MOS_CLASS_ID: return ".mos"; - + case IE_MUS_CLASS_ID: return ".mus"; - + case IE_MVE_CLASS_ID: return ".mve"; - + case IE_PLT_CLASS_ID: return ".plt"; - + case IE_PRO_CLASS_ID: return ".pro"; - + case IE_SAV_CLASS_ID: return ".sav"; - + case IE_SPL_CLASS_ID: return ".spl"; - + case IE_SRC_CLASS_ID: return ".src"; - + case IE_STO_CLASS_ID: return ".sto"; - + case IE_TIS_CLASS_ID: return ".tis"; - + case IE_TLK_CLASS_ID: return ".tlk"; - + case IE_TOH_CLASS_ID: return ".toh"; - + case IE_TOT_CLASS_ID: return ".tot"; - + case IE_VAR_CLASS_ID: return ".var"; - + case IE_VVC_CLASS_ID: return ".vvc"; - + case IE_WAV_CLASS_ID: return ".wav"; - + case IE_WED_CLASS_ID: return ".wed"; - + case IE_WFX_CLASS_ID: return ".wfx"; - + case IE_WMP_CLASS_ID: return ".wmp"; } @@ -1808,7 +1811,7 @@ char* Interface::GetString(ieStrRef strref, ieDword options) { ieDword flags = 0; - + if (!(options & IE_STR_STRREFOFF)) { vars->Lookup( "Strref On", flags ); } @@ -1857,11 +1860,11 @@ #ifndef WIN32 char path[_MAX_PATH]; char name[_MAX_PATH]; - + // Find directory where user stores GemRB configurations (~/.gemrb). // FIXME: Create it if it does not exist // Use current dir if $HOME is not defined (or bomb out??) - + char* s = getenv( "HOME" ); if (s) { strcpy( UserDir, s ); @@ -1869,7 +1872,7 @@ } else { strcpy( UserDir, "./" ); } - + // Find basename of this program. It does the same as basename (3), // but that's probably missing on some archs s = strrchr( argv[0], PathDelimiter ); @@ -1878,11 +1881,11 @@ } else { s = argv[0]; } - + strcpy( name, s ); //if (!name[0]) // FIXME: could this happen? // strcpy (name, PACKAGE); // ugly hack - + // If we were called as $0 -c <filename>, load config from filename if (argc > 2 && ! strcmp("-c", argv[1])) { if (LoadConfig( argv[2] )) { @@ -1892,49 +1895,49 @@ return false; } } - + // FIXME: temporary hack, to be deleted?? if (LoadConfig( "GemRB.cfg" )) { return true; } - + PathJoin( path, UserDir, name, NULL ); strcat( path, ".cfg" ); - + if (LoadConfig( path )) { return true; } - + #ifdef SYSCONFDIR PathJoin( path, SYSCONFDIR, name, NULL ); strcat( path, ".cfg" ); - + if (LoadConfig( path )) { return true; } #endif - + // Don't try with default binary name if we have tried it already if (!strcmp( name, PACKAGE )) { return false; } - + PathJoin( path, UserDir, PACKAGE, NULL ); strcat( path, ".cfg" ); - + if (LoadConfig( path )) { return true; } - + #ifdef SYSCONFDIR PathJoin( path, SYSCONFDIR, PACKAGE, NULL ); strcat( path, ".cfg" ); - + if (LoadConfig( path )) { return true; } #endif - + return false; #else // WIN32 strcpy( UserDir, ".\\" ); @@ -1945,7 +1948,7 @@ bool Interface::LoadConfig(const char* filename) { FILE* config; - + printMessage("Config"," ", WHITE); printf("Trying to open %s\n", filename); config = fopen( filename, "rb" ); @@ -1954,10 +1957,10 @@ return false; } char name[65], value[_MAX_PATH + 3]; - + //one GemRB own format is working well, this might be set to 0 SaveAsOriginal = 1; - + while (!feof( config )) { char rem; fread( &rem, 1, 1, config ); @@ -2068,18 +2071,18 @@ } } fclose( config ); - - + + if (!GameType[0]) { strcpy( GameType, "gemrb" ); } - + #ifdef DATADIR if (!GemRBPath[0]) { strcpy( GemRBPath, DATADIR ); } #endif - + if (!PluginsPath[0]) { #ifdef PLUGINDIR strcpy( PluginsPath, PLUGINDIR ); @@ -2087,38 +2090,38 @@ PathJoin( PluginsPath, GemRBPath, "plugins", NULL ); #endif } - + if (!GUIScriptsPath[0]) { strcpy( GUIScriptsPath, GemRBPath ); } - + if (!GameName[0]) { strcpy( GameName, GEMRB_STRING ); } - + if (!SavePath[0]) { // FIXME: maybe should use UserDir instead of GamePath strcpy( SavePath, GamePath ); } - + if (! CachePath[0]) { PathJoin( CachePath, UserDir, "Cache", NULL ); } - - + + FixPath( GUIScriptsPath, true ); FixPath( PluginsPath, true ); FixPath( GemRBPath, true ); - + FixPath( SavePath, false ); mkdir( SavePath, S_IREAD|S_IWRITE|S_IEXEC ); chmod( SavePath, S_IREAD|S_IWRITE|S_IEXEC ); FixPath( SavePath, true ); - + FixPath( CachePath, false ); mkdir( CachePath, S_IREAD|S_IWRITE|S_IEXEC ); chmod( CachePath, S_IREAD|S_IWRITE|S_IEXEC ); - + printStatus( "OK", GREEN ); if ( StupidityDetector( CachePath )) { printMessage("Core"," ",LIGHT_RED); @@ -2127,7 +2130,7 @@ } DelTree((const char *) CachePath, false); FixPath( CachePath, true ); - + return true; } @@ -2184,10 +2187,10 @@ printStatus( "ERROR", LIGHT_RED ); return false; } - + printMessage( "Core", "Loading game type-specific GemRB setup...\n", WHITE ); printf( "%s",inifile->originalfile); - + if (!IsAvailable( IE_INI_CLASS_ID )) { printStatus( "ERROR", LIGHT_RED ); printf( "[Core]: No INI Importer Available.\n" ); @@ -2195,32 +2198,32 @@ } DataFileMgr* ini = ( DataFileMgr* ) GetInterface( IE_INI_CLASS_ID ); ini->Open( inifile, true ); //autofree - + printStatus( "OK", LIGHT_GREEN ); - + const char *s; - + // Resrefs are already initialized in Interface::Interface() s = ini->GetKeyAsString( "resources", "CursorBAM", NULL ); if (s) strcpy( CursorBam, s ); - + s = ini->GetKeyAsString( "resources", "ButtonFont", NULL ); if (s) strcpy( ButtonFont, s ); - + s = ini->GetKeyAsString( "resources", "TooltipFont", NULL ); if (s) strcpy( TooltipFont, s ); - + s = ini->GetKeyAsString( "resources", "MovieFont", NULL ); if (s) strcpy( MovieFont, s ); - + s = ini->GetKeyAsString( "resources", "TooltipBack", NULL ); if (s) strcpy( TooltipBackResRef, s ); - + s = ini->GetKeyAsString( "resources", "TooltipColor", NULL ); if (s) { if (s[0] == '#') { @@ -2232,12 +2235,12 @@ TooltipColor.a = (unsigned char) (c); } } - + //which stat determines the fist weapon (defaults to class) Actor::SetFistStat(ini->GetKeyAsInt( "resources", "FistStat", IE_CLASS)); - + TooltipMargin = ini->GetKeyAsInt( "resources", "TooltipMargin", TooltipMargin ); - + // The format of GroundCircle can be: // GroundCircleBAM1 = wmpickl/3 // to denote that the bitmap should be scaled down 3x @@ -2256,29 +2259,29 @@ } } } - + s = ini->GetKeyAsString( "resources", "INIConfig", NULL ); if (s) strcpy( INIConfig, s ); - + s = ini->GetKeyAsString( "resources", "Palette16", NULL ); if (s) strcpy( Palette16, s ); - + s = ini->GetKeyAsString( "resources", "Palette32", NULL ); if (s) strcpy( Palette32, s ); - + s = ini->GetKeyAsString( "resources", "Palette256", NULL ); if (s) strcpy( Palette256, s ); - + unsigned int i; for(i=0;i<256;i++) { pl_uppercase[i]=(ieByte) toupper(i); pl_lowercase[i]=(ieByte) tolower(i); } - + i = (unsigned int) ini->GetKeyAsInt ("charset", "CharCount", 0); if (i>99) i=99; while(i--) { @@ -2292,11 +2295,11 @@ } } } - + MaximumAbility = ini->GetKeyAsInt ("resources", "MaximumAbility", 25 ); - + RedrawTile = ini->GetKeyAsInt( "resources", "RedrawTile", 0 )!=0; - + for (i=0;i<GF_COUNT;i++) { if (!game_flags[i]) { printf("Fix the game flags!\n"); @@ -2306,9 +2309,9 @@ printMessage("Option", "", GREEN); printf("%s = %s\n", game_flags[i], HasFeature(i)?"yes":"no"); } - + ForceStereo = ini->GetKeyAsInt( "resources", "ForceStereo", 0 ); - + FreeInterface( ini ); return true; } @@ -2334,7 +2337,7 @@ FreeInterface( im ); return NULL; } - + palette = new Palette(); im->GetPalette(0,256,palette->col); FreeInterface( im ); @@ -2366,7 +2369,7 @@ void Interface::FreePalette(Palette *&pal, const ieResRef name) { int res; - + if (!pal) { return; } @@ -2454,14 +2457,14 @@ return guiscript; } -Actor *Interface::GetCreature(DataStream *stream) +Actor *Interface::GetCreature(DataStream *stream, unsigned char InParty) { ActorMgr* actormgr = ( ActorMgr* ) GetInterface( IE_CRE_CLASS_ID ); if (!actormgr->Open( stream, true )) { FreeInterface( actormgr ); return NULL; } - Actor* actor = actormgr->GetActor(); + Actor* actor = actormgr->GetActor(InParty); FreeInterface( actormgr ); return actor; } @@ -2469,7 +2472,7 @@ int Interface::LoadCreature(const char* ResRef, int InParty, bool character) { DataStream *stream; - + if (character) { char nPath[_MAX_PATH], fName[16]; snprintf( fName, sizeof(fName), "%s.chr", ResRef); @@ -2484,11 +2487,11 @@ else { stream = key->GetResource( ResRef, IE_CRE_CLASS_ID ); } - Actor* actor = GetCreature(stream); + Actor* actor = GetCreature(stream, InParty); if ( !actor ) { return -1; } - actor->InParty = (ieByte) InParty; + //actor->InParty = (ieByte) InParty; //both fields are of length 9, make this sure! memcpy(actor->Area, game->CurrentArea, sizeof(actor->Area) ); if (actor->BaseStats[IE_STATE_ID] & STATE_DEAD) { @@ -2497,7 +2500,7 @@ actor->SetStance( IE_ANI_AWAKE ); } actor->SetOrientation( 0, false ); - + if ( InParty ) { return game->JoinParty( actor, JP_JOIN|JP_INITPOS ); } @@ -2520,12 +2523,12 @@ if (!ab) { return NULL; } - + ab->LastSummoner = Owner->GetID(); level -= ab->GetStat(IE_XP); - + int enemyally; - + if (eamod==EAM_SOURCEALLY || eamod==EAM_SOURCEENEMY) { enemyally = Owner->GetStat(IE_EA)>EA_GOODCUTOFF; } else { @@ -2535,7 +2538,7 @@ enemyally = true; } } - + switch (eamod) { case EAM_SOURCEALLY: case EAM_ALLY: @@ -2559,7 +2562,7 @@ default: break; } - + Map *map = target->GetCurrentArea(); map->AddActor(ab); ab->SetPosition(position, true, 0); @@ -2610,10 +2613,10 @@ printf( "%s.chu\n", name ); return false; } - + strncpy( WindowPack, name, sizeof( WindowPack ) ); WindowPack[sizeof( WindowPack ) - 1] = '\0'; - + return true; } @@ -2621,7 +2624,7 @@ int Interface::LoadWindow(unsigned short WindowID) { unsigned int i; - + for (i = 0; i < windows.size(); i++) { Window *win = windows[i]; if (win == NULL) @@ -2641,7 +2644,7 @@ return -1; } memcpy( win->WindowPack, WindowPack, sizeof(WindowPack) ); - + int slot = -1; for (i = 0; i < windows.size(); i++) { if (windows[i] == NULL) { @@ -2663,7 +2666,7 @@ int Interface::CreateWindow(unsigned short WindowID, int XPos, int YPos, unsigned int Width, unsigned int Height, char* Background) { unsigned int i; - + for (i = 0; i < windows.size(); i++) { if (windows[i] == NULL) continue; @@ -2674,7 +2677,7 @@ return i; } } - + Window* win = new Window( WindowID, (ieWord) XPos, (ieWord) YPos, (ieWord) Width, (ieWord) Height ); if (Background[0]) { if (IsAvailable( IE_MOS_CLASS_ID )) { @@ -2691,9 +2694,9 @@ } else printf( "[Core]: No MOS Importer Available, skipping background\n" ); } - + strcpy( win->WindowPack, WindowPack ); - + int slot = -1; for (i = 0; i < windows.size(); i++) { if (windows[i] == NULL) { @@ -2732,7 +2735,7 @@ int slot = -1; for(unsigned int i = 0; i < windows.size(); i++) { Window *w = windows[i]; - + if(w==NULL) { slot = i; break; @@ -2869,7 +2872,7 @@ } evntmgr->DelWindow( win ); break; - + case WINDOW_VISIBLE: if (win->WindowID==65535) { video->SetViewport( win->XPos, win->YPos, win->Width, win->Height); @@ -2938,26 +2941,26 @@ //evntmgr->Clear(); SetOnTop( WindowIndex ); evntmgr->AddWindow( win ); - + ModalWindow = NULL; DrawWindows(); win->Invalidate(); - + Color gray = { 0, 0, 0, 128 }; Color black = { 0, 0, 0, 255 }; - + Region r( 0, 0, Width, Height ); - + if (Shadow == MODAL_SHADOW_GRAY) { video->DrawRect( r, gray ); } else if (Shadow == MODAL_SHADOW_BLACK) { video->DrawRect( r, black ); } - + ModalWindow = win; return 0; } @@ -2972,13 +2975,13 @@ //this variable is used all over in the following hacks int flg = gc->GetDialogueFlags(); GSUpdate(!(flg & DF_FREEZE_SCRIPTS) ); - + //the following part is a series of hardcoded gui behaviour - + //updating panes according to the saved game //pst requires this before initiating dialogs because it has //no dialog window by default - + //initiating dialog if (flg & DF_IN_DIALOG) { // -3 noaction @@ -3001,7 +3004,7 @@ gc->SetDialogueFlags(DF_OPENCONTINUEWINDOW|DF_OPENENDWINDOW, BM_NAND); } } - + //handling container if (CurrentContainer && UseContainer) { if (!(flg & DF_IN_CONTAINER) ) { @@ -3016,7 +3019,7 @@ } //end of gui hacks } - + //here comes the REAL drawing of windows if (ModalWindow) { ModalWindow->DrawWindow(); @@ -3025,10 +3028,10 @@ size_t i = topwin.size(); while(i--) { unsigned int t = topwin[i]; - + if ( t >=windows.size() ) continue; - + //visible ==1 or 2 will be drawn Window* win = windows[t]; if (win != NULL) { @@ -3048,15 +3051,15 @@ { if (! tooltip_ctrl || !tooltip_ctrl->Tooltip) return; - + Font* fnt = GetFont( TooltipFont ); char *tooltip_text = tooltip_ctrl->Tooltip; - + int w1 = 0; int w2 = 0; int w = fnt->CalcStringWidth( tooltip_text ) + 8; int h = fnt->maxHeight; - + if (TooltipBack) { h = TooltipBack[0]->Height; w1 = TooltipBack[1]->Width; @@ -3066,10 +3069,10 @@ if (w>TooltipBack[0]->Width) w=TooltipBack[0]->Width; } - + int x = tooltip_x - w / 2; int y = tooltip_y - h / 2; - + // Ensure placement within the screen if (x < 0) x = 0; else if (x + w + w1 + w2 > Width) @@ -3077,8 +3080,8 @@ if (y < 0) y = 0; else if (y + h > Height) y = Height - h; - - + + // FIXME: add tooltip scroll animation for bg. also, take back[0] from // center, not from left end Region r2 = Region( x, y, w, h ); @@ -3087,7 +3090,7 @@ video->BlitSprite( TooltipBack[1], x, y, true ); video->BlitSprite( TooltipBack[2], x + w, y, true ); } - + r2.x+=TooltipMargin; fnt->Print( r2, (ieByte *) tooltip_text, NULL, IE_FONT_ALIGN_CENTER | IE_FONT_ALIGN_MIDDLE, true ); @@ -3387,7 +3390,7 @@ // delete( str ); return -1; } - + ieDword subtitles = 0; Font *SubtitleFont = NULL; Palette *palette = NULL; @@ -3424,7 +3427,7 @@ } } } - + //shutting down music and ambients before movie if (music) music->HardEnd(); @@ -3445,7 +3448,7 @@ //this will fix redraw all windows as they looked like //before the movie RedrawAll(); - + //Setting the movie name to 1 vars->SetAt( ResRef, 1 ); return 0; @@ -3475,7 +3478,7 @@ { int count = 0; char Path[_MAX_PATH]; - + if (smallorlarge) { bmp_suffix[0]='S'; png_suffix[0]='S'; @@ -3523,7 +3526,7 @@ bool hasfolders; int count = 0; char Path[_MAX_PATH]; - + PathJoin( Path, GamePath, GameSounds, NULL ); hasfolders = ( HasFeature( GF_SOUNDFOLDERS ) != 0 ); DIR* dir = opendir( Path ); @@ -3563,7 +3566,7 @@ { int count = 0; char Path[_MAX_PATH]; - + PathJoin( Path, GamePath, GameCharacters, NULL ); DIR* dir = opendir( Path ); if (dir == NULL) { @@ -3663,9 +3666,9 @@ timer->Init(); timer->SetFadeFromColor(0); } - + DelWindow(0xffff); //delete all windows, including GameControl - + //shutting down ingame music //(do it before deleting the game) if (music) { @@ -3696,25 +3699,25 @@ // This function has rather painful error handling, // as it should swap all the objects or none at all // and the loading can fail for various reasons - + // Yes, it uses goto. Other ways seemed too awkward for me. - + strings->CloseAux(); tokens->RemoveAll(NULL); //clearing the token dictionary DataStream* gam_str = NULL; DataStream* sav_str = NULL; DataStream* wmp_str = NULL; - + SaveGameMgr* gam_mgr = NULL; WorldMapMgr* wmp_mgr = NULL; - + Game* new_game = NULL; WorldMapArray* new_worldmap = NULL; - + LoadProgress(15); DelTree((const char *) CachePath, true); LoadProgress(20); - + if (index == -1) { //Load the Default Game gam_str = key->GetResource( GameNameResRef, IE_GAM_CLASS_ID ); @@ -3729,40 +3732,40 @@ wmp_str = sg->GetWmap(); delete sg; } - + if (!gam_str || !wmp_str) goto cleanup; - + // Load GAM file gam_mgr = ( SaveGameMgr* ) GetInterface( IE_GAM_CLASS_ID ); if (!gam_mgr) goto cleanup; - + if (!gam_mgr->Open( gam_str, true )) goto cleanup; - + new_game = gam_mgr->LoadGame(new Game()); if (!new_game) goto cleanup; - + FreeInterface( gam_mgr ); gam_mgr = NULL; gam_str = NULL; - + // Load WMP (WorldMap) file wmp_mgr = ( WorldMapMgr* ) GetInterface( IE_WMP_CLASS_ID ); if (! wmp_mgr) goto cleanup; - + if (!wmp_mgr->Open( wmp_str, true )) goto cleanup; - + new_worldmap = wmp_mgr->GetWorldMapArray( ); - + FreeInterface( wmp_mgr ); wmp_mgr = NULL; wmp_str = NULL; - + LoadProgress(30); // Unpack SAV (archive) file to Cache dir if (sav_str) { @@ -3775,18 +3778,18 @@ delete( sav_str ); sav_str = NULL; } - + // Let's assume that now is everything loaded OK and swap the objects - + if (game) delete( game ); - + if (worldmap) delete( worldmap ); - + game = new_game; worldmap = new_worldmap; - + strings->OpenAux(); LoadProgress(100); return; @@ -3797,7 +3800,7 @@ delete( new_game ); if (new_worldmap) delete( new_worldmap ); - + if (gam_mgr) { FreeInterface( gam_mgr ); gam_str = NULL; @@ -3806,7 +3809,7 @@ FreeInterface( wmp_mgr ); wmp_str = NULL; } - + if (gam_str) delete gam_str; if (wmp_str) delete wmp_str; if (sav_str) delete sav_str; @@ -3818,7 +3821,7 @@ // in the beginning, there's no window at all if (! window) return NULL; - + Control* gc = window->GetControl(0); if (gc->ControlType!=IE_GUI_GAMECONTROL) { return NULL; @@ -3833,7 +3836,7 @@ } int ItemTypeTable = LoadTable( "itemtype" ); TableMgr *it = GetTable(ItemTypeTable); - + ItemTypes = 0; if (it) { ItemTypes = it->GetRowCount(); //number of itemtypes @@ -3859,7 +3862,7 @@ } DelTable(ItemTypeTable); } - + //slottype describes the inventory structure Inventory::Init(HasFeature(GF_MAGICBIT)); int SlotTypeTable = LoadTable( "slottype" ); @@ -3927,7 +3930,7 @@ ieDword Interface::FindSlot(unsigned int idx) const { ieDword i; - + for (i=0;i<SlotTypes;i++) { if (idx==slottypes[i].slot) { break; @@ -4001,13 +4004,13 @@ return 0; } } - + if ( (unsigned int) item->ItemType>=(unsigned int) ItemTypes) { //invalid itemtype if (feedback) core->DisplayConstantString(STR_WRONGITEMTYPE, 0xf0f0f0); return 0; } - + //if actor is supplied, check its usability fields if (actor) { ieStrRef str = actor->Unusable(item); @@ -4016,7 +4019,7 @@ return 0; } } - + //if any bit is true, the answer counts as true int ret = (slotmatrix[item->ItemType]&slottype); if (!ret) { @@ -4029,7 +4032,7 @@ { ieDword WinIndex = (ieDword) -1; ieDword TAIndex = (ieDword) -1; - + vars->Lookup( "OtherWindow", WinIndex ); if (( WinIndex != (ieDword) -1 ) && ( vars->Lookup( "MessageLabel", TAIndex ) )) { @@ -4047,7 +4050,7 @@ { ieDword WinIndex = (ieDword) -1; ieDword TAIndex = (ieDword) -1; - + vars->Lookup( "MessageWindow", WinIndex ); if (( WinIndex != (ieDword) -1 ) && ( vars->Lookup( "MessageTextArea", TAIndex ) )) { @@ -4125,7 +4128,7 @@ { unsigned int speaker_color; const char *name; - + if (stridx<0) return; switch (speaker->Type) { case ST_ACTOR: @@ -4142,7 +4145,7 @@ speaker_color = 0x800000; break; } - + char* text = GetString( strref_table[stridx], IE_STR_SOUND|IE_STR_SPEECH ); int newlen = (int)(strlen( DisplayFormatName ) + strlen( name ) + + strlen( text ) + 18); @@ -4159,7 +4162,7 @@ unsigned int attacker_color; const char *name1; const char *name2; - + if (stridx<0) return; switch (attacker->Type) { case ST_ACTOR: @@ -4180,7 +4183,7 @@ name2 = ""; break; } - + char* text = GetString( strref_table[stridx], IE_STR_SOUND|IE_STR_SPEECH ); int newlen = (int)(strlen( DisplayFormatAction ) + strlen( name1 ) + + strlen( name2 ) + strlen( text ) + 18); @@ -4196,7 +4199,7 @@ { unsigned int speaker_color; const char *name; - + if (stridx<0) return; switch (speaker->Type) { case ST_ACTOR: @@ -4213,7 +4216,7 @@ speaker_color = 0x800000; break; } - + char* text = GetString( stridx, flags); int newlen = (int)(strlen( DisplayFormatName ) + strlen( name ) + + strlen( text ) + 10); @@ -4258,7 +4261,7 @@ void Interface::RemoveFromCache(const ieResRef resref, SClass_ID ClassID) { char filename[_MAX_PATH]; - + snprintf(filename, _MAX_PATH, "%s%.8s%s", CachePath, resref, TypeExt( ClassID ) ); unlink ( filename); } @@ -4366,7 +4369,7 @@ if (item) { DraggedCursor = GetBAMSprite( Picture, 0, 0 ); } - + video->SetDragCursor (DraggedCursor); } } @@ -4376,7 +4379,7 @@ ieResRef ItemName; TableMgr * tab; int i,j; - + int table=LoadTable(TableName); if (table<0) { return false; @@ -4415,7 +4418,7 @@ ieResRef RtResRef; int i; TableMgr * tab; - + int table=LoadTable( "randitem" ); ieDword difflev=0; //rt norm or rt fury vars->Lookup("Nightmare Mode", difflev); @@ -4465,7 +4468,7 @@ CREItem *Interface::ReadItem(DataStream *str) { CREItem *itm = new CREItem(); - + str->ReadResRef( itm->ItemResRef ); str->ReadWord( &itm->Expired ); str->ReadWord( &itm->Usages[0] ); @@ -4490,7 +4493,7 @@ int i,j,k; char *endptr; ieResRef NewItem; - + void* lookup; if ( !RtRows->Lookup( itm->ItemResRef, lookup ) ) { return true; @@ -4543,7 +4546,7 @@ FreeInterface( sm ); return NULL; } - + item = new Item(); //this is required for storing the 'source' strnlwrcpy(item->Name, resname, 8); @@ -4552,7 +4555,7 @@ FreeInterface( sm ); return NULL; } - + FreeInterface( sm ); ItemCache.SetAt(resname, (void *) item); return item; @@ -4562,7 +4565,7 @@ void Interface::FreeItem(Item const *itm, const ieResRef name, bool free) { int res; - + res=ItemCache.DecRef((void *) itm, name, free); if (res<0) { printMessage( "Core", "Corrupted Item cache encountered (reference count went below zero), ", LIGHT_RED ); @@ -4589,7 +4592,7 @@ FreeInterface( sm ); return NULL; } - + spell = new Spell(); //this is required for storing the 'source' strnlwrcpy(spell->Name, resname, 8); @@ -4598,9 +4601,9 @@ FreeInterface( sm ); return NULL; } - + FreeInterface( sm ); - + SpellCache.SetAt(resname, (void *) spell); return spell; } @@ -4608,7 +4611,7 @@ void Interface::FreeSpell(Spell *spl, const ieResRef name, bool free) { int res; - + res=SpellCache.DecRef((void *) spl, name, free); if (res<0) { printMessage( "Core", "Corrupted Spell cache encountered (reference count went below zero), ", LIGHT_RED ); @@ -4635,15 +4638,15 @@ FreeInterface( em ); return NULL; } - + effect = em->GetEffect(new Effect() ); if (effect == NULL) { FreeInterface( em ); return NULL; } - + FreeInterface( em ); - + EffectCache.SetAt(resname, (void *) effect); return effect; } @@ -4651,7 +4654,7 @@ void Interface::FreeEffect(Effect *eff, const ieResRef name, bool free) { int res; - + res=EffectCache.DecRef((void *) eff, name, free); if (res<0) { printMessage( "Core", "Corrupted Effect cache encountered (reference count went below zero), ", LIGHT_RED ); @@ -4758,7 +4761,7 @@ //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( CurrentStore->Name, IE_STO_CLASS_ID ); int ret = sm->PutStore (&str, CurrentStore); if (ret <0) { @@ -4784,11 +4787,11 @@ if ( !strnicmp(CurrentStore->Name, resname, 8) ) { return CurrentStore; } - + //not simply delete the old store, but save it CloseCurrentStore(); } - + DataStream* str = key->GetResource( resname, IE_STO_CLASS_ID ); StoreMgr* sm = ( StoreMgr* ) GetInterface( IE_STO_CLASS_ID ); if (sm == NULL) { @@ -4799,7 +4802,7 @@ FreeInterface( sm ); return NULL; } - + // FIXME - should use some already allocated in core // not really, only one store is open at a time, then it is // unloaded, we don't really have to cache it, it will be saved in @@ -4823,14 +4826,14 @@ dm->Open( key->GetResource( dlgref, IE_DLG_CLASS_ID ), true ); Dialog *dlg = dm->GetDialog(); FreeInterface( dm ); - + if (!dlg) { printMessage("Interface"," ", LIGHT_RED); printf( "Cannot load dialog: %s\n", dlgref ); return (ieStrRef) -1; } Scriptable *pc=game->GetPC( game->GetSelectedPCSingle(), false ); - + ieStrRef ret = (ieStrRef) -1; int i = dlg->FindRandomState( pc ); if (i>=0 ) { @@ -4844,13 +4847,13 @@ { size_t size = s->PurchasedCategoriesCount * sizeof( ieDword ); s->purchased_categories=(ieDword *) malloc(size); - + size = s->CuresCount * sizeof( STOCure ); s->cures=(STOCure *) malloc(size); - + size = s->DrinksCount * sizeof( STODrink ); s->drinks=(STODrink *) malloc(size); - + for(size=0;size<s->ItemsCount;size++) s->items.push_back( new STOItem() ); } @@ -4874,7 +4877,7 @@ ScriptedAnimation* Interface::GetScriptedAnimation( const char *effect, bool doublehint) { ScriptedAnimation *ret = NULL; - + if (Exists( effect, IE_VVC_CLASS_ID ) ) { DataStream *ds = key->GetResource( effect, IE_VVC_CLASS_ID ); ret = new ScriptedAnimation(ds, true); @@ -4949,12 +4952,12 @@ if (!spell) { return; } - + actor->RollSaves(); - + level = spell->GetHeaderIndexFromLevel(level); EffectQueue *fxqueue = spell->GetEffectBlock(level); - + //check effect immunities int res = fxqueue->CheckImmunity ( actor ); if (res) { @@ -4985,7 +4988,7 @@ EffectQueue *fxqueue = new EffectQueue(); fxqueue->AddEffect( effect ); //hmm, don't delete the effect - + int res = fxqueue->CheckImmunity ( actor ); if (res) { if (res == -1 ) { @@ -5022,7 +5025,7 @@ //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( map->GetScriptName(), IE_ARE_CLASS_ID ); int ret = mm->PutArea (&str, map); if (ret <0) { @@ -5043,7 +5046,7 @@ int Interface::WriteCharacter(const char *name, Actor *actor) { char Path[_MAX_PATH]; - + PathJoin( Path, GamePath, GameCharacters, NULL ); if (!actor) { return -1; @@ -5053,9 +5056,9 @@ return -1; } FileStream str; - + str.Create( Path, name, IE_CHR_CLASS_ID ); - + //this is not needed, because the chr header writer automatically //calls it //int size = gm->GetStoredFileSize (actor); @@ -5074,13 +5077,13 @@ if (gm == NULL) { return -1; } - + int size = gm->GetStoredFileSize (game); if (size > 0) { //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( folder, GameNameResRef, IE_GAM_CLASS_ID ); ... [truncated message content] |
From: <ave...@us...> - 2007-11-08 18:51:06
|
Revision: 4815 http://gemrb.svn.sourceforge.net/gemrb/?rev=4815&view=rev Author: avenger_teambg Date: 2007-11-08 10:51:05 -0800 (Thu, 08 Nov 2007) Log Message: ----------- implemented HasImmunityEffects trigger PST:Implemented resdata.ini handling, improved JumbleCurse effect Modified Paths: -------------- gemrb/trunk/gemrb/includes/globals.h gemrb/trunk/gemrb/includes/ie_stats.h gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/EffectQueue.h gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Inventory.cpp gemrb/trunk/gemrb/plugins/Core/Inventory.h gemrb/trunk/gemrb/plugins/Core/Triggers.cpp gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp Modified: gemrb/trunk/gemrb/includes/globals.h =================================================================== --- gemrb/trunk/gemrb/includes/globals.h 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/includes/globals.h 2007-11-08 18:51:05 UTC (rev 4815) @@ -128,10 +128,11 @@ #define GF_ENHANCED_EFFECTS 31 //iwd2 (maybe iwd/how too) #define GF_DEATH_ON_ZERO_STAT 32 //not in iwd2 #define GF_SPAWN_INI 33 //pst, iwd, iwd2 -#define GF_IWD_DEATHVARFORMAT 34 //iwd branch (maybe pst) +#define GF_IWD_DEATHVARFORMAT 34 //iwd branch (maybe pst) +#define GF_RESDATA_INI 35 //pst //update this -#define GF_COUNT 35 +#define GF_COUNT 36 //the number of item usage fields (used in CREItem and STOItem) #define CHARGE_COUNTERS 3 Modified: gemrb/trunk/gemrb/includes/ie_stats.h =================================================================== --- gemrb/trunk/gemrb/includes/ie_stats.h 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/includes/ie_stats.h 2007-11-08 18:51:05 UTC (rev 4815) @@ -434,6 +434,7 @@ #define IE_MIRRORIMAGES 182 // +#define IE_IMMUNITY 203 #define IE_DISABLEDBUTTON 204 #define IE_ANIMATION_ID 205 //cd #define IE_STATE_ID 206 Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -906,7 +906,7 @@ void Actor::ReleaseMemory() { int i; - + if (classcount>=0) { if (clericspelltables) { for (i=0;i<classcount;i++) { @@ -986,7 +986,7 @@ } field = tm->QueryField( i, 1 ); - if (field[0]!='*') { + if (field[0]!='*') { if (turnlevel) { isclass[ISCLERIC] |= bitmask; } else { @@ -1005,7 +1005,7 @@ if (field[0]!='*') { isclass[ISBARD] |= bitmask; } - + field = tm->QueryField( i, 6 ); if (field[0]!='*') { isclass[ISPALADIN] |= bitmask; @@ -1815,7 +1815,7 @@ ieDword Actor::GetXPLevel(int modified) const { const ieDword *stats; - + if (modified) { stats = Modified; } @@ -2553,7 +2553,7 @@ } //which hand is used bool leftorright = (bool) (attackcount&1); - + WeaponInfo wi; ITMExtHeader *header; //can't reach target, zero range shouldn't be allowed @@ -3236,23 +3236,14 @@ return false; } -void Actor::ResolveStringConstant(ieResRef Sound, unsigned int index) +void Actor::GetSoundFrom2DA(ieResRef Sound, unsigned int index) { - TableMgr * tab; - - //resolving soundset (bg1/bg2 style) - if (PCStats && PCStats->SoundSet[0]&& csound[index]) { - snprintf(Sound, sizeof(ieResRef), "%s%c", PCStats->SoundSet, csound[index]); - return; - } - - Sound[0]=0; int table=core->LoadTable( anims->ResRef ); if (table<0) { return; } - tab = core->GetTable( table ); + TableMgr * tab = core->GetTable( table ); if (!tab) { goto end; } @@ -3274,9 +3265,56 @@ strnlwrcpy(Sound, tab->QueryField (index, 0), 8); end: core->DelTable( table ); +} +void Actor::GetSoundFromINI(ieResRef Sound, unsigned int index) +{ + const char *resource = ""; + char section[12]; + snprintf(section,10,"%d", BaseStats[IE_ANIMATION_ID]); + + switch(index) { + case VB_ATTACK: + resource = core->GetResDataINI()->GetKeyAsString(section, "at1sound",""); + break; + case VB_DAMAGE: + resource = core->GetResDataINI()->GetKeyAsString(section, "hitsound",""); + break; + case VB_DIE: + resource = core->GetResDataINI()->GetKeyAsString(section, "dfbsound",""); + break; + case VB_SELECT: + break; + } + int count = CountElements(resource,','); + if (count<=0) return; + count = core->Roll(1,count,-1); + while(count--) { + while(*resource && *resource!=',') resource++; + if (*resource==',') resource++; + } + strncpy(Sound, resource, 8); + for(count=0;count<8 && Sound[count]!=',';count++); + Sound[count]=0; } +void Actor::ResolveStringConstant(ieResRef Sound, unsigned int index) +{ + //resolving soundset (bg1/bg2 style) + if (PCStats && PCStats->SoundSet[0]&& csound[index]) { + snprintf(Sound, sizeof(ieResRef), "%s%c", PCStats->SoundSet, csound[index]); + return; + } + + Sound[0]=0; + + if (core->HasFeature(GF_RESDATA_INI)) { + GetSoundFromINI(Sound, index); + } else { + GetSoundFrom2DA(Sound, index); + } +} + void Actor::SetActionButtonRow(ActionButtonRow &ar) { for(int i=0;i<MAX_QSLOTS;i++) { @@ -3388,7 +3426,7 @@ ScriptedAnimation *Actor::FindOverlay(int index) { vvcVector *vvcCells; - + if (index>31) return NULL; if (hc_locations&(1<<index)) vvcCells=&vvcShields; @@ -3877,10 +3915,10 @@ int i; int turnundeadlevel = 0; int levels[3]={BaseStats[IE_LEVEL],BaseStats[IE_LEVEL2],BaseStats[IE_LEVEL3]}; - + int classid = BaseStats[IE_CLASS]; int slot = 0; - + for (i=0;i<11;i++) { //this is not good for multiclassing yet if ((1<<classid)&isclass[i]) { @@ -3890,7 +3928,7 @@ } //recalculate all level based changes pcf_level(this,0,0); - + if (isclass[ISCLERIC]&(1<<classid)) { turnundeadlevel = BaseStats[IE_LEVELCLERIC]+1-turnlevels[classid]; if (turnundeadlevel<0) turnundeadlevel=0; @@ -3901,7 +3939,7 @@ } else { turnundeadlevel = 0; } - + ieDword backstabdamagemultiplier=BaseStats[IE_LEVELTHIEF]; if (backstabdamagemultiplier) { backstabdamagemultiplier=backstabdamagemultiplier+3/4; @@ -3926,7 +3964,7 @@ for (i=0;i<11;i++) { int tmp; - + if (turnlevels[i+1]) { tmp = BaseStats[IE_LEVELBARBARIAN+i]+1-turnlevels[i+1]; if (tmp<0) tmp=0; Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-11-08 18:51:05 UTC (rev 4815) @@ -423,6 +423,8 @@ void WalkTo(Point &Des, ieDword flags, int MinDistance = 0); /* resolve string constant (sound will be altered) */ void ResolveStringConstant(ieResRef sound, unsigned int index); + void GetSoundFromINI(ieResRef Sound, unsigned int index); + void GetSoundFrom2DA(ieResRef Sound, unsigned int index); /* sets the quick slots */ void SetActionButtonRow(ActionButtonRow &ar); /* updates the quick slots */ Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-11-08 18:51:05 UTC (rev 4815) @@ -57,6 +57,7 @@ #define RL_MATCHSECTYPE 4 //match secondary type #define RL_REMOVEFIRST 8 //remove only one spell (could be more effects) +//bouncing immunities #define BNC_PROJECTILE 1 #define BNC_OPCODE 2 #define BNC_LEVEL 4 @@ -70,6 +71,20 @@ #define BNC_SECTYPE_DEC 0x1000 #define BNC_RESOURCE_DEC 0x2000 +//normal immunities +#define IMM_PROJECTILE 1 +#define IMM_OPCODE 2 +#define IMM_LEVEL 4 +#define IMM_SCHOOL 8 +#define IMM_SECTYPE 16 +#define IMM_RESOURCE 32 +#define IMM_PROJECTILE_DEC 0x100 +#define IMM_OPCODE_DEC 0x200 +#define IMM_LEVEL_DEC 0x400 +#define IMM_SCHOOL_DEC 0x800 +#define IMM_SECTYPE_DEC 0x1000 +#define IMM_RESOURCE_DEC 0x2000 + // FIXME: Dice roll should be probably done just once, e.g. when equipping // the item, not each time the fx are applied // <avenger> the dice values are actually level limits, except in 3 hp modifier functions Modified: gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -335,7 +335,7 @@ Strref = tmp; } - if (Strref != -1) { + if ((Strref != -1) && !sb.Sound[0]) { sb = core->strings->GetStringBlock( Strref ); if (flags & DS_CONSOLE) { //can't play the sound here, we have to delay action Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -122,6 +122,7 @@ INIparty = NULL; INIbeasts = NULL; INIquests = NULL; + INIresdata = NULL; game = NULL; worldmap = NULL; CurrentStore = NULL; @@ -489,6 +490,9 @@ if (INIparty) { FreeInterface(INIparty); } + if (INIresdata) { + FreeInterface(INIresdata); + } Map::ReleaseMemory(); GameScript::ReleaseMemory(); Actor::ReleaseMemory(); @@ -1512,6 +1516,24 @@ return GEM_ERROR; } printStatus( "OK", LIGHT_GREEN ); + + if (HasFeature( GF_RESDATA_INI )) { + printMessage( "Core", "Loading resource data File...", + WHITE ); + INIresdata = ( DataFileMgr * ) GetInterface( IE_INI_CLASS_ID ); + FileStream* fs = new FileStream(); + char tINIresdata[_MAX_PATH]; + PathJoin( tINIresdata, GamePath, "resdata.ini", NULL ); + ResolveFilePath( tINIresdata ); + // FIXME: crashes if file does not open + fs->Open( tINIresdata, true ); + if (!INIresdata->Open( fs, true )) { + printStatus( "ERROR", LIGHT_RED ); + } else { + printStatus( "OK", LIGHT_GREEN ); + } + } + if (HasFeature( GF_HAS_PARTY_INI )) { printMessage( "Core", "Loading precreated teams setup...", WHITE ); @@ -2176,6 +2198,7 @@ "DeathOnZeroStat", //32GF_DEATH_ON_ZERO_STAT "SpawnIni", //33GF_SPAWN_INI "IWDDeathVarFormat", //34GF_IWD_DEATHVARFORMAT + "HasResDataIni", //35GF_RESDATA_INI NULL //for our own safety, this marks the end of the pole }; Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-11-08 18:51:05 UTC (rev 4815) @@ -263,6 +263,7 @@ DataFileMgr * INIparty; DataFileMgr * INIbeasts; DataFileMgr * INIquests; + DataFileMgr * INIresdata; Game * game; WorldMapArray* worldmap; ieDword GameFeatures; //the first 32 bits @@ -486,6 +487,10 @@ { return INIquests; } + DataFileMgr * GetResDataINI() const + { + return INIresdata; + } /** Gets the Game class */ Game * GetGame() const { @@ -568,7 +573,7 @@ /** creates a vvc/bam animation object at point */ ScriptedAnimation* GetScriptedAnimation( const char *ResRef, bool doublehint); /** returns the first selected PC, if forced is set, then it returns - first PC if none was selected */ + first PC if none was selected */ Actor *GetFirstSelectedPC(bool forced); /** returns a single sprite (not cached) from a BAM resource */ Sprite2D* GetBAMSprite(const ieResRef ResRef, int cycle, int frame); Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -590,9 +590,14 @@ if (!item) { continue; } - if ( !(item->Flags&IE_INV_ITEM_MAGICAL) ) { - continue; + + //don't harm critical items + //don't harm nonmagical items + //don't harm indestructible items + if ( (item->Flags&(IE_INV_ITEM_CRITICAL|IE_INV_DEPLETABLE)) != IE_INV_DEPLETABLE) { + continue; } + //if flags = 0 then weapons are not depleted if (!flags) { Item *itm = core->GetItem( item->ItemResRef ); @@ -1013,7 +1018,7 @@ //i've absolutely NO idea what is this 4 (Avenger) //Equipped should be 0-3 in iWD2, no??? if (Equipped >= 4) { - return SLOT_MELEE; + return SLOT_MELEE; } return Equipped*2+SLOT_MELEE; } Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-11-08 18:51:05 UTC (rev 4815) @@ -121,6 +121,8 @@ IE_INV_ITEM_PULSATING = 0x100000 } ieCREItemFlagBits; +#define IE_INV_DEPLETABLE (IE_INV_ITEM_MAGICAL|IE_INV_ITEM_DESTRUCTIBLE) + //equip flags #define EQUIP_ANY 0 #define EQUIP_MELEE 1 Modified: gemrb/trunk/gemrb/plugins/Core/Triggers.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -3893,8 +3893,7 @@ return 0; } Actor* actor = ( Actor* ) tar; - //this isn't ok - if (actor->GetStat(IE_BOUNCE)) return 1; + if (actor->GetStat(IE_IMMUNITY)) return 1; return 0; } Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -179,8 +179,8 @@ int fx_set_regenerating_state (Actor* Owner, Actor* target, Effect* fx);//62 int fx_spell_duration_modifier (Actor* Owner, Actor* target, Effect* fx);///63 int fx_generic_effect (Actor* Owner, Actor* target, Effect* fx);//64 protection from creature is a generic effect -//65 protection from opcode is a generic effect -//66 protection from spell level is a generic effect +int fx_protection_opcode(Actor* Owner, Actor* target, Effect* fx); //65 +int fx_protection_spelllevel (Actor* Owner, Actor* target, Effect* fx); //66 int fx_change_name (Actor* Owner, Actor* target, Effect* fx);//67 int fx_experience_modifier (Actor* Owner, Actor* target, Effect* fx);//68 int fx_gold_modifier (Actor* Owner, Actor* target, Effect* fx);//69 @@ -243,7 +243,7 @@ int fx_cure_panic_state (Actor* Owner, Actor* target, Effect* fx);//a1 int fx_cure_hold_state (Actor* Owner, Actor* target, Effect* fx);//a2 //cures 175 int fx_cure_slow_state (Actor* Owner, Actor* target, Effect* fx);//a3 -//a4 slow poison is a generic effect? +int fx_cure_intoxication (Actor* Owner, Actor* target, Effect* fx);//a4 int fx_pause_target (Actor* Owner, Actor* target, Effect* fx);//a5 int fx_magic_resistance_modifier (Actor* Owner, Actor* target, Effect* fx);//a6 int fx_missile_to_hit_modifier (Actor* Owner, Actor* target, Effect* fx);//a7 @@ -280,13 +280,15 @@ int fx_bounce_opcode (Actor* Owner, Actor* target, Effect* fx);//c6 int fx_bounce_spelllevel (Actor* Owner, Actor* target, Effect* fx);//c7 int fx_bounce_spelllevel_dec (Actor* Owner, Actor* target, Effect* fx);//c8 -int fx_generic_decrement_effect (Actor* Owner, Actor* target, Effect* fx);//c9 +int fx_protection_spelllevel_dec (Actor* Owner, Actor* target, Effect* fx);//c9 int fx_bounce_school (Actor* Owner, Actor* target, Effect* fx);//ca int fx_bounce_secondary_type (Actor* Owner, Actor* target, Effect* fx);//cb -//cc resist school -//cd resist sectype +int fx_protection_school (Actor* Owner, Actor* target, Effect* fx); //cc +int fx_protection_secondary_type (Actor* Owner, Actor* target, Effect* fx); //cd int fx_resist_spell (Actor* Owner, Actor* target, Effect* fx);//ce +int fx_resist_spell_dec (Actor* Owner, Actor* target, Effect* fx);//?? int fx_bounce_spell (Actor* Owner, Actor* target, Effect* fx);//cf +int fx_bounce_spell_dec (Actor* Owner, Actor* target, Effect* fx);//?? int fx_minimum_hp_modifier (Actor* Owner, Actor* target, Effect* fx);//d0 int fx_power_word_kill (Actor* Owner, Actor* target, Effect* fx);//d1 int fx_power_word_stun (Actor* Owner, Actor* target, Effect* fx);//d2 @@ -302,10 +304,10 @@ int fx_dispel_school (Actor* Owner, Actor* target, Effect* fx);//dc int fx_dispel_secondary_type (Actor* Owner, Actor* target, Effect* fx);//dd int fx_teleport_field (Actor* Owner, Actor* target, Effect* fx);//de -//df decrementing school immunity (fx_generic_decrement_effect) +int fx_protection_school_dec (Actor* Owner, Actor* target, Effect* fx);//df int fx_cure_leveldrain (Actor* Owner, Actor* target, Effect* fx);//e0 int fx_reveal_magic (Actor* Owner, Actor* target, Effect* fx);//e1 -//e2 decrementing secondary type immunity (fx_generic_decrement_effect) +int fx_protection_secondary_type_dec (Actor* Owner, Actor* target, Effect* fx);//e2 int fx_bounce_school_dec (Actor* Owner, Actor* target, Effect* fx);//e3 int fx_bounce_secondary_type_dec (Actor* Owner, Actor* target, Effect* fx);//e4 int fx_dispel_school_one (Actor* Owner, Actor* target, Effect* fx);//e5 @@ -434,6 +436,7 @@ { "Bounce:SecondaryType", fx_bounce_secondary_type, -1 }, { "Bounce:SecondaryTypeDec", fx_bounce_secondary_type_dec, -1 }, { "Bounce:Spell", fx_bounce_spell, -1 }, + { "Bounce:SpellDec", fx_bounce_spell_dec, -1 }, { "Bounce:SpellLevel", fx_bounce_spelllevel, -1}, { "Bounce:SpellLevelDec", fx_bounce_spelllevel_dec, -1}, { "Bounce:Opcode", fx_bounce_opcode, -1 }, @@ -480,6 +483,7 @@ { "Cure:Hold", fx_cure_hold_state, -1 }, { "Cure:Imprisonment", fx_freedom, -1 }, { "Cure:Infravision", fx_cure_infravision_state, -1 }, + { "Cure:Intoxication", fx_cure_intoxication, -1 }, //0xa4 (iwd2 has this working) { "Cure:Invisible", fx_cure_invisible_state, -1 }, //0x2f { "Cure:Invisible2", fx_cure_invisible_state, -1 }, //0x74 //{ "Cure:ImprovedInvisible", fx_cure_improved_invisible_state, -1 }, @@ -620,17 +624,17 @@ { "Protection:Animation", fx_generic_effect, -1 }, { "Protection:Backstab", fx_no_backstab_modifier, -1 }, { "Protection:Creature", fx_generic_effect, -1 }, - { "Protection:Opcode", fx_generic_effect, -1 }, - { "Protection:Opcode2", fx_generic_effect, -1 }, + { "Protection:Opcode", fx_protection_opcode, -1 }, + { "Protection:Opcode2", fx_protection_opcode, -1 }, { "Protection:Projectile",fx_protection_from_projectile, -1}, { "Protection:School",fx_generic_effect,-1},//overlay? - { "Protection:SchoolDec",fx_generic_decrement_effect,-1},//overlay? - { "Protection:SecondaryType",fx_generic_effect,-1},//overlay? - { "Protection:SecondaryTypeDec",fx_generic_decrement_effect,-1},//overlay? + { "Protection:SchoolDec",fx_protection_school_dec,-1},//overlay? + { "Protection:SecondaryType",fx_protection_secondary_type,-1},//overlay? + { "Protection:SecondaryTypeDec",fx_protection_secondary_type_dec,-1},//overlay? { "Protection:Spell",fx_resist_spell,-1},//overlay? - { "Protection:SpellDec",fx_generic_effect,-1},//overlay? - { "Protection:SpellLevel",fx_generic_effect,-1},//overlay? - { "Protection:SpellLevelDec",fx_generic_decrement_effect,-1},//overlay? + { "Protection:SpellDec",fx_resist_spell_dec,-1},//overlay? + { "Protection:SpellLevel",fx_protection_spelllevel,-1},//overlay? + { "Protection:SpellLevelDec",fx_protection_spelllevel_dec,-1},//overlay? { "Protection:String", fx_generic_effect, -1 }, { "Protection:Tracking", fx_protection_from_tracking, -1 }, { "Protection:Turn", fx_protection_from_turn, -1}, @@ -2413,9 +2417,10 @@ } //0x53 Protection:Projectile -int fx_protection_from_projectile (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +int fx_protection_from_projectile (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_protection_from_projectile (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + STAT_BIT_OR( IE_IMMUNITY, IMM_PROJECTILE); return FX_APPLIED; } @@ -2609,21 +2614,30 @@ } return FX_APPLIED; } -// 0x64, 65 Protection:Creature +// 0x64 Protection:Creature int fx_generic_effect (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) { if (0) printf( "fx_generic_effect (%2d): Param1: %d, Param2: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); return FX_APPLIED; } -//0x66 Protection:Level -int fx_protection_from_spell_level (Actor* /*Owner*/, Actor* target, Effect* fx) +//0x65 Protection:Opcode +int fx_protection_opcode (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_protection_from_spell_level (%2d) Level: %d\n", fx->Opcode, fx->Parameter1); + if (0) printf( "fx_protection_opcode (%2d): Opcode: %d\n", fx->Opcode, fx->Parameter2 ); + STAT_BIT_OR(IE_IMMUNITY, IMM_OPCODE); + return FX_APPLIED; +} +//0x66 Protection:SpellLevel +int fx_protection_spelllevel (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_protection_spelllevel (%2d) Level: %d\n", fx->Opcode, fx->Parameter1); + int value = fx->Parameter1; if (value<9) { STAT_BIT_OR(IE_MINORGLOBE, 1<<value); + STAT_BIT_OR(IE_IMMUNITY, IMM_LEVEL); return FX_APPLIED; } return FX_NOT_APPLIED; @@ -3667,8 +3681,17 @@ return FX_NOT_APPLIED; } -// 0xA4 //slow poison: generic effect +// 0xA4 Cure:Intoxication +static EffectRef fx_intoxication_ref={"IntoxicationModifier",NULL,-1}; +int fx_cure_intoxication (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_cure_intoxication (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); + target->fxqueue.RemoveAllEffects( fx_intoxication_ref ); + BASE_SET(IE_INTOXICATION,0); + return FX_NOT_APPLIED; +} + // 0xA5 PauseTarget int fx_pause_target (Actor* /*Owner*/, Actor *target, Effect* fx) { @@ -4055,15 +4078,16 @@ return FX_APPLIED; } -//0xc9 //Protection:SpellLevelDec -int fx_immunity_spelllevel_dec (Actor* /*Owner*/, Actor* target, Effect* fx) +//0xc9 Protection:SpellLevelDec +int fx_protection_spelllevel_dec (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_immunity_spelllevel_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + if (0) printf( "fx_protection_spelllevel_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + STAT_BIT_OR( IE_IMMUNITY, IMM_LEVEL_DEC ); target->AddPortraitIcon(PI_BOUNCE2); return FX_APPLIED; } -// 0xca Bounce:School +//0xca Bounce:School int fx_bounce_school (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_bounce_school (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); @@ -4082,11 +4106,39 @@ } // 0xcc //resist school +int fx_protection_school (Actor* /*Owner*/, Actor* target, Effect *fx) +{ + if (0) printf( "fx_protection_school (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + STAT_BIT_OR( IE_IMMUNITY, IMM_SCHOOL); + return FX_APPLIED; +} + // 0xcd //resist sectype -// 0xce //resist spell -int fx_resist_spell (Actor* /*Owner*/, Actor* /*target*/, Effect *fx) +int fx_protection_secondary_type (Actor* /*Owner*/, Actor* target, Effect *fx) { + if (0) printf( "fx_protection_secondary_type (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + STAT_BIT_OR( IE_IMMUNITY, IMM_SECTYPE); + return FX_APPLIED; +} + +//0xce Protection:Spell +int fx_resist_spell (Actor* /*Owner*/, Actor* target, Effect *fx) +{ + if (0) printf( "fx_resist_spell (%2d): Resource: %s\n", fx->Opcode, fx->Resource ); + if (strnicmp(fx->Resource,fx->Source,sizeof(fx->Resource)) ) { + STAT_BIT_OR( IE_IMMUNITY, IMM_RESOURCE); + return FX_APPLIED; + } + //this has effect only on first apply, it will stop applying the spell + return FX_ABORT; +} + +// ??? Protection:SpellDec +int fx_resist_spell_dec (Actor* /*Owner*/, Actor* target, Effect *fx) +{ + if (0) printf( "fx_resist_spell_dec (%2d): Resource: %s\n", fx->Opcode, fx->Resource ); if (strnicmp(fx->Resource,fx->Source,sizeof(fx->Resource)) ) { + STAT_BIT_OR( IE_IMMUNITY, IMM_RESOURCE_DEC); return FX_APPLIED; } //this has effect only on first apply, it will stop applying the spell @@ -4101,6 +4153,14 @@ return FX_APPLIED; } +// ??? Bounce:SpellDec +int fx_bounce_spell_dec (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_bounce_spell (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + STAT_BIT_OR( IE_BOUNCE, BNC_RESOURCE_DEC ); + return FX_APPLIED; +} + // 0xd0 MinimumHPModifier // the original engine didn't allow modifying of this stat // it allowed only setting it, and only by one instance @@ -4335,11 +4395,11 @@ } //0xDF //Protection:SchoolDec -//0xe2 //Protection:SecondaryTypeDec -int fx_generic_decrement_effect (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +int fx_protection_school_dec (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_generic_decrement_effect (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + if (0) printf( "fx_protection_school_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); if (fx->Parameter1) { + STAT_BIT_OR( IE_IMMUNITY, IMM_SCHOOL_DEC ); return FX_APPLIED; } return FX_NOT_APPLIED; @@ -4375,8 +4435,18 @@ return FX_NOT_APPLIED; } -//e2 decrementing secondary type immunity (general) -//e3 Bounce:SchoolDecrement +//0xe2 Protection:SecondaryTypeDec +int fx_protection_secondary_type_dec (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_protection_secondary_type_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); + if (fx->Parameter1) { + STAT_BIT_OR( IE_IMMUNITY, IMM_SECTYPE_DEC ); + return FX_APPLIED; + } + return FX_NOT_APPLIED; +} + +//0xe3 Bounce:SchoolDecrement int fx_bounce_school_dec (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_bounce_school_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); @@ -4385,7 +4455,7 @@ return FX_APPLIED; } -//e4 Bounce:SecondaryTypeDecrement +//0xe4 Bounce:SecondaryTypeDecrement int fx_bounce_secondary_type_dec (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_bounce_secondary_type_dec (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); @@ -4401,6 +4471,7 @@ target->fxqueue.RemoveLevelEffects(fx->Parameter1, RL_MATCHSCHOOL|RL_REMOVEFIRST, fx->Parameter2); return FX_NOT_APPLIED; } + //0xE6 DispelSecondaryTypeOne int fx_dispel_secondary_type_one (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -4408,6 +4479,7 @@ target->fxqueue.RemoveLevelEffects(fx->Parameter1,RL_MATCHSECTYPE|RL_REMOVEFIRST, fx->Parameter2); return FX_NOT_APPLIED; } + //0xE7 Timestop int fx_timestop (Actor* Owner, Actor* /*target*/, Effect* fx) { @@ -4430,6 +4502,7 @@ //last attacker case 1: actor = map->GetActorByGlobalID(target->LastHitter); break; //nearest enemy + //fix this! case 2: actor = map->GetActorByGlobalID(target->LastSeen); break; //nearest creature case 3: actor = map->GetActorByGlobalID(target->LastSeen); break; @@ -4547,6 +4620,7 @@ STAT_SET (IE_PUPPETMASTERTYPE, fx->Parameter1); return FX_APPLIED; } + // 0xed PuppetMarker int fx_puppet_marker (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -4569,6 +4643,7 @@ } return FX_NOT_APPLIED; } + // 0xef Farsee // 1 view not explored sections too // 2 param1=range (otherwise visualrange) @@ -4625,7 +4700,6 @@ // 0xf1 control creature (same as charm) // 0xF2 Cure:Confusion - static EffectRef fx_confused_state_ref={"State:Confused",NULL,-1}; int fx_cure_confused_state (Actor* /*Owner*/, Actor* target, Effect* fx) @@ -4635,7 +4709,8 @@ target->fxqueue.RemoveAllEffects(fx_confused_state_ref); return FX_NOT_APPLIED; } -// 0xf3 DrainItems + +// 0xf3 DrainItems (this is disabled in ToB) int fx_drain_items (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_drain_items (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); @@ -4788,7 +4863,7 @@ return FX_NOT_APPLIED; } -// 0x103 SpellTrap (Protection:SpellLevelDecrement + recall spells) +// 0x103 SpellTrap (Protection:SpellLevelDec + recall spells) int fx_spelltrap(Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_spelltrap (%2d): Count: %d, Level: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); Modified: gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp 2007-11-05 23:32:31 UTC (rev 4814) +++ gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp 2007-11-08 18:51:05 UTC (rev 4815) @@ -425,7 +425,7 @@ if (0) printf( "fx_move_view (%2d): Speed: %d\n", fx->Opcode, fx->Parameter1 ); Map *map = core->GetGame()->GetCurrentArea(); if (map) { - core->timer->SetMoveViewPort( fx->PosX, fx->PosY, fx->Parameter1, true); + core->timer->SetMoveViewPort( fx->PosX, fx->PosY, fx->Parameter1, true); } return FX_NOT_APPLIED; } @@ -524,7 +524,13 @@ int fx_jumble_curse (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_jumble_curse (%2d)\n", fx->Opcode ); - if (!(core->GetGame()->GameTime%100)) { + + if (STATE_GET( STATE_DEAD) ) { + return FX_NOT_APPLIED; + } + Game *game = core->GetGame(); + //do a hiccup every 75th refresh + if (fx->Parameter3/75!=fx->Parameter4/75) { //hiccups //PST has this hardcoded deep in the engine //gemrb lets you specify the strref in P#1 @@ -535,6 +541,8 @@ //tmpstr shouldn't be freed, it is taken care by Actor target->GetHit(); } + fx->Parameter4=fx->Parameter3; + fx->Parameter3=game->GameTime; STAT_SET( IE_DEADMAGIC, 1); STAT_SET( IE_SPELLFAILUREMAGE, 100); STAT_SET( IE_SPELLFAILUREPRIEST, 100); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-11-11 13:54:54
|
Revision: 4819 http://gemrb.svn.sourceforge.net/gemrb/?rev=4819&view=rev Author: avenger_teambg Date: 2007-11-11 05:54:55 -0800 (Sun, 11 Nov 2007) Log Message: ----------- fixed some textscreen problems (no sound, replay, etc) Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/TextScreen.py gemrb/trunk/gemrb/GUIScripts/bg2/TextScreen.py gemrb/trunk/gemrb/GUIScripts/how/TextScreen.py gemrb/trunk/gemrb/GUIScripts/iwd/TextScreen.py gemrb/trunk/gemrb/GUIScripts/iwd2/TextScreen.py gemrb/trunk/gemrb/GUIScripts/tob/TextScreen.py gemrb/trunk/gemrb/plugins/Core/TextArea.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg1/TextScreen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/TextScreen.py 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/GUIScripts/bg1/TextScreen.py 2007-11-11 13:54:55 UTC (rev 4819) @@ -69,9 +69,10 @@ GemRB.SetVisible (0, 0) #removing the gamecontrol screen GemRB.SetVisible (TextScreen, 1) GemRB.RewindTA (TextScreen, TextArea, 300) + GemRB.DisplayString (17556, 0xff0000) GemRB.GamePause (1, 1) + return - def FeedScroll (): global TextScreen, TextArea, Position @@ -82,18 +83,18 @@ if Value == 'NONE': Position = 1 else: - GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1) + GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1, 7) Position = Position + 1 + return - def ReplayTextScreen (): global TextScreen, TextArea, Position Position = 1 GemRB.SetEvent (TextScreen, TextArea, IE_GUI_TEXTAREA_OUT_OF_TEXT, "FeedScroll") GemRB.RewindTA (TextScreen, TextArea, 300) + return - def EndTextScreen (): global TextScreen @@ -102,4 +103,4 @@ GemRB.SetVisible (0, 1) #enabling gamecontrol screen GemRB.UnhideGUI () GemRB.GamePause (0, 1) - + return Modified: gemrb/trunk/gemrb/GUIScripts/bg2/TextScreen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/TextScreen.py 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/GUIScripts/bg2/TextScreen.py 2007-11-11 13:54:55 UTC (rev 4819) @@ -70,7 +70,9 @@ GemRB.SetVisible (TextScreen, 1) GemRB.RewindTA (TextScreen, TextArea, 300) + GemRB.DisplayString (17556, 0xff0000) GemRB.GamePause (1, 1) + return def FeedScroll (): global TextScreen, TextArea, Chapter, TableName @@ -86,16 +88,16 @@ Value = GemRB.GetTableValue (Table, line, 1) GemRB.UnloadTable (Table) - GemRB.TextAreaAppend (TextScreen, TextArea, Value) + GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1, 7) + return - def ReplayTextScreen (): global TextScreen, TextArea GemRB.SetEvent (TextScreen, TextArea, IE_GUI_TEXTAREA_OUT_OF_TEXT, "FeedScroll") GemRB.RewindTA (TextScreen, TextArea, 300) + return - def EndTextScreen (): global TextScreen @@ -104,3 +106,4 @@ GemRB.SetVisible (0, 1) #enabling gamecontrol screen GemRB.UnhideGUI () GemRB.GamePause (0, 1) + return Modified: gemrb/trunk/gemrb/GUIScripts/how/TextScreen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/TextScreen.py 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/GUIScripts/how/TextScreen.py 2007-11-11 13:54:55 UTC (rev 4819) @@ -79,9 +79,10 @@ GemRB.SetVisible (0, 0) #removing the gamecontrol screen GemRB.SetVisible (TextScreen, 1) GemRB.RewindTA (TextScreen, TextArea, 200) + GemRB.DisplayString (17556, 0xff0000) GemRB.GamePause (1, 1) + return - def FeedScroll (): global TextScreen, TextArea, Feed @@ -93,14 +94,16 @@ Table = GemRB.LoadTable ("chapters") Value = GemRB.GetTableValue (Table, Chapter, 1) GemRB.UnloadTable (Table) - GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1) + GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1, 7) + return def ReplayTextScreen (): - global TextScreen, TextArea + global TextScreen, TextArea, Feed GemRB.SetEvent (TextScreen, TextArea, IE_GUI_TEXTAREA_OUT_OF_TEXT, "FeedScroll") Feed = 0 GemRB.RewindTA (TextScreen, TextArea, 200) + return def EndTextScreen (): global TextScreen @@ -110,4 +113,4 @@ GemRB.SetVisible (0, 1) #enabling gamecontrol screen GemRB.UnhideGUI () GemRB.GamePause (0, 1) - + return Modified: gemrb/trunk/gemrb/GUIScripts/iwd/TextScreen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/TextScreen.py 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/GUIScripts/iwd/TextScreen.py 2007-11-11 13:54:55 UTC (rev 4819) @@ -79,9 +79,10 @@ GemRB.SetVisible (0, 0) #removing the gamecontrol screen GemRB.SetVisible (TextScreen, 1) GemRB.RewindTA (TextScreen, TextArea, 200) + GemRB.DisplayString (17556, 0xff0000) GemRB.GamePause (1, 1) + return - def FeedScroll (): global TextScreen, TextArea, Feed @@ -93,14 +94,16 @@ Table = GemRB.LoadTable ("chapters") Value = GemRB.GetTableValue (Table, Chapter, 1) GemRB.UnloadTable (Table) - GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1) + GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1, 7) + return def ReplayTextScreen (): - global TextScreen, TextArea + global TextScreen, TextArea, Feed GemRB.SetEvent (TextScreen, TextArea, IE_GUI_TEXTAREA_OUT_OF_TEXT, "FeedScroll") Feed = 0 GemRB.RewindTA (TextScreen, TextArea, 200) + return def EndTextScreen (): global TextScreen @@ -110,4 +113,4 @@ GemRB.SetVisible (0, 1) #enabling gamecontrol screen GemRB.UnhideGUI () GemRB.GamePause (0, 1) - + return Modified: gemrb/trunk/gemrb/GUIScripts/iwd2/TextScreen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd2/TextScreen.py 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/GUIScripts/iwd2/TextScreen.py 2007-11-11 13:54:55 UTC (rev 4819) @@ -68,22 +68,25 @@ GemRB.SetVisible (0, 0) #removing the gamecontrol screen GemRB.SetVisible (TextScreen, 1) GemRB.RewindTA (TextScreen, TextArea, 200) + GemRB.DisplayString (17556, 0xff0000) GemRB.GamePause(1, 1) + return - def FeedScroll (): global TextScreen, TextArea Table = GemRB.LoadTable ("chapters") Value = GemRB.GetTableValue (Table, Chapter+1, 1) GemRB.UnloadTable (Table) - GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1) + GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1, 7) + return def ReplayTextScreen (): global TextScreen, TextArea GemRB.SetEvent (TextScreen, TextArea, IE_GUI_TEXTAREA_OUT_OF_TEXT, "FeedScroll") GemRB.RewindTA (TextScreen, TextArea, 200) + return def EndTextScreen (): global TextScreen @@ -93,4 +96,4 @@ GemRB.SetVisible (0, 1) #enabling gamecontrol screen GemRB.UnhideGUI () GemRB.GamePause(0, 1) - + return Modified: gemrb/trunk/gemrb/GUIScripts/tob/TextScreen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/TextScreen.py 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/GUIScripts/tob/TextScreen.py 2007-11-11 13:54:55 UTC (rev 4819) @@ -70,7 +70,9 @@ GemRB.SetVisible (TextScreen, 1) GemRB.RewindTA (TextScreen, TextArea, 300) + GemRB.DisplayString (17556, 0xff0000) GemRB.GamePause (1, 1) + return def FeedScroll (): global TextScreen, TextArea, Chapter, TableName @@ -86,16 +88,16 @@ Value = GemRB.GetTableValue (Table, line, 1) GemRB.UnloadTable (Table) - GemRB.TextAreaAppend (TextScreen, TextArea, Value) + GemRB.TextAreaAppend (TextScreen, TextArea, Value, -1, 7) + return - def ReplayTextScreen (): global TextScreen, TextArea GemRB.SetEvent (TextScreen, TextArea, IE_GUI_TEXTAREA_OUT_OF_TEXT, "FeedScroll") GemRB.RewindTA (TextScreen, TextArea, 300) + return - def EndTextScreen (): global TextScreen @@ -104,3 +106,4 @@ GemRB.SetVisible (0, 1) #enabling gamecontrol screen GemRB.UnhideGUI () GemRB.GamePause (0, 1) + return Modified: gemrb/trunk/gemrb/plugins/Core/TextArea.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/TextArea.cpp 2007-11-11 10:07:08 UTC (rev 4818) +++ gemrb/trunk/gemrb/plugins/Core/TextArea.cpp 2007-11-11 13:54:55 UTC (rev 4819) @@ -709,6 +709,7 @@ } lines.clear(); lrows.clear(); + rows = 0; } //setting up the textarea for smooth scrolling, the first This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-11-15 20:48:25
|
Revision: 4828 http://gemrb.svn.sourceforge.net/gemrb/?rev=4828&view=rev Author: avenger_teambg Date: 2007-11-15 12:48:25 -0800 (Thu, 15 Nov 2007) Log Message: ----------- fixed selecting formations (in pst, just adjusted one of them) Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/iwd2/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/override/pst/formatio.2da gemrb/trunk/gemrb/plugins/Core/Interface.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py 2007-11-15 20:48:25 UTC (rev 4828) @@ -174,6 +174,7 @@ GemRB.SetVar ("Formation", GemRB.GameGetFormation ()) for i in range (5): Button = GemRB.GetControl (Window, 7+i) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) idx = GemRB.GameGetFormation (i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL, OP_SET) GemRB.SetButtonSprites (Window, Button, "GUIBTBUT",0,0,1,2,3) Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2007-11-15 20:48:25 UTC (rev 4828) @@ -185,6 +185,7 @@ GemRB.SetVar ("Formation", GemRB.GameGetFormation ()) for i in range (5): Button = GemRB.GetControl (Window, 7+i) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) idx = GemRB.GameGetFormation (i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL, OP_SET) GemRB.SetButtonSprites (Window, Button, "GUIBTBUT",0,0,1,2,3) Modified: gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-11-15 20:48:25 UTC (rev 4828) @@ -180,6 +180,7 @@ GemRB.SetVar ("Formation", GemRB.GameGetFormation ()) for i in range (5): Button = GemRB.GetControl (Window, 7+i) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) idx = GemRB.GameGetFormation (i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL, OP_SET) GemRB.SetButtonSprites (Window, Button, "GUIBTBUT",0,i*2,i*2+1,i*2+24,i*2+25) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-11-15 20:48:25 UTC (rev 4828) @@ -178,6 +178,7 @@ GemRB.SetVar ("Formation", GemRB.GameGetFormation ()) for i in range (5): Button = GemRB.GetControl (Window, 7+i) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) idx = GemRB.GameGetFormation (i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL, OP_SET) GemRB.SetButtonSprites (Window, Button, "GUIBTBUT",0,i*2,i*2+1,i*2+24,i*2+25) Modified: gemrb/trunk/gemrb/GUIScripts/iwd2/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd2/GUICommonWindows.py 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/GUIScripts/iwd2/GUICommonWindows.py 2007-11-15 20:48:25 UTC (rev 4828) @@ -162,6 +162,7 @@ GemRB.SetVar ("Formation", GemRB.GameGetFormation ()) for i in range (5): Button = GemRB.GetControl (Window, 13+i) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) idx = GemRB.GameGetFormation (i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL, OP_SET) GemRB.SetButtonSprites (Window, Button, "GUIBTBUT",0,0,1,2,3) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-11-15 20:48:25 UTC (rev 4828) @@ -185,6 +185,7 @@ GemRB.SetVar ("Formation", GemRB.GameGetFormation ()) for i in range (5): Button = GemRB.GetControl (Window, 7+i) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) idx = GemRB.GameGetFormation (i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL, OP_SET) GemRB.SetButtonSprites (Window, Button, "GUIBTBUT",0,0,1,2,3) Modified: gemrb/trunk/gemrb/override/pst/formatio.2da =================================================================== --- gemrb/trunk/gemrb/override/pst/formatio.2da 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/override/pst/formatio.2da 2007-11-15 20:48:25 UTC (rev 4828) @@ -6,7 +6,7 @@ GATHER 0 0 -2 1 2 1 -2 2 2 2 0 3 0 4 4AND2 0 0 1 0 -1 0 2 0 0 1 1 1 0 2 3BY2 0 0 -1 0 1 0 0 1 -1 1 1 1 0 2 -PROTECT 0 0 2 0 1 1 -1 1 3 1 1 2 1 3 +PROTECT 0 0 -2 -2 2 1 -2 1 2 -2 0 3 0 -3 2BY3 0 0 1 0 0 1 1 1 0 2 1 2 0 3 RANK 0 0 -1 0 1 0 -2 0 2 0 -3 0 3 0 V 0 0 1 0 -1 1 2 1 -2 2 3 2 -3 3 Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-14 21:23:58 UTC (rev 4827) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-11-15 20:48:25 UTC (rev 4828) @@ -5355,4 +5355,3 @@ } return stat; } -//another test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-12-07 22:45:54
|
Revision: 4885 http://gemrb.svn.sourceforge.net/gemrb/?rev=4885&view=rev Author: avenger_teambg Date: 2007-12-07 14:45:55 -0800 (Fri, 07 Dec 2007) Log Message: ----------- added zefklop's patch for scrolling cursors Modified Paths: -------------- gemrb/trunk/gemrb/override/bg1/gemrb.ini gemrb/trunk/gemrb/override/bg2/gemrb.ini gemrb/trunk/gemrb/override/how/gemrb.ini gemrb/trunk/gemrb/override/iwd2/gemrb.ini gemrb/trunk/gemrb/override/pst/gemrb.ini gemrb/trunk/gemrb/override/tob/gemrb.ini gemrb/trunk/gemrb/plugins/Core/GameControl.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GlobalTimer.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Video.h gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h Modified: gemrb/trunk/gemrb/override/bg1/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/bg1/gemrb.ini 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/override/bg1/gemrb.ini 2007-12-07 22:45:55 UTC (rev 4885) @@ -25,6 +25,9 @@ ; Bitmap resource for cursors CursorBAM = CAROT +; Bitmap resource for scroll cursor arrow +ScrollCursorBAM = CURSARW + ; Bitmap resource for dialog buttons font ButtonFont = STONESML Modified: gemrb/trunk/gemrb/override/bg2/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/bg2/gemrb.ini 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/override/bg2/gemrb.ini 2007-12-07 22:45:55 UTC (rev 4885) @@ -25,6 +25,9 @@ ; Bitmap resource for cursors CursorBAM = CAROT +; Bitmap resource for scroll cursor arrow +ScrollCursorBAM = CURSARW + ; Bitmap resource for dialog buttons font ButtonFont = STONESML Modified: gemrb/trunk/gemrb/override/how/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/how/gemrb.ini 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/override/how/gemrb.ini 2007-12-07 22:45:55 UTC (rev 4885) @@ -25,6 +25,9 @@ ; Bitmap resource for cursors CursorBAM = CAROT +; Bitmap resource for scroll cursor arrow +ScrollCursorBAM = CURSARW + ; Bitmap resource for dialog buttons font ButtonFont = STONESML Modified: gemrb/trunk/gemrb/override/iwd2/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/iwd2/gemrb.ini 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/override/iwd2/gemrb.ini 2007-12-07 22:45:55 UTC (rev 4885) @@ -25,6 +25,9 @@ ; Bitmap resource for cursors CursorBAM = CAROT +; Bitmap resource for scroll cursor arrow +ScrollCursorBAM = CURSARW + ; Bitmap resource for dialog buttons font ButtonFont = NORMAL Modified: gemrb/trunk/gemrb/override/pst/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/pst/gemrb.ini 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/override/pst/gemrb.ini 2007-12-07 22:45:55 UTC (rev 4885) @@ -25,6 +25,9 @@ ; Bitmap resource for cursors CursorBAM = CARET +; Bitmap resource for scroll cursor arrow +ScrollCursorBAM = CURSARW + ; Bitmap resource for dialog buttons font ButtonFont = FONTDLG Modified: gemrb/trunk/gemrb/override/tob/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/tob/gemrb.ini 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/override/tob/gemrb.ini 2007-12-07 22:45:55 UTC (rev 4885) @@ -25,6 +25,9 @@ ; Bitmap resource for cursors CursorBAM = CAROT +; Bitmap resource for scroll cursor arrow +ScrollCursorBAM = CURSARW + ; Bitmap resource for dialog buttons font ButtonFont = STONESML Modified: gemrb/trunk/gemrb/plugins/Core/GameControl.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-12-07 22:45:55 UTC (rev 4885) @@ -287,21 +287,25 @@ } int tmp; - tmp = core->ArrowSprites[0]->Width; + Sprite2D *spr = core->GetScrollCursorSprite(0,0); + tmp = spr->Width; + //tmp = core->ArrowSprites[0]->Width; + if (p.x>viewport.x+viewport.w-tmp) { p.x=viewport.x+viewport.w-tmp; draw |= D_RIGHT; } - tmp = core->ArrowSprites[0]->Height; + tmp = spr->Height; + //tmp = core->ArrowSprites[0]->Height; if (p.y>viewport.y+viewport.h-tmp) { p.y=viewport.y+viewport.h-tmp; draw |= D_BOTTOM; } if (arrow_orientations[draw]>=0) { - video->BlitGameSprite( core->ArrowSprites[arrow_orientations[draw]], p.x+screen.x, p.y+screen.y, 0, black, NULL); + video->BlitGameSprite( core->GetScrollCursorSprite(arrow_orientations[draw], 0), p.x+screen.x, p.y+screen.y, 0, black, NULL); } } Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-12-07 22:45:55 UTC (rev 4885) @@ -530,11 +530,11 @@ {"face", GameScript::Face,AF_BLOCKING}, {"faceobject", GameScript::FaceObject, AF_BLOCKING}, {"facesavedlocation", GameScript::FaceSavedLocation, AF_BLOCKING}, - {"fadefromblack", GameScript::FadeFromColor, 0}, //probably the same - {"fadefromcolor", GameScript::FadeFromColor, 0}, - {"fadetoandfromcolor", GameScript::FadeToAndFromColor, 0}, - {"fadetoblack", GameScript::FadeToColor, 0}, //probably the same - {"fadetocolor", GameScript::FadeToColor, 0}, + {"fadefromblack", GameScript::FadeFromColor, AF_BLOCKING}, //probably the same + {"fadefromcolor", GameScript::FadeFromColor, AF_BLOCKING}, + {"fadetoandfromcolor", GameScript::FadeToAndFromColor, AF_BLOCKING}, + {"fadetoblack", GameScript::FadeToColor, AF_BLOCKING}, //probably the same + {"fadetocolor", GameScript::FadeToColor, AF_BLOCKING}, {"fakeeffectexpirycheck", GameScript::FakeEffectExpiryCheck, 0}, {"finalsave", GameScript::SaveGame, 0}, //synonym {"findtraps", GameScript::FindTraps, 0}, Modified: gemrb/trunk/gemrb/plugins/Core/GlobalTimer.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GlobalTimer.cpp 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/Core/GlobalTimer.cpp 2007-12-07 22:45:55 UTC (rev 4885) @@ -140,6 +140,11 @@ unsigned long advance; Video *video = core->GetVideoDriver(); + + if (video->isScrolling() ) + video->drawScrollCursorSprite(video->whereIsTheCursor()); + + UpdateAnimations(); GetTime( thisTime ); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-12-07 22:45:55 UTC (rev 4885) @@ -182,6 +182,7 @@ strncpy( TooltipFont, "STONESML", sizeof(TooltipFont) ); strncpy( MovieFont, "STONESML", sizeof(MovieFont) ); strncpy( CursorBam, "CAROT", sizeof(CursorBam) ); + strncpy( ScrollCursorBam, "CURSARW", sizeof(ScrollCursorBam) ); strncpy( GlobalScript, "BALDUR", sizeof(GlobalScript) ); strncpy( WorldMapName, "WORLDMAP", sizeof(WorldMapName) ); strncpy( Palette16, "MPALETTE", sizeof(Palette16) ); @@ -208,7 +209,7 @@ memset( WindowFrames, 0, sizeof( WindowFrames )); memset( GroundCircles, 0, sizeof( GroundCircles )); memset(FogSprites, 0, sizeof( FogSprites )); - memset(ArrowSprites, 0, sizeof( ArrowSprites )); + //memset(ArrowSprites, 0, sizeof( ArrowSprites )); AreaAliasTable = NULL; ItemExclTable = NULL; ItemDialTable = NULL; @@ -408,26 +409,26 @@ if (video) { unsigned int i; - - for(i=0;i<sizeof(ArrowSprites)/sizeof(Sprite2D *);i++ ) { - video->FreeSprite(ArrowSprites[i]); - } - + + //for(i=0;i<sizeof(ArrowSprites)/sizeof(Sprite2D *);i++ ) { + // video->FreeSprite(ArrowSprites[i]); + //} + for(i=0;i<sizeof(FogSprites)/sizeof(Sprite2D *);i++ ) { //freesprite checks for null pointer video->FreeSprite(FogSprites[i]); } - + for(i=0;i<4;i++) { video->FreeSprite(WindowFrames[i]); } - + for (int size = 0; size < MAX_CIRCLE_SIZE; size++) { for(i=0;i<6;i++) { video->FreeSprite(GroundCircles[size][i]); } } - + if (TooltipBack) { for(i=0;i<3;i++) { //freesprite checks for null pointer @@ -627,7 +628,7 @@ QuitFlag &= ~QF_ENTERGAME; if (game) { timer->Init(); - + //rearrange party slots game->ConsolidateParty(); GameControl* gc = StartGameControl(); @@ -767,7 +768,7 @@ idx = aa->GetRowCount(); while (idx--) { ieResRef key; - + strnlwrcpy(key,aa->GetRowName(idx),8); ieDword value = strtol(aa->QueryField(idx,0),NULL,0); ItemExclTable->SetAt(key, value); @@ -801,7 +802,7 @@ idx = aa->GetRowCount(); while (idx--) { ieResRef key, dlgres; - + strnlwrcpy(key,aa->GetRowName(idx),8); ieDword value = strtol(aa->QueryField(idx,0),NULL,0); ItemDialTable->SetAt(key, value); @@ -832,7 +833,7 @@ while (idx--) { ieResRef key; int *tmppoi = (int *) malloc(sizeof(int)*3); - + strnlwrcpy(key,aa->GetRowName(idx),8); for (int i=0;i<3;i++) { tmppoi[i] = atoi(aa->QueryField(idx,i)); @@ -917,7 +918,7 @@ int idx = aa->GetRowCount(); while (idx--) { ieResRef key; - + strnlwrcpy(key,aa->GetRowName(idx),8); ieDword value = atoi(aa->QueryField(idx,0)); AreaAliasTable->SetAt(key, value); @@ -964,14 +965,14 @@ Palette* palette = CreatePalette( white, black ); do { //don't change script when quitting is pending - + while (QuitFlag) { HandleFlags(); } if (EventFlag) { HandleEvents(); } - + DrawWindows(); if (DrawFPS) { frame++; @@ -1079,17 +1080,17 @@ printStatus( "OK", LIGHT_GREEN ); // Load arrow cursors - str = key->GetResource( "cursarw", IE_BAM_CLASS_ID ); - printMessage( "Core", "Loading arrow cursor bitmaps...\n", WHITE ); - anim->Open( str, true ); - if (anim->GetCycleCount( ) != MAX_ORIENT/2) { - printStatus( "ERROR", LIGHT_RED ); - goto end_of_init; - } + //str = key->GetResource( "cursarw", IE_BAM_CLASS_ID ); + //printMessage( "Core", "Loading arrow cursor bitmaps...\n", WHITE ); + //anim->Open( str, true ); + //if (anim->GetCycleCount( ) != MAX_ORIENT/2) { + // printStatus( "ERROR", LIGHT_RED ); + // goto end_of_init; + //} - for(i=0;i<MAX_ORIENT/2;i++) { - ArrowSprites[i] = anim->GetFrameFromCycle( i, 0); - } + //for(i=0;i<MAX_ORIENT/2;i++) { + // ArrowSprites[i] = anim->GetFrameFromCycle( i, 0); + //} // Load fog-of-war bitmaps str = key->GetResource( "fogowar", IE_BAM_CLASS_ID ); @@ -1175,7 +1176,7 @@ printStatus( "ERROR", LIGHT_RED ); goto end_of_init; } - + for (int i = 0; i < 6; i++) { Sprite2D* sprite = anim->GetFrameFromCycle( (ieByte) i, 0 ); if (GroundCircleScale[size]) { @@ -1215,7 +1216,7 @@ } strncpy( fnt->ResRef, ResRef, 8 ); if (needpalette) { - + Color fore = {0xff, 0xff, 0xff, 0}; Color back = {0x00, 0x00, 0x00, 0}; if (!strnicmp( TooltipFont, ResRef, 8) ) { @@ -1567,7 +1568,7 @@ } else { printStatus( "OK", LIGHT_GREEN ); } - + printMessage( "Core", "Loading quests definition File...\n", WHITE ); INIquests = ( DataFileMgr * ) GetInterface( IE_INI_CLASS_ID ); @@ -1710,115 +1711,115 @@ switch (type) { case IE_2DA_CLASS_ID: return ".2da"; - + case IE_ACM_CLASS_ID: return ".acm"; - + case IE_ARE_CLASS_ID: return ".are"; - + case IE_BAM_CLASS_ID: return ".bam"; - + case IE_BCS_CLASS_ID: return ".bcs"; - + case IE_BS_CLASS_ID: return ".bs"; case IE_BIF_CLASS_ID: return ".bif"; - + case IE_BMP_CLASS_ID: return ".bmp"; - + case IE_PNG_CLASS_ID: return ".png"; - + case IE_CHR_CLASS_ID: return ".chr"; - + case IE_CHU_CLASS_ID: return ".chu"; - + case IE_CRE_CLASS_ID: return ".cre"; - + case IE_DLG_CLASS_ID: return ".dlg"; - + case IE_EFF_CLASS_ID: return ".eff"; - + case IE_GAM_CLASS_ID: return ".gam"; - + case IE_IDS_CLASS_ID: return ".ids"; - + case IE_INI_CLASS_ID: return ".ini"; - + case IE_ITM_CLASS_ID: return ".itm"; - + case IE_KEY_CLASS_ID: return ".key"; - + case IE_MOS_CLASS_ID: return ".mos"; - + case IE_MUS_CLASS_ID: return ".mus"; - + case IE_MVE_CLASS_ID: return ".mve"; - + case IE_PLT_CLASS_ID: return ".plt"; - + case IE_PRO_CLASS_ID: return ".pro"; - + case IE_SAV_CLASS_ID: return ".sav"; - + case IE_SPL_CLASS_ID: return ".spl"; - + case IE_SRC_CLASS_ID: return ".src"; - + case IE_STO_CLASS_ID: return ".sto"; - + case IE_TIS_CLASS_ID: return ".tis"; - + case IE_TLK_CLASS_ID: return ".tlk"; - + case IE_TOH_CLASS_ID: return ".toh"; - + case IE_TOT_CLASS_ID: return ".tot"; - + case IE_VAR_CLASS_ID: return ".var"; - + case IE_VVC_CLASS_ID: return ".vvc"; - + case IE_WAV_CLASS_ID: return ".wav"; - + case IE_WED_CLASS_ID: return ".wed"; - + case IE_WFX_CLASS_ID: return ".wfx"; - + case IE_WMP_CLASS_ID: return ".wmp"; } @@ -2234,6 +2235,10 @@ if (s) strcpy( CursorBam, s ); + s = ini->GetKeyAsString( "resources", "ScrollCursorBAM", NULL ); + if (s) + strcpy( ScrollCursorBam, s ); + s = ini->GetKeyAsString( "resources", "ButtonFont", NULL ); if (s) strcpy( ButtonFont, s ); @@ -2761,7 +2766,7 @@ int slot = -1; for(unsigned int i = 0; i < windows.size(); i++) { Window *w = windows[i]; - + if(w==NULL) { slot = i; break; @@ -2898,7 +2903,7 @@ } evntmgr->DelWindow( win ); break; - + case WINDOW_VISIBLE: if (win->WindowID==65535) { video->SetViewport( win->XPos, win->YPos, win->Width, win->Height); @@ -3001,13 +3006,13 @@ //this variable is used all over in the following hacks int flg = gc->GetDialogueFlags(); GSUpdate(!(flg & DF_FREEZE_SCRIPTS) ); - + //the following part is a series of hardcoded gui behaviour - + //updating panes according to the saved game //pst requires this before initiating dialogs because it has //no dialog window by default - + //initiating dialog if (flg & DF_IN_DIALOG) { // -3 noaction @@ -3030,7 +3035,7 @@ gc->SetDialogueFlags(DF_OPENCONTINUEWINDOW|DF_OPENENDWINDOW, BM_NAND); } } - + //handling container if (CurrentContainer && UseContainer) { if (!(flg & DF_IN_CONTAINER) ) { @@ -3054,10 +3059,10 @@ size_t i = topwin.size(); while(i--) { unsigned int t = topwin[i]; - + if ( t >=windows.size() ) continue; - + //visible ==1 or 2 will be drawn Window* win = windows[t]; if (win != NULL) { @@ -3763,7 +3768,7 @@ if (!gam_str || !wmp_str) goto cleanup; - + // Load GAM file gam_mgr = ( SaveGameMgr* ) GetInterface( IE_GAM_CLASS_ID ); if (!gam_mgr) @@ -4397,7 +4402,7 @@ if (item) { DraggedCursor = GetBAMSprite( Picture, 0, 0 ); } - + video->SetDragCursor (DraggedCursor); } } @@ -4521,7 +4526,7 @@ int i,j,k; char *endptr; ieResRef NewItem; - + void* lookup; if ( !RtRows->Lookup( itm->ItemResRef, lookup ) ) { return true; @@ -4789,7 +4794,7 @@ //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( CurrentStore->Name, IE_STO_CLASS_ID ); int ret = sm->PutStore (&str, CurrentStore); if (ret <0) { @@ -4815,7 +4820,7 @@ if ( !strnicmp(CurrentStore->Name, resname, 8) ) { return CurrentStore; } - + //not simply delete the old store, but save it CloseCurrentStore(); } @@ -4960,6 +4965,11 @@ return GetBAMSprite(CursorBam, 0, 0); } +Sprite2D *Interface::GetScrollCursorSprite(int frameNum, int spriteNum) +{ + return GetBAMSprite(ScrollCursorBam, frameNum, spriteNum); +} + /* we should return -1 if it isn't gold, otherwise return the gold value */ int Interface::CanMoveItem(const CREItem *item) const { @@ -5053,7 +5063,7 @@ //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( map->GetScriptName(), IE_ARE_CLASS_ID ); int ret = mm->PutArea (&str, map); if (ret <0) { @@ -5111,7 +5121,7 @@ //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( folder, GameNameResRef, IE_GAM_CLASS_ID ); int ret = gm->PutGame (&str, game); if (ret <0) { @@ -5139,7 +5149,7 @@ //created streams are always autofree (close file on destruct) //this one will be destructed when we return from here FileStream str; - + str.Create( folder, WorldMapName, IE_WMP_CLASS_ID ); int ret = wmm->PutWorldMap (&str, worldmap); if (ret <0) { Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-12-07 22:45:55 UTC (rev 4885) @@ -270,6 +270,7 @@ ieDword GameFeatures2; //the second 32 bits ieResRef ButtonFont; ieResRef CursorBam; + ieResRef ScrollCursorBam; ieResRef GroundCircleBam[MAX_CIRCLE_SIZE]; int GroundCircleScale[MAX_CIRCLE_SIZE]; ieResRef TooltipFont; @@ -312,7 +313,7 @@ Variables * ItemTooltipTable; Sprite2D **Cursors; int CursorCount; - Sprite2D *ArrowSprites[MAX_ORIENT/2]; + //Sprite2D *ArrowSprites[MAX_ORIENT/2]; Sprite2D *FogSprites[32]; Sprite2D **TooltipBack; Sprite2D *WindowFrames[4]; @@ -579,6 +580,8 @@ Sprite2D* GetBAMSprite(const ieResRef ResRef, int cycle, int frame); /** returns a cursor sprite (not cached) */ Sprite2D *GetCursorSprite(); + /** returns a scroll cursor sprite */ + Sprite2D *GetScrollCursorSprite(int frameNum, int spriteNum); /** returns 0 for unmovable, -1 for movable items, otherwise it returns gold value! */ int CanMoveItem(const CREItem *item) const; Modified: gemrb/trunk/gemrb/plugins/Core/Video.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Video.h 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/Core/Video.h 2007-12-07 22:45:55 UTC (rev 4885) @@ -210,6 +210,11 @@ void SetMouseEnabled(int enabled); void SetMouseGrayed(bool grayed); + //Scroll Cursor stuff + virtual int whereIsTheCursor() =0; + virtual void drawScrollCursorSprite(int Position) = 0; + virtual bool isScrolling() = 0; + protected: int DisableMouse; Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2007-12-07 22:45:55 UTC (rev 4885) @@ -323,7 +323,7 @@ MouseMovement(event.motion.x, event.motion.y); break; case SDL_MOUSEBUTTONDOWN: - if (DisableMouse) //grayed mouse is disabled in this sense + if (DisableMouse) //grayed mouse is disabled in this sense break; if (CursorIndex != 2) CursorIndex = 1; @@ -335,7 +335,7 @@ break; case SDL_MOUSEBUTTONUP: - if (DisableMouse) //grayed mouse is disabled in this sense + if (DisableMouse) //grayed mouse is disabled in this sense break; if (CursorIndex != 2) CursorIndex = 0; @@ -1662,7 +1662,7 @@ y -= Viewport.y; x2 -= Viewport.x; } - for ( ; x1 <= x2 ; x1++ ) + for (; x1 <= x2 ; x1++ ) SetPixel( x1, y, color, clipped ); } @@ -1684,7 +1684,7 @@ y2 -= Viewport.y; } - for ( ; y1 <= y2 ; y1++ ) + for (; y1 <= y2 ; y1++ ) SetPixel( x, y1, color, clipped ); } @@ -2250,6 +2250,15 @@ moveY = 0; } } + + if (moveX != 0 || moveY != 0) { + scrolling = true; + CursorPosition = moveX + moveY; + } else if (scrolling) { + scrolling = false; + SetDragCursor(NULL); + } + if (Evnt) Evnt->MouseMove(x, y); } @@ -2401,3 +2410,42 @@ { mousescrollspd=(speed+1)*2; } + +int SDLVideoDriver::whereIsTheCursor() +{ + return CursorPosition; +} + +bool SDLVideoDriver::isScrolling() +{ + return scrolling; +} + +void SDLVideoDriver::drawScrollCursorSprite(int Position) +{ + if (Position == 0) { + if (moveX == -mousescrollspd) {//bottom left + SetDragCursor(core->GetScrollCursorSprite(5,numScrollCursor)); + } else if (moveX == mousescrollspd ) {//upper right + SetDragCursor(core->GetScrollCursorSprite(1,numScrollCursor)); + } + } else if (Position == mousescrollspd) { + if (moveX == mousescrollspd) {//right + SetDragCursor(core->GetScrollCursorSprite(0,numScrollCursor)); + } else { //bottom + SetDragCursor(core->GetScrollCursorSprite(6,numScrollCursor)); + } + } else if (Position == -mousescrollspd ) { + if (moveX == -mousescrollspd) {//left + SetDragCursor(core->GetScrollCursorSprite(4,numScrollCursor)); + } else { //upper + SetDragCursor(core->GetScrollCursorSprite(2,numScrollCursor)); + } + } else if (Position == -2 * mousescrollspd ) { //upper left + SetDragCursor(core->GetScrollCursorSprite(3,numScrollCursor)); + }else if (Position == 2 * mousescrollspd ) { //bottom right + SetDragCursor(core->GetScrollCursorSprite(7,numScrollCursor)); + } + numScrollCursor = (numScrollCursor+1) % 15; +} + Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h 2007-12-07 18:26:03 UTC (rev 4884) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.h 2007-12-07 22:45:55 UTC (rev 4885) @@ -50,6 +50,10 @@ int width,height,bpp; bool fullscreen; int mousescrollspd; + int numScrollCursor; + bool scrolling; + int CursorPosition; + public: SDLVideoDriver(void); ~SDLVideoDriver(void); @@ -157,6 +161,10 @@ unsigned int h, unsigned int dstx, unsigned int dsty, int truecolor, unsigned char *palette, ieDword strRef); int PollMovieEvents(); + void drawScrollCursorSprite(int Position ); + int whereIsTheCursor(); + bool isScrolling(); + private: void DrawMovieSubtitle(ieDword strRef); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-12-16 22:10:12
|
Revision: 4902 http://gemrb.svn.sourceforge.net/gemrb/?rev=4902&view=rev Author: avenger_teambg Date: 2007-12-16 14:10:14 -0800 (Sun, 16 Dec 2007) Log Message: ----------- added zefklop's patch to always turn console background black Modified Paths: -------------- gemrb/trunk/gemrb/GemRB.cpp gemrb/trunk/gemrb/includes/win32def.h Modified: gemrb/trunk/gemrb/GemRB.cpp =================================================================== --- gemrb/trunk/gemrb/GemRB.cpp 2007-12-14 21:56:39 UTC (rev 4901) +++ gemrb/trunk/gemrb/GemRB.cpp 2007-12-16 22:10:14 UTC (rev 4902) @@ -57,5 +57,9 @@ } core->Main(); delete( core ); +#ifndef WIN32 + //reinitialize the console colors. + printf("\033[%sm","0") ; +#endif return 0; } Modified: gemrb/trunk/gemrb/includes/win32def.h =================================================================== --- gemrb/trunk/gemrb/includes/win32def.h 2007-12-14 21:56:39 UTC (rev 4901) +++ gemrb/trunk/gemrb/includes/win32def.h 2007-12-16 22:10:14 UTC (rev 4902) @@ -118,21 +118,21 @@ SetConsoleCursorPosition(hConsole, coord); \ } #else -#define BLACK printf("\033[0m\033[30m"); -#define RED printf("\033[0m\033[31m"); -#define GREEN printf("\033[0m\033[32m"); -#define BROWN printf("\033[0m\033[33m"); -#define BLUE printf("\033[0m\033[34m"); -#define MAGENTA printf("\033[0m\033[35m"); -#define CYAN printf("\033[0m\033[36m"); -#define WHITE printf("\033[0m\033[37m"); -#define LIGHT_RED printf("\033[1m\033[31m"); -#define LIGHT_GREEN printf("\033[1m\033[32m"); -#define YELLOW printf("\033[1m\033[33m"); -#define LIGHT_BLUE printf("\033[1m\033[34m"); -#define LIGHT_MAGENTA printf("\033[1m\033[35m"); -#define LIGHT_CYAN printf("\033[1m\033[36m"); -#define LIGHT_WHITE printf("\033[1m\033[37m"); +#define BLACK printf("\033[0m\033[30;40m"); +#define RED printf("\033[0m\033[31;40m"); +#define GREEN printf("\033[0m\033[32;40m"); +#define BROWN printf("\033[0m\033[33;40m"); +#define BLUE printf("\033[0m\033[34;40m"); +#define MAGENTA printf("\033[0m\033[35;40m"); +#define CYAN printf("\033[0m\033[36;40m"); +#define WHITE printf("\033[0m\033[37;40m"); +#define LIGHT_RED printf("\033[1m\033[31;40m"); +#define LIGHT_GREEN printf("\033[1m\033[32;40m"); +#define YELLOW printf("\033[1m\033[33;40m"); +#define LIGHT_BLUE printf("\033[1m\033[34;40m"); +#define LIGHT_MAGENTA printf("\033[1m\033[35;40m"); +#define LIGHT_CYAN printf("\033[1m\033[36;40m"); +#define LIGHT_WHITE printf("\033[1m\033[37;40m"); #define gotoxy(x,y) printf("\033[%d;%dH", y, x) #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wjp...@us...> - 2007-12-25 01:00:47
|
Revision: 4919 http://gemrb.svn.sourceforge.net/gemrb/?rev=4919&view=rev Author: wjpalenstijn Date: 2007-12-24 16:59:37 -0800 (Mon, 24 Dec 2007) Log Message: ----------- cleanup Modified Paths: -------------- gemrb/trunk/gemrb/includes/RGBAColor.h gemrb/trunk/gemrb/plugins/ACMImporter/readers.h gemrb/trunk/gemrb/plugins/ACMImporter/riffhdr.h gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp gemrb/trunk/gemrb/plugins/BAMImporter/BAMImp.h gemrb/trunk/gemrb/plugins/BIFImporter/BIFImp.h gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/AnimStructures.h gemrb/trunk/gemrb/plugins/Core/Button.h gemrb/trunk/gemrb/plugins/Core/Dialog.h gemrb/trunk/gemrb/plugins/Core/Font.h gemrb/trunk/gemrb/plugins/Core/Game.h gemrb/trunk/gemrb/plugins/Core/GameScript.h gemrb/trunk/gemrb/plugins/Core/IniSpawn.h gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Map.h gemrb/trunk/gemrb/plugins/Core/Particles.h gemrb/trunk/gemrb/plugins/Core/PluginMgr.h gemrb/trunk/gemrb/plugins/Core/Projectile.h gemrb/trunk/gemrb/plugins/Core/Spellbook.h gemrb/trunk/gemrb/plugins/Core/Store.h gemrb/trunk/gemrb/plugins/Core/StringMgr.h gemrb/trunk/gemrb/plugins/Core/WorldMap.h gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.h gemrb/trunk/gemrb/plugins/EFFImporter/EFFImp.cpp gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp gemrb/trunk/gemrb/plugins/IDSImporter/IDSImp.h gemrb/trunk/gemrb/plugins/INIImporter/INIImp.h gemrb/trunk/gemrb/plugins/ITMImporter/ITMImp.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.h gemrb/trunk/gemrb/plugins/MUSImporter/MUSImp.h gemrb/trunk/gemrb/plugins/PROImporter/PROImp.cpp gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.cpp gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.h Modified: gemrb/trunk/gemrb/includes/RGBAColor.h =================================================================== --- gemrb/trunk/gemrb/includes/RGBAColor.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/includes/RGBAColor.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -1,12 +1,12 @@ #ifndef RGBACOLOR_H #define RGBACOLOR_H -typedef struct RevColor { +struct RevColor { unsigned char b,g,r,a; -} RevColor; +}; -typedef struct Color { +struct Color { unsigned char r,g,b,a; -} Color; +}; #endif Modified: gemrb/trunk/gemrb/plugins/ACMImporter/readers.h =================================================================== --- gemrb/trunk/gemrb/plugins/ACMImporter/readers.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/ACMImporter/readers.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -201,7 +201,7 @@ // WAVEFORMATEX structure (from MS SDK) -typedef struct { +struct cWAVEFORMATEX { unsigned short wFormatTag; /* format type */ unsigned short nChannels; /* number of channels (i.e. mono, stereo...) */ unsigned int nSamplesPerSec; /* sample rate */ @@ -210,12 +210,12 @@ unsigned short wBitsPerSample; /* number of bits per sample of mono data */ unsigned short cbSize; /* the count in bytes of the size of */ /* extra information (after cbSize) */ -} cWAVEFORMATEX; +}; -typedef struct { +struct RIFF_CHUNK { unsigned int fourcc; unsigned int length; -} RIFF_CHUNK; +}; const unsigned char RIFF_4cc[] = { 'R', 'I', 'F', 'F' Modified: gemrb/trunk/gemrb/plugins/ACMImporter/riffhdr.h =================================================================== --- gemrb/trunk/gemrb/plugins/ACMImporter/riffhdr.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/ACMImporter/riffhdr.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -24,7 +24,7 @@ #include <stdio.h> -typedef struct { +struct RIFF_HEADER { char riff_sig[4]; unsigned int total_len_m8; char wave_sig[8]; @@ -34,9 +34,9 @@ unsigned short nBlockAlign, wBitsPerSample; char data_sig[4]; unsigned int raw_data_len; -} RIFF_HEADER; +}; -typedef struct { +struct WAVC_HEADER { char wavc_sig[4]; char wavc_ver[4]; int uncompressed; @@ -46,7 +46,7 @@ short bits; short samplespersec; unsigned short unknown; -} WAVC_HEADER; +}; void write_riff_header(void* memory, int samples, int channels, int samplerate); Modified: gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/AREImporter/AREImp.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -50,12 +50,12 @@ {UNINITIALIZED_BYTE}, }; -typedef struct ResRefToStrRef { +struct ResRefToStrRef { ieResRef areaName; ieStrRef text; bool trackFlag; int difficulty; -} ResRefToStrRef; +}; DataFileMgr *INInote = NULL; ResRefToStrRef *tracks = NULL; @@ -64,15 +64,11 @@ //called from ~Interface void AREImp::ReleaseMemory() { - if(INInote) { - core->FreeInterface( INInote ); - INInote = NULL; - } + core->FreeInterface( INInote ); + INInote = NULL; - if (tracks) { - delete [] tracks; - tracks = NULL; - } + delete [] tracks; + tracks = NULL; } void ReadAutonoteINI() @@ -148,8 +144,8 @@ AREImp::~AREImp(void) { - if (autoFree && str) { - delete( str ); + if (autoFree) { + delete str; } Sounds[0][0]=UNINITIALIZED_BYTE; } @@ -159,8 +155,8 @@ if (stream == NULL) { return false; } - if (this->autoFree && str) { - delete( str ); + if (this->autoFree) { + delete str; } str = stream; this->autoFree = autoFree; Modified: gemrb/trunk/gemrb/plugins/BAMImporter/BAMImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/BAMImporter/BAMImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/BAMImporter/BAMImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -26,13 +26,13 @@ #include "../../includes/globals.h" #include "../../includes/RGBAColor.h" -typedef struct FrameEntry { +struct FrameEntry { ieWord Width; ieWord Height; ieWord XPos; ieWord YPos; ieDword FrameData; -} FrameEntry; +}; class Palette; Modified: gemrb/trunk/gemrb/plugins/BIFImporter/BIFImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/BIFImporter/BIFImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/BIFImporter/BIFImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -26,22 +26,22 @@ #include "../Core/ArchiveImporter.h" #include "../Core/CachedFileStream.h" -typedef struct FileEntry { +struct FileEntry { ieDword resLocator; ieDword dataOffset; ieDword fileSize; ieWord type; ieWord u1; //Unknown Field -} FileEntry; +}; -typedef struct TileEntry { +struct TileEntry { ieDword resLocator; ieDword dataOffset; ieDword tilesCount; ieDword tileSize; //named tilesize so it isn't confused ieWord type; ieWord u1; //Unknown Field -} TileEntry; +}; class BIFImp : public ArchiveImporter { private: Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -117,10 +117,10 @@ typedef std::vector< ScriptedAnimation*> vvcVector; typedef std::list<ieResRef*> resourceList; -typedef struct { +struct WeaponInfo { int enchantment; ieDword itemflags; -} WeaponInfo; +}; class GEM_EXPORT Actor : public Movable { public: Modified: gemrb/trunk/gemrb/plugins/Core/AnimStructures.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/AnimStructures.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/AnimStructures.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -21,8 +21,10 @@ #ifndef ANIMSTRUCTURES_H #define ANIMSTRUCTURES_H -typedef struct CycleEntry { + +struct CycleEntry { ieWord FramesCount; ieWord FirstFrame; -} CycleEntry; +}; + #endif Modified: gemrb/trunk/gemrb/plugins/Core/Button.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Button.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Button.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -100,7 +100,7 @@ #endif /** Border/frame settings for a button */ -typedef struct ButtonBorder { +struct ButtonBorder { int dx1; int dy1; int dx2; @@ -108,7 +108,7 @@ Color color; bool filled; bool enabled; -} ButtonBorder; +}; #define MAX_NUM_BORDERS 3 Modified: gemrb/trunk/gemrb/plugins/Core/Dialog.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Dialog.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Dialog.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -46,12 +46,12 @@ #define IE_DLG_SOLVED 0x100 #define IE_DLG_QUEST_GROUP 0x4000 // this is a GemRB extension -typedef struct DialogString { +struct DialogString { char** strings; unsigned int count; -} DialogString; +}; -typedef struct DialogTransition { +struct DialogTransition { ieDword Flags; ieStrRef textStrRef; ieStrRef journalStrRef; @@ -59,15 +59,15 @@ DialogString* action; ieResRef Dialog; ieDword stateIndex; -} DialogTransition; +}; -typedef struct DialogState { +struct DialogState { ieStrRef StrRef; DialogTransition** transitions; unsigned int transitionsCount; DialogString* trigger; unsigned int weight; -} DialogState; +}; class GEM_EXPORT Dialog { public: Modified: gemrb/trunk/gemrb/plugins/Core/Font.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Font.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Font.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -33,7 +33,7 @@ class Palette; -typedef struct StringList { +struct StringList { Sprite2D*** strings; unsigned int* heights; unsigned int* lengths; @@ -41,7 +41,7 @@ int starty; int curx; int cury; -} StringList; +}; #ifdef WIN32 Modified: gemrb/trunk/gemrb/plugins/Core/Game.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Game.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Game.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -110,7 +110,7 @@ * Information about party member. */ -typedef struct PCStruct { +struct PCStruct { ieWord Selected; ieWord PartyOrder; ieDword OffsetToCRE; @@ -134,7 +134,7 @@ ieDword TalkCount; ieByte QSlots[MAX_QSLOTS]; ieByte QuickSpellClass[MAX_QSLOTS]; -} PCStruct; +}; #define IE_GAM_JOURNAL 0 #define IE_GAM_QUEST_UNSOLVED 1 @@ -146,14 +146,14 @@ * Single entry in a journal */ -typedef struct GAMJournalEntry { +struct GAMJournalEntry { ieStrRef Text; ieDword GameTime; // in game time seconds ieByte Chapter; ieByte unknown09; ieByte Section; ieByte Group; // this is a GemRB extension -} GAMJournalEntry; +}; #define MAX_CRLEVEL 32 Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -101,10 +101,10 @@ typedef std::vector<ieDword> SrcVector; -typedef struct targettype { +struct targettype { Scriptable *actor; //hmm, could be door unsigned int distance; -} targettype; +}; typedef std::list<targettype> targetlist; Modified: gemrb/trunk/gemrb/plugins/Core/IniSpawn.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/IniSpawn.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/IniSpawn.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -134,10 +134,10 @@ * Class for the special creature re/spawn features that are unique to PST. */ -typedef struct VariableSpec { +struct VariableSpec { ieVariable Name; ieDword Value; -} VariableSpec; +}; class GEM_EXPORT IniSpawn { public: Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -95,7 +95,7 @@ ieResRef slotresref; } SlotType; -typedef class ItemList { +class ItemList { public: ieResRef *ResRefs; unsigned int Count; @@ -116,7 +116,7 @@ free(ResRefs); } } -} ItemList; +}; #ifdef WIN32 Modified: gemrb/trunk/gemrb/plugins/Core/Map.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Map.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Map.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -99,34 +99,34 @@ //in areas 10 is a magic number for resref counts #define MAX_RESCOUNT 10 -typedef struct SongHeaderType { +struct SongHeaderType { ieDword SongList[MAX_RESCOUNT]; -} SongHeaderType; +}; -typedef struct RestHeaderType { +struct RestHeaderType { ieDword Strref[MAX_RESCOUNT]; ieResRef CreResRef[MAX_RESCOUNT]; ieWord CreatureNum; ieWord DayChance; ieWord NightChance; -} RestHeaderType; +}; -typedef struct Entrance { +struct Entrance { ieVariable Name; Point Pos; ieWord Face; -} Entrance; +}; -typedef class MapNote { +class MapNote { public: Point Pos; ieWord color; char *text; MapNote() { text=NULL; } ~MapNote() { if(text) free(text); } -} MapNote; +}; -typedef class Spawn { +class Spawn { public: ieVariable Name; Point Pos; @@ -140,9 +140,9 @@ Spawn() { Creatures=NULL; } ~Spawn() { if(Creatures) free(Creatures); } unsigned int GetCreatureCount() { return Count; } -} Spawn; +}; -typedef class SpawnGroup { +class SpawnGroup { public: ieResRef *ResRefs; unsigned int Count; @@ -157,7 +157,7 @@ free(ResRefs); } } -} SpawnGroup; +}; class GEM_EXPORT AreaAnimation { public: Modified: gemrb/trunk/gemrb/plugins/Core/Particles.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Particles.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Particles.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -36,10 +36,10 @@ #define P_EMPTY 2 // this structure holds data for a single particle element -typedef struct Element { +struct Element { int state; Point pos; -} Element; +}; /** * @class Particles Modified: gemrb/trunk/gemrb/plugins/Core/PluginMgr.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/PluginMgr.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/PluginMgr.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -57,10 +57,10 @@ * and tries to load them one after another. */ -typedef struct InterfaceElement { +struct InterfaceElement { void *mgr; bool free; -} InterfaceElement; +}; class GEM_EXPORT PluginMgr { public: Modified: gemrb/trunk/gemrb/plugins/Core/Projectile.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Projectile.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Projectile.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -82,7 +82,7 @@ #define PAF_TGT 64 //target party or not party #define PAF_PARTY 128 //target party -typedef struct ProjectileExtension +struct ProjectileExtension { ieDword AFlags; ieWord TriggerRadius; @@ -98,7 +98,7 @@ ieResRef VVCRes; ieWord ConeWidth; //there could be some more unused bytes we don't load -} ProjectileExtension; +}; class GEM_EXPORT Projectile { Modified: gemrb/trunk/gemrb/plugins/Core/Spellbook.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Spellbook.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Spellbook.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -94,18 +94,18 @@ #define NUM_IWD2_SPELLTYPES 11 -typedef struct { +struct CREKnownSpell { ieResRef SpellResRef; ieWord Level; ieWord Type; -} CREKnownSpell; +}; -typedef struct { +struct CREMemorizedSpell { ieResRef SpellResRef; ieDword Flags; -} CREMemorizedSpell; +}; -typedef struct { +struct CRESpellMemorization { ieWord Level; ieWord Number; ieWord Number2; @@ -113,7 +113,7 @@ std::vector<CREKnownSpell*> known_spells; std::vector<CREMemorizedSpell*> memorized_spells; -} CRESpellMemorization; +}; struct SpellExtHeader { ieDword level; Modified: gemrb/trunk/gemrb/plugins/Core/Store.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Store.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/Store.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -72,7 +72,7 @@ * @struct STOItem * Item in a store, together with available amount etc. */ -typedef struct STOItem { +struct STOItem { ieResRef ItemResRef; ieWord PurchasedAmount; ieWord Usages[CHARGE_COUNTERS]; @@ -85,7 +85,7 @@ // V1.1 //ieDword TriggerRef; use infinitesupply char unknown2[56]; -} STOItem; +}; /** @@ -93,12 +93,12 @@ * Kind of drink in a pub, with its associated rumour and price */ -typedef struct STODrink { +struct STODrink { ieResRef RumourResRef; ieStrRef DrinkName; ieDword Price; ieDword Strength; -} STODrink; +}; /** @@ -106,10 +106,10 @@ * Kind of cure available in a temple, with its associated price */ -typedef struct STOCure { +struct STOCure { ieResRef CureResRef; ieDword Price; -} STOCure; +}; /** * @class Store Modified: gemrb/trunk/gemrb/plugins/Core/StringMgr.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/StringMgr.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/StringMgr.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -37,10 +37,10 @@ * Text and its associated sound. */ -typedef struct StringBlock { +struct StringBlock { char* text; ieResRef Sound; -} StringBlock; +}; #ifdef WIN32 Modified: gemrb/trunk/gemrb/plugins/Core/WorldMap.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/WorldMap.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/Core/WorldMap.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -106,14 +106,14 @@ * Defines connection and travelling between WorldMap areas */ -typedef struct WMPAreaLink { +struct WMPAreaLink { ieDword AreaIndex; char DestEntryPoint[32]; ieDword DistanceScale; ieDword DirectionFlags; //where will the player appear on dest. area ieResRef EncounterAreaResRef[5]; ieDword EncounterChance; -} WMPAreaLink; +}; /** * @class WorldMap Modified: gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -26,15 +26,15 @@ #include "../../includes/globals.h" /* -typedef struct State { +struct State { ieStrRef StrRef; ieDword FirstTransitionIndex; ieDword TransitionsCount; ieDword TriggerIndex; -} State; +}; */ /* -typedef struct Transition { +struct Transition { ieDword Flags; ieStrRef AnswerStrRef; ieStrRef JournalStrRef; @@ -42,13 +42,13 @@ ieDword ActionIndex; ieResRef DLGResRef; ieDword NextStateIndex; -} Transition; +}; */ /* -typedef struct VarOffset { +struct VarOffset { ieDword Offset; ieDword Length; -} VarOffset; +}; */ class DLGImp : public DialogMgr { private: Modified: gemrb/trunk/gemrb/plugins/EFFImporter/EFFImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/EFFImporter/EFFImp.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/EFFImporter/EFFImp.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -31,8 +31,8 @@ EFFImp::~EFFImp(void) { - if (str && autoFree) { - delete( str ); + if (autoFree) { + delete str; } } @@ -41,8 +41,8 @@ if (stream == NULL) { return false; } - if (str && this->autoFree) { - delete( str ); + if (this->autoFree) { + delete str; } str = stream; this->autoFree = autoFree; Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -73,17 +73,17 @@ //#define UIT_ALLOW_REPLACE 1 //item is replaceable with another item on this list -typedef struct UsedItemType { +struct UsedItemType { ieResRef itemname; ieVariable username; //death variable ieStrRef value; // int flags; //UIT flags -} UsedItemType; +}; -typedef struct SpellDescType { +struct SpellDescType { ieResRef resref; ieStrRef value; -} SpellDescType; +}; typedef char EventNameType[17]; #define IS_DROP 0 Modified: gemrb/trunk/gemrb/plugins/IDSImporter/IDSImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/IDSImporter/IDSImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/IDSImporter/IDSImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -24,10 +24,10 @@ #include "../Core/SymbolMgr.h" -typedef struct Pair { +struct Pair { int val; char* str; -} Pair; +}; class IDSImp : public SymbolMgr { private: Modified: gemrb/trunk/gemrb/plugins/INIImporter/INIImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/INIImporter/INIImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/INIImporter/INIImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -25,9 +25,9 @@ #include "../Core/DataFileMgr.h" #include "../../includes/globals.h" -typedef struct INIPair { +struct INIPair { char* Name, * Value; -} INIPair; +}; class INITag { private: Modified: gemrb/trunk/gemrb/plugins/ITMImporter/ITMImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/ITMImporter/ITMImp.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/ITMImporter/ITMImp.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -32,8 +32,8 @@ ITMImp::~ITMImp(void) { - if (str && autoFree) { - delete( str ); + if (autoFree) { + delete str; } str = NULL; } @@ -43,8 +43,8 @@ if (stream == NULL) { return false; } - if (str && this->autoFree) { - delete( str ); + if (this->autoFree) { + delete str; } str = stream; this->autoFree = autoFree; Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -379,11 +379,11 @@ //diffmode for gemrb. (Thus scripts can use the very same relation //functions). -typedef struct { +struct IWDIDSEntry { ieDword value; ieWord stat; ieWord relation; -} IWDIDSEntry; +}; static int spellrescnt = -1; static IWDIDSEntry *spellres = NULL; Modified: gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -26,16 +26,16 @@ #include "../Core/ResourceMgr.h" #include "Dictionary.h" -typedef struct RESEntry { +struct RESEntry { ieResRef ResRef; ieWord Type; ieDword ResLocator; -} RESEntry; +}; -typedef struct BIFEntry { +struct BIFEntry { char* name; ieWord BIFLocator; -} BIFEntry; +}; class KeyImp : public ResourceMgr { private: Modified: gemrb/trunk/gemrb/plugins/MUSImporter/MUSImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/MUSImporter/MUSImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/MUSImporter/MUSImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -30,13 +30,13 @@ *@author GemRB Developement Team */ -typedef struct PLString { +struct PLString { char PLFile[10]; char PLLoop[10]; char PLTag[10]; char PLEnd[10]; unsigned int soundID; -} PLString; +}; class MUSImp : public MusicMgr { private: Modified: gemrb/trunk/gemrb/plugins/PROImporter/PROImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/PROImporter/PROImp.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/PROImporter/PROImp.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -32,8 +32,8 @@ PROImp::~PROImp(void) { - if (str && autoFree) { - delete( str ); + if (autoFree) { + delete str; } str = NULL; } @@ -43,8 +43,8 @@ if (stream == NULL) { return false; } - if (str && this->autoFree) { - delete( str ); + if (this->autoFree) { + delete str; } str = stream; this->autoFree = autoFree; Modified: gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.cpp 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.cpp 2007-12-25 00:59:37 UTC (rev 4919) @@ -25,12 +25,12 @@ #include "../Core/Interface.h" #include "../Core/ResourceMgr.h" -typedef struct { +struct wed_polygon { ieDword FirstVertex; ieDword CountVertex; ieWord Flags; ieWord MinX, MaxX, MinY, MaxY; -} wed_polygon; +}; //the net sizeof(wed_polygon) is 0x12 but not all compilers know that #define WED_POLYGON_SIZE 0x12 Modified: gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.h 2007-12-25 00:32:23 UTC (rev 4918) +++ gemrb/trunk/gemrb/plugins/WEDImporter/WEDImp.h 2007-12-25 00:59:37 UTC (rev 4919) @@ -24,14 +24,14 @@ #include "../Core/TileMapMgr.h" -typedef struct Overlay { +struct Overlay { ieWord Width; ieWord Height; ieResRef TilesetResRef; ieDword unknown; ieDword TilemapOffset; ieDword TILOffset; -} Overlay; +}; class WEDImp : public TileMapMgr { private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-12-25 11:01:09
|
Revision: 4920 http://gemrb.svn.sourceforge.net/gemrb/?rev=4920&view=rev Author: avenger_teambg Date: 2007-12-25 03:01:11 -0800 (Tue, 25 Dec 2007) Log Message: ----------- personal space is accounted for in pathfinding Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG15.py gemrb/trunk/gemrb/GUIScripts/bg2/GUICG9.py gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp gemrb/trunk/gemrb/plugins/Core/ActorBlock.h gemrb/trunk/gemrb/plugins/Core/GameControl.cpp gemrb/trunk/gemrb/plugins/Core/Map.cpp gemrb/trunk/gemrb/plugins/Core/Map.h gemrb/trunk/gemrb/plugins/Core/Triggers.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICG15.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG15.py 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICG15.py 2007-12-25 11:01:11 UTC (rev 4920) @@ -50,6 +50,8 @@ Button = GemRB.GetControl(RaceWindow,i+6) GemRB.SetButtonFlags(RaceWindow,Button,IE_GUI_BUTTON_RADIOBUTTON,OP_OR) + GemRB.SetVar("HateRace",0) + BackButton = GemRB.GetControl(RaceWindow,4) GemRB.SetText(RaceWindow,BackButton,15416) DoneButton = GemRB.GetControl(RaceWindow,5) Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICG9.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG9.py 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICG9.py 2007-12-25 11:01:11 UTC (rev 4920) @@ -25,7 +25,7 @@ MaxProf = GemRB.GetTableValue(SkillTable, Pos+8, ProfColumn) #we add the bg1 skill count offset #invalid entry, adjusting scrollbar - if SkillName == 2147483647: + if SkillName == -1: GemRB.SetVar("TopIndex",TopIndex) GemRB.SetVarAssoc(SkillWindow, ScrollBarControl,"TopIndex",Pos-7) break Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-12-25 11:01:11 UTC (rev 4920) @@ -165,6 +165,8 @@ FIRE_GRADIENT,FIRE_GRADIENT,FIRE_GRADIENT, -1,-1,-1, ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT, + -1,-1,-1, + -1,-1,-1 }; static ieResRef hc_overlays[OVERLAY_COUNT]={"SANCTRY","SPENTACI","SPMAGGLO","SPSHIELD", @@ -247,6 +249,7 @@ attackcount = 0; initiative = 0; InTrap = 0; + PathTries = 0; inventory.SetInventoryType(INVENTORY_CREATURE); fxqueue.SetOwner( this ); @@ -1811,6 +1814,7 @@ void Actor::SetPosition(Point &position, int jump, int radius) { + PathTries = 0; ClearPath(); Point p; p.x = position.x/16; @@ -2828,8 +2832,12 @@ void Actor::NewPath() { + PathTries++; Point tmp = Destination; ClearPath(); + if (PathTries>10) { + return; + } Movable::WalkTo(tmp, size ); } @@ -2851,6 +2859,7 @@ void Actor::WalkTo(Point &Des, ieDword flags, int MinDistance) { + PathTries = 0; if (InternalFlags&IF_REALLYDIED) { return; } Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-12-25 11:01:11 UTC (rev 4920) @@ -165,6 +165,7 @@ ieDword ModalState; ieWord globalID; ieWord localID; + int PathTries; //the # of previous tries to pick up a new walkpath public: #define LastTarget LastDisarmFailed //ieDword LastTarget; use lastdisarmfailed Modified: gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/ActorBlock.cpp 2007-12-25 11:01:11 UTC (rev 4920) @@ -233,6 +233,16 @@ */ } +bool Scriptable::IsPC() +{ + if(Type==ST_ACTOR) { + if (((Actor *) this)->InParty) { + return true; + } + } + return false; +} + void Scriptable::ExecuteScript(int scriptCount) { if (core->GetGameControl()->GetScreenFlags()&SF_CUTSCENE) { @@ -254,11 +264,9 @@ for (int i=0;i<scriptCount;i++) { //disable AI script level for actors in party when the player disabled them - if ((i==AI_SCRIPT_LEVEL) && (Type==ST_ACTOR) ) { - if (((Actor *) this)->InParty) { - if (core->GetGame()->ControlStatus&CS_PARTY_AI) { - continue; - } + if ((i==AI_SCRIPT_LEVEL) && IsPC() ) { + if (core->GetGame()->ControlStatus&CS_PARTY_AI) { + continue; } } @@ -1002,7 +1010,7 @@ } Point p(endNode->x, endNode->y); area->BlockSearchMap( Pos, size, 0); - PathNode *path2 = area->FindPath( p, Des ); + PathNode *path2 = area->FindPath( p, Des, size ); endNode->Next=path2; //probably it is wise to connect it both ways? path2->Parent=endNode; @@ -1017,6 +1025,8 @@ if (actor->GetStat(IE_DONOTJUMP)&DNJ_BIRD ) { return; } + //before fixposition, you should remove own shadow + area->BlockSearchMap( Pos, size, 0); Pos.x/=16; Pos.y/=12; GetCurrentArea()->AdjustPosition(Pos); @@ -1027,9 +1037,9 @@ void Movable::WalkTo(Point &Des, int distance) { ClearPath(); + FixPosition(); area->BlockSearchMap( Pos, size, 0); - FixPosition(); - path = area->FindPath( Pos, Des, distance ); + path = area->FindPath( Pos, Des, size, distance ); //ClearPath sets destination, so Destination must be set after it //also we should set Destination only if there is a walkable path if (path) { @@ -1041,7 +1051,7 @@ { ClearPath(); area->BlockSearchMap( Pos, size, 0); - path = area->RunAway( Pos, Des, PathLength, flags ); + path = area->RunAway( Pos, Des, size, PathLength, flags ); } void Movable::RandomWalk(bool can_stop, bool run) @@ -1057,18 +1067,19 @@ if (run) { InternalFlags|=IF_RUNNING; } - area->BlockSearchMap( Pos, size, 0); + //area->BlockSearchMap( Pos, size, 0); Point p = Pos; p.x+=core->Roll(1,50,-25); p.y+=core->Roll(1,50,-25); - path = area->RunAway( Pos, p, 50, 0 ); + path = area->RunAway( Pos, p, size, 50, 0 ); } void Movable::MoveTo(Point &Des) { + area->BlockSearchMap( Pos, size, 0); Pos = Des; Destination = Des; - area->BlockSearchMap( Pos, size, PATH_MAP_PC); + area->BlockSearchMap( Pos, size, IsPC()?PATH_MAP_PC:PATH_MAP_NPC); } void Movable::ClearPath() Modified: gemrb/trunk/gemrb/plugins/Core/ActorBlock.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ActorBlock.h 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/ActorBlock.h 2007-12-25 11:01:11 UTC (rev 4920) @@ -231,6 +231,7 @@ void SetScriptName(const char* text); //call this to enable script running as soon as possible void ImmediateEvent(); + bool IsPC(); void ExecuteScript(int scriptCount); void AddAction(Action* aC); void AddActionInFront(Action* aC); Modified: gemrb/trunk/gemrb/plugins/Core/GameControl.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-12-25 11:01:11 UTC (rev 4920) @@ -703,7 +703,7 @@ nextNode = thisNode->Next; } } - drawPath = core->GetGame()->GetCurrentArea()->FindPath( pfs, p ); + drawPath = core->GetGame()->GetCurrentArea()->FindPath( pfs, p, lastActor?lastActor->size:1 ); break; Modified: gemrb/trunk/gemrb/plugins/Core/Map.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Map.cpp 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/Map.cpp 2007-12-25 11:01:11 UTC (rev 4920) @@ -54,8 +54,8 @@ extern HANDLE hConsole; #endif -static int MAX_CIRCLESIZE = 8; -static int PersonalPerimeter; +static unsigned int MAX_CIRCLESIZE = 8; +static unsigned int PersonalPerimeter; static int MaxVisibility = 30; static int VisibilityPerimeter; //calculated from MaxVisibility static int NormalCost = 10; @@ -86,7 +86,7 @@ } if (PersonalSpaces) { - for (int i=0;i<MAX_CIRCLESIZE;i++) { + for (unsigned int i=0;i<MAX_CIRCLESIZE;i++) { free(PersonalSpaces[i]); } free(PersonalSpaces); @@ -237,7 +237,7 @@ void AddSpace(int destx, int desty, int slot) { - for (int i=0;i<MAX_CIRCLESIZE;i++) { + for (unsigned int i=0;i<MAX_CIRCLESIZE;i++) { int x=(destx*i+MAX_CIRCLESIZE/2)/MAX_CIRCLESIZE*16; int y=(desty*i+MAX_CIRCLESIZE/2)/MAX_CIRCLESIZE*12; PersonalSpaces[i][slot].x=(short) x; @@ -318,9 +318,10 @@ } } + unsigned int j; PersonalSpaces = (Point **) malloc(MAX_CIRCLESIZE * sizeof(Point *) ); - for(i=0;i<MAX_CIRCLESIZE;i++) { - PersonalSpaces[i] = (Point *) malloc(PersonalPerimeter*sizeof(Point) ); + for(j=0;j<MAX_CIRCLESIZE;j++) { + PersonalSpaces[j] = (Point *) malloc(PersonalPerimeter*sizeof(Point) ); } x = MAX_CIRCLESIZE; y = 0; @@ -647,20 +648,20 @@ } if (actor->Modified[IE_DONOTJUMP]<2) { - BlockSearchMap( actor->Pos, actor->size, 0); - if (actor->GetNextStep()) { + BlockSearchMap( actor->Pos, actor->size, 0); + PathNode * step = actor->GetNextStep(); + if (step && step->Next) { //we should actually wait for a short time and check then - PathNode * step = actor->GetNextStep(); - if (!(GetBlocked(step->x,step->y)&PATH_MAP_PASSABLE)) { + if (GetBlocked(step->Next->x*16,step->Next->y*12,actor->size)) { actor->NewPath(); } } } if (!(actor->GetBase(IE_STATE_ID)&STATE_CANTMOVE) ) { if (!actor->Immobile()) { - actor->DoStep( speed ); + actor->DoStep( speed ); + BlockSearchMap( actor->Pos, actor->size, actor->InParty?PATH_MAP_PC:PATH_MAP_NPC); } - BlockSearchMap( actor->Pos, actor->size, actor->InParty?PATH_MAP_PC:PATH_MAP_NPC); } } @@ -1404,6 +1405,25 @@ return ret; } +bool Map::GetBlocked(unsigned int px, unsigned int py, unsigned int size) +{ + if (size>MAX_CIRCLESIZE) { + size=MAX_CIRCLESIZE; + } + int p=PersonalPerimeter; + while (p--) { + for (unsigned int i=0;i<size;i++) { + unsigned int x = (px+PersonalSpaces[i][p].x)/16; + unsigned int y = (py+PersonalSpaces[i][p].y)/12; + + if (!(GetBlocked(x,y)&PATH_MAP_PASSABLE)) { + return true; + } + } + } + return false; +} + int Map::GetBlocked(Point &c) { return GetBlocked(c.x/16, c.y/12); @@ -1731,7 +1751,7 @@ } } -void Map::SetupNode(unsigned int x, unsigned int y, unsigned int Cost) +void Map::SetupNode(unsigned int x, unsigned int y, unsigned int size, unsigned int Cost) { unsigned int pos; @@ -1742,7 +1762,7 @@ if (MapSet[pos]) { return; } - if (!( GetBlocked(x,y) & PATH_MAP_PASSABLE)) { + if (GetBlocked(x*16,y*12,size)) { MapSet[pos] = 65535; return; } @@ -1839,7 +1859,7 @@ } //run away from dX, dY (ie.: find the best path of limited length that brings us the farthest from dX, dY) -PathNode* Map::RunAway(Point &s, Point &d, unsigned int PathLen, int flags) +PathNode* Map::RunAway(Point &s, Point &d, unsigned int size, unsigned int PathLen, int flags) { Point start(s.x/16, s.y/12); Point goal (d.x/16, d.y/12); @@ -1881,16 +1901,16 @@ //printf("Path not found!\n"); break; } - SetupNode( x - 1, y - 1, Cost ); - SetupNode( x + 1, y - 1, Cost ); - SetupNode( x + 1, y + 1, Cost ); - SetupNode( x - 1, y + 1, Cost ); + SetupNode( x - 1, y - 1, size, Cost ); + SetupNode( x + 1, y - 1, size, Cost ); + SetupNode( x + 1, y + 1, size, Cost ); + SetupNode( x - 1, y + 1, size, Cost ); Cost += AdditionalCost; - SetupNode( x, y - 1, Cost ); - SetupNode( x + 1, y, Cost ); - SetupNode( x, y + 1, Cost ); - SetupNode( x - 1, y, Cost ); + SetupNode( x, y - 1, size, Cost ); + SetupNode( x + 1, y, size, Cost ); + SetupNode( x, y + 1, size, Cost ); + SetupNode( x - 1, y, size, Cost ); } //find path backwards from best to start @@ -1938,7 +1958,7 @@ return Return; } -bool Map::TargetUnreachable(Point &s, Point &d) +bool Map::TargetUnreachable(Point &s, Point &d, unsigned int size) { Point start( s.x/16, s.y/12 ); Point goal ( d.x/16, d.y/12 ); @@ -1946,10 +1966,10 @@ while (InternalStack.size()) InternalStack.pop(); - if (!( GetBlocked( goal.x, goal.y ) & PATH_MAP_PASSABLE )) { + if (GetBlocked( d.x, d.y, size )) { return true; } - if (!( GetBlocked( start.x, start.y ) & PATH_MAP_PASSABLE )) { + if (GetBlocked( s.x, s.y, size )) { return true; } @@ -1964,14 +1984,14 @@ unsigned int x = pos >> 16; unsigned int y = pos & 0xffff; - SetupNode( x - 1, y - 1, 1 ); - SetupNode( x + 1, y - 1, 1 ); - SetupNode( x + 1, y + 1, 1 ); - SetupNode( x - 1, y + 1, 1 ); - SetupNode( x, y - 1, 1 ); - SetupNode( x + 1, y, 1 ); - SetupNode( x, y + 1, 1 ); - SetupNode( x - 1, y, 1 ); + SetupNode( x - 1, y - 1, size, 1 ); + SetupNode( x + 1, y - 1, size, 1 ); + SetupNode( x + 1, y + 1, size, 1 ); + SetupNode( x - 1, y + 1, size, 1 ); + SetupNode( x, y - 1, size, 1 ); + SetupNode( x + 1, y, size, 1 ); + SetupNode( x, y + 1, size, 1 ); + SetupNode( x - 1, y, size, 1 ); } return pos!=pos2; } @@ -1991,7 +2011,7 @@ int count = Steps; while(count) { - int st = Steps>MaxVisibility?MaxVisibility:Steps; + unsigned int st = Steps>MaxVisibility?MaxVisibility:Steps; int p = VisibilityPerimeter*Orientation/MAX_ORIENT; dest.x += VisibilityMasks[Steps][p].x; dest.y += VisibilityMasks[Steps][p].y; @@ -2047,7 +2067,7 @@ return Return; } -PathNode* Map::FindPath(const Point &s, const Point &d, int MinDistance) +PathNode* Map::FindPath(const Point &s, const Point &d, unsigned int size, int MinDistance) { Point start( s.x/16, s.y/12 ); Point goal ( d.x/16, d.y/12 ); @@ -2055,7 +2075,7 @@ while (InternalStack.size()) InternalStack.pop(); - if (!( GetBlocked( goal.x, goal.y ) & PATH_MAP_PASSABLE )) { + if (GetBlocked( d.x, d.y, size )) { AdjustPosition( goal ); } unsigned int pos = ( goal.x << 16 ) | goal.y; @@ -2079,16 +2099,16 @@ //printf("Path not found!\n"); break; } - SetupNode( x - 1, y - 1, Cost ); - SetupNode( x + 1, y - 1, Cost ); - SetupNode( x + 1, y + 1, Cost ); - SetupNode( x - 1, y + 1, Cost ); + SetupNode( x - 1, y - 1, size, Cost ); + SetupNode( x + 1, y - 1, size, Cost ); + SetupNode( x + 1, y + 1, size, Cost ); + SetupNode( x - 1, y + 1, size, Cost ); Cost += AdditionalCost; - SetupNode( x, y - 1, Cost ); - SetupNode( x + 1, y, Cost ); - SetupNode( x, y + 1, Cost ); - SetupNode( x - 1, y, Cost ); + SetupNode( x, y - 1, size, Cost ); + SetupNode( x + 1, y, size, Cost ); + SetupNode( x, y + 1, size, Cost ); + SetupNode( x - 1, y, size, Cost ); } //find path from start to goal @@ -2457,14 +2477,14 @@ } //Valid values are - PATH_MAP_FREE, PATH_MAP_PC, PATH_MAP_NPC -void Map::BlockSearchMap(Point &Pos, int size, unsigned int value) +void Map::BlockSearchMap(Point &Pos, unsigned int size, unsigned int value) { if (size>MAX_CIRCLESIZE) { size=MAX_CIRCLESIZE; } int p=PersonalPerimeter; while (p--) { - for (int i=0;i<size;i++) { + for (unsigned int i=0;i<size;i++) { unsigned int x = (Pos.x+PersonalSpaces[i][p].x)/16; unsigned int y = (Pos.y+PersonalSpaces[i][p].y)/12; Modified: gemrb/trunk/gemrb/plugins/Core/Map.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Map.h 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/Map.h 2007-12-25 11:01:11 UTC (rev 4920) @@ -288,6 +288,7 @@ void AddActor(Actor* actor); //returns true if an enemy is near P (used in resting/saving) bool AnyEnemyNearPoint(Point &p); + bool GetBlocked(unsigned int x, unsigned int y, unsigned int size); int GetBlocked(unsigned int x, unsigned int y); int GetBlocked(Point &p); Actor* GetActorByGlobalID(ieDword objectID); @@ -345,24 +346,24 @@ /* explore map from given point in map coordinates */ void ExploreMapChunk(Point &Pos, int range, int los); /* block or unblock searchmap with value */ - void BlockSearchMap(Point &Pos, int size, unsigned int value); + void BlockSearchMap(Point &Pos, unsigned int size, unsigned int value); /* update VisibleBitmap by resolving vision of all explore actors */ void UpdateFog(); //PathFinder /* Finds the nearest passable point */ void AdjustPosition(Point &goal, unsigned int radius=0); /* Finds the path which leads the farthest from d */ - PathNode* RunAway(Point &s, Point &d, unsigned int PathLen, int flags); + PathNode* RunAway(Point &s, Point &d, unsigned int size, unsigned int PathLen, int flags); /* Returns true if there is no path to d */ - bool TargetUnreachable(Point &s, Point &d); + bool TargetUnreachable(Point &s, Point &d, unsigned int size); /* returns true if there is enemy visible */ bool AnyPCSeesEnemy(); /* Finds straight path from s, length l and orientation o, f=1 passes wall, f=2 rebounds from wall*/ PathNode* GetLine(Point &start, Point &dest, int flags); PathNode* GetLine(Point &start, int Steps, int Orientation, int flags); - PathNode* GetLine(Point &start, Point &dest, int Steps, int Orientation, int flags); + PathNode* GetLine(Point &start, Point &dest, int speed, int Orientation, int flags); /* Finds the path which leads to d */ - PathNode* FindPath(const Point &s, const Point &d, int MinDistance = 0); + PathNode* FindPath(const Point &s, const Point &d, unsigned int size, int MinDistance = 0); /* returns false if point isn't visible on visibility/explored map */ bool IsVisible(Point &s, int explored); /* returns false if point d cannot be seen from point d due to searchmap */ @@ -420,7 +421,7 @@ void DeleteActor(int i); void Leveldown(unsigned int px, unsigned int py, unsigned int& level, Point &p, unsigned int& diff); - void SetupNode(unsigned int x, unsigned int y, unsigned int Cost); + void SetupNode(unsigned int x, unsigned int y, unsigned int size, unsigned int Cost); //actor uses travel region void UseExit(Actor *pc, InfoPoint *ip); //separated position adjustment, so their order could be randomised */ Modified: gemrb/trunk/gemrb/plugins/Core/Triggers.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-12-25 00:59:37 UTC (rev 4919) +++ gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-12-25 11:01:11 UTC (rev 4920) @@ -2716,6 +2716,7 @@ return 0; } +//new optional parameter: size of actor (to reach target) int GameScript::TargetUnreachable(Scriptable* Sender, Trigger* parameters) { Scriptable* tar = GetActorFromObject( Sender, parameters->objectParameter ); @@ -2723,7 +2724,20 @@ return 1; //well, if it doesn't exist it is unreachable } Map *map=Sender->GetCurrentArea(); - return map->TargetUnreachable( Sender->Pos, tar->Pos ); + if (!map) { + return 1; + } + unsigned int size = parameters->int0Parameter; + + if (!size) { + if (Sender->Type==ST_ACTOR) { + size = ((Movable *) Sender)->size; + } + else { + size = 1; + } + } + return map->TargetUnreachable( Sender->Pos, tar->Pos, size); } int GameScript::PartyCountEQ(Scriptable* /*Sender*/, Trigger* parameters) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2007-12-25 23:03:39
|
Revision: 4924 http://gemrb.svn.sourceforge.net/gemrb/?rev=4924&view=rev Author: lynxlupodian Date: 2007-12-25 15:03:42 -0800 (Tue, 25 Dec 2007) Log Message: ----------- reset the color at the end of PrintMessage: now the python output won't be arbitrarily colored anymore Also added some coloring around a call to PrintAction to maintain previous state Modified Paths: -------------- gemrb/trunk/gemrb/includes/win32def.h gemrb/trunk/gemrb/plugins/Core/GameScript.cpp Modified: gemrb/trunk/gemrb/includes/win32def.h =================================================================== --- gemrb/trunk/gemrb/includes/win32def.h 2007-12-25 22:27:24 UTC (rev 4923) +++ gemrb/trunk/gemrb/includes/win32def.h 2007-12-25 23:03:42 UTC (rev 4924) @@ -138,7 +138,7 @@ #define printBracket(status, color) textcolor(WHITE); printf("["); textcolor(color); printf("%s", status); textcolor(WHITE); printf("]") #define printStatus(status, color) printBracket(status, color); printf("\n") -#define printMessage(owner, message, color) printBracket(owner, LIGHT_WHITE); printf(": "); textcolor(color); printf("%s", message) +#define printMessage(owner, message, color) printBracket(owner, LIGHT_WHITE); printf(": "); textcolor(color); printf("%s", message); textcolor(WHITE) #endif Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-12-25 22:27:24 UTC (rev 4923) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-12-25 23:03:42 UTC (rev 4924) @@ -3029,8 +3029,10 @@ } else { actions[actionID] = NoActionAtAll; printMessage("GameScript", "Unknown ", YELLOW); + textcolor(YELLOW); PrintAction(actionID); Sender->ReleaseCurrentAction(); + textcolor(WHITE); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-01-05 22:36:33
|
Revision: 4971 http://gemrb.svn.sourceforge.net/gemrb/?rev=4971&view=rev Author: lynxlupodian Date: 2008-01-05 14:36:16 -0800 (Sat, 05 Jan 2008) Log Message: ----------- read the tooltip delay from the gemrb config too fixed typo in comment Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Projectile.cpp gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2008-01-05 22:36:16 UTC (rev 4971) @@ -111,13 +111,12 @@ def MarkMenuButton (WindowIndex): Pressed = GemRB.GetVar ("SelectedWindow") - + print "Pressed:", Pressed for button in range (9): Button = GemRB.GetControl (WindowIndex, button) GemRB.SetButtonState (WindowIndex, Button, IE_GUI_BUTTON_ENABLED) - if Pressed: # don't draw the selection when returning to the game - GemRB.SetButtonState (WindowIndex, Pressed, IE_GUI_BUTTON_SELECTED) + GemRB.SetButtonState (WindowIndex, Pressed, IE_GUI_BUTTON_SELECTED) def AIPress (): Button = GemRB.GetControl (PortraitWindow, 6) @@ -442,6 +441,7 @@ ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) Kit = GemRB.GetPlayerStat (actor, IE_KIT) KitIndex = 0 + print "KI0", Kit if Kit&0xc000ffff == 0x40000000: KitIndex = Kit>>16 & 0xfff Class = GemRB.GetPlayerStat (actor, IE_CLASS) @@ -449,14 +449,19 @@ Class = GemRB.FindTableValue ( ClassTable, 5, Class ) KitTable = GemRB.LoadTable ("kitlist") + print "KI", KitIndex + #looking for kit by the usability flag if KitIndex == 0: KitIndex = GemRB.FindTableValue (KitTable, Kit, 6) + print "KI2", KitIndex if KitIndex == -1: KitIndex = 0 elif Class != GemRB.GetTableValue (KitTable, KitIndex, 5): KitIndex = 0 + print "KI3", KitIndex + print "ClassTitle", ClassTitle if ClassTitle == 0: if KitIndex == 0: ClassTitle=GemRB.GetTableValue (ClassTable, Class, 2) @@ -465,6 +470,7 @@ if ClassTitle == "*": return 0 + print "finalClassTitle", ClassTitle return ClassTitle def GetActorPaperDoll (actor): Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2008-01-05 22:36:16 UTC (rev 4971) @@ -276,7 +276,9 @@ OptDone ('GameplayOptions', Window, 7) OptCancel ('GameplayOptions', Window, 20) - OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 10) + print "opengameplay:1TooltipDelay: ", GemRB.GetVar ("Tooltips") + OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 250) + print "opengameplay:2TooltipDelay: ", GemRB.GetVar ("Tooltips") OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5) OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5) OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0) @@ -296,6 +298,7 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18017) + print "DisplayHelpTooltipDelay: ", GemRB.GetVar ("Tooltips") GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py 2008-01-05 22:36:16 UTC (rev 4971) @@ -44,15 +44,15 @@ if ContinueWindow == None: return - hideflag = GemRB.HideGUI () + #hideflag = GemRB.HideGUI () GemRB.UnloadWindow (ContinueWindow) GemRB.SetVar ("ActionsWindow", OldActionsWindow) GemRB.SetVar ("DialogChoose", GemRB.GetVar ("DialogOption")) ContinueWindow = None OldActionsWindow = None - if hideflag: - GemRB.UnhideGUI () + #if hideflag: + ##GemRB.UnhideGUI () def OpenEndMessageWindow (): Modified: gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py 2008-01-05 22:36:16 UTC (rev 4971) @@ -40,6 +40,8 @@ FileName = GemRB.QueryText(ImportWindow, TextAreaControl) Slot = GemRB.GetVar("Slot") GemRB.CreatePlayer(FileName, Slot| 0x8000, 1) +#A new character will need additional SetPlayerStat() and FillPlayerInfo() +#calls to be a working character GemRB.UnloadWindow(ImportWindow) GemRB.SetNextScript("CharGen7") return Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2008-01-05 22:36:16 UTC (rev 4971) @@ -1383,7 +1383,7 @@ abort(); } if (!res) { - printf("Freeing script %s because its refcount has reached 0.\n", Name); + //printf("Freeing script %s because its refcount has reached 0.\n", Name); script->Release(); } script = NULL; Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-05 22:36:16 UTC (rev 4971) @@ -1948,7 +1948,7 @@ } char name[65], value[_MAX_PATH + 3]; - //one GemRB own format is working well, this might be set to 0 + //once GemRB own format is working well, this might be set to 0 SaveAsOriginal = 1; while (!feof( config )) { @@ -1968,6 +1968,8 @@ Bpp = atoi( value ); } else if (stricmp( name, "FullScreen" ) == 0) { FullScreen = ( atoi( value ) == 0 ) ? false : true; + } else if (stricmp( name, "TooltipDelay" ) == 0) { + TooltipDelay = atoi( value ); } else if (stricmp( name, "SkipIntroVideos" ) == 0) { SkipIntroVideos = ( atoi( value ) == 0 ) ? false : true; } else if (stricmp( name, "DrawFPS" ) == 0) { Modified: gemrb/trunk/gemrb/plugins/Core/Projectile.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Projectile.cpp 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/plugins/Core/Projectile.cpp 2008-01-05 22:36:16 UTC (rev 4971) @@ -99,6 +99,11 @@ void Projectile::CreateAnimations(Animation **anims, const ieResRef bamres, int Seq) { + if (!bamres) { + printMessage( "Core", "Projectile BAM resref is null!\n", LIGHT_RED ); + return; + } + AnimationFactory* af = ( AnimationFactory* ) core->GetResourceMgr()->GetFactoryResource( bamres, IE_BAM_CLASS_ID, IE_NORMAL ); Modified: gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp 2008-01-05 22:36:16 UTC (rev 4971) @@ -431,6 +431,10 @@ ieDword ScriptedAnimation::GetSequenceDuration(ieDword multiplier) { //P_HOLD * MAX_ORIENT == MAX_ORIENT +int a=P_HOLD; +int b=MAX_ORIENT; +int c=sizeof anims / sizeof anims[0]; +int d=a+b+c; d=0; return anims[P_HOLD*MAX_ORIENT]->GetFrameCount()*multiplier/FrameRate; } Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2008-01-05 22:36:16 UTC (rev 4971) @@ -3093,6 +3093,8 @@ strnuprcpy(monster,fx->Resource,8); strnuprcpy(hit,fx->Resource2,8); strnuprcpy(areahit,fx->Resource3,8); +//areahit = 0 +printf("AREAHIT: %s",areahit); } else { core->GetResRefFrom2DA(monster_summoning_2da[fx->Parameter2], monster, hit, areahit); } Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2008-01-02 17:21:38 UTC (rev 4970) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2008-01-05 22:36:16 UTC (rev 4971) @@ -395,7 +395,7 @@ //handle tooltips unsigned int delay = core->TooltipDelay; - if (!ConsolePopped && (delay<100) ) { + if (!ConsolePopped && (delay<2500) ) { GetTime( time ); /** Display tooltip if mouse is idle */ if (( time - lastMouseTime ) > delay) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-01-05 22:39:46
|
Revision: 4972 http://gemrb.svn.sourceforge.net/gemrb/?rev=4972&view=rev Author: lynxlupodian Date: 2008-01-05 14:39:26 -0800 (Sat, 05 Jan 2008) Log Message: ----------- revert previous bad commit Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Projectile.cpp gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2008-01-05 22:39:26 UTC (rev 4972) @@ -111,12 +111,13 @@ def MarkMenuButton (WindowIndex): Pressed = GemRB.GetVar ("SelectedWindow") - print "Pressed:", Pressed + for button in range (9): Button = GemRB.GetControl (WindowIndex, button) GemRB.SetButtonState (WindowIndex, Button, IE_GUI_BUTTON_ENABLED) - GemRB.SetButtonState (WindowIndex, Pressed, IE_GUI_BUTTON_SELECTED) + if Pressed: # don't draw the selection when returning to the game + GemRB.SetButtonState (WindowIndex, Pressed, IE_GUI_BUTTON_SELECTED) def AIPress (): Button = GemRB.GetControl (PortraitWindow, 6) @@ -441,7 +442,6 @@ ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) Kit = GemRB.GetPlayerStat (actor, IE_KIT) KitIndex = 0 - print "KI0", Kit if Kit&0xc000ffff == 0x40000000: KitIndex = Kit>>16 & 0xfff Class = GemRB.GetPlayerStat (actor, IE_CLASS) @@ -449,19 +449,14 @@ Class = GemRB.FindTableValue ( ClassTable, 5, Class ) KitTable = GemRB.LoadTable ("kitlist") - print "KI", KitIndex - #looking for kit by the usability flag if KitIndex == 0: KitIndex = GemRB.FindTableValue (KitTable, Kit, 6) - print "KI2", KitIndex if KitIndex == -1: KitIndex = 0 elif Class != GemRB.GetTableValue (KitTable, KitIndex, 5): KitIndex = 0 - print "KI3", KitIndex - print "ClassTitle", ClassTitle if ClassTitle == 0: if KitIndex == 0: ClassTitle=GemRB.GetTableValue (ClassTable, Class, 2) @@ -470,7 +465,6 @@ if ClassTitle == "*": return 0 - print "finalClassTitle", ClassTitle return ClassTitle def GetActorPaperDoll (actor): Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2008-01-05 22:39:26 UTC (rev 4972) @@ -276,9 +276,7 @@ OptDone ('GameplayOptions', Window, 7) OptCancel ('GameplayOptions', Window, 20) - print "opengameplay:1TooltipDelay: ", GemRB.GetVar ("Tooltips") - OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 250) - print "opengameplay:2TooltipDelay: ", GemRB.GetVar ("Tooltips") + OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 10) OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5) OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5) OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0) @@ -298,7 +296,6 @@ def DisplayHelpTooltipDelay (): GemRB.SetText (GameOptionsWindow, HelpTextArea, 18017) - print "DisplayHelpTooltipDelay: ", GemRB.GetVar ("Tooltips") GemRB.SetTooltipDelay (GemRB.GetVar ("Tooltips") ) def DisplayHelpMouseScrollingSpeed (): Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIWORLD.py 2008-01-05 22:39:26 UTC (rev 4972) @@ -44,15 +44,15 @@ if ContinueWindow == None: return - #hideflag = GemRB.HideGUI () + hideflag = GemRB.HideGUI () GemRB.UnloadWindow (ContinueWindow) GemRB.SetVar ("ActionsWindow", OldActionsWindow) GemRB.SetVar ("DialogChoose", GemRB.GetVar ("DialogOption")) ContinueWindow = None OldActionsWindow = None - #if hideflag: - ##GemRB.UnhideGUI () + if hideflag: + GemRB.UnhideGUI () def OpenEndMessageWindow (): Modified: gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/GUIScripts/tob/ImportFile.py 2008-01-05 22:39:26 UTC (rev 4972) @@ -40,8 +40,6 @@ FileName = GemRB.QueryText(ImportWindow, TextAreaControl) Slot = GemRB.GetVar("Slot") GemRB.CreatePlayer(FileName, Slot| 0x8000, 1) -#A new character will need additional SetPlayerStat() and FillPlayerInfo() -#calls to be a working character GemRB.UnloadWindow(ImportWindow) GemRB.SetNextScript("CharGen7") return Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2008-01-05 22:39:26 UTC (rev 4972) @@ -1383,7 +1383,7 @@ abort(); } if (!res) { - //printf("Freeing script %s because its refcount has reached 0.\n", Name); + printf("Freeing script %s because its refcount has reached 0.\n", Name); script->Release(); } script = NULL; Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-05 22:39:26 UTC (rev 4972) @@ -1948,7 +1948,7 @@ } char name[65], value[_MAX_PATH + 3]; - //once GemRB own format is working well, this might be set to 0 + //one GemRB own format is working well, this might be set to 0 SaveAsOriginal = 1; while (!feof( config )) { @@ -1968,8 +1968,6 @@ Bpp = atoi( value ); } else if (stricmp( name, "FullScreen" ) == 0) { FullScreen = ( atoi( value ) == 0 ) ? false : true; - } else if (stricmp( name, "TooltipDelay" ) == 0) { - TooltipDelay = atoi( value ); } else if (stricmp( name, "SkipIntroVideos" ) == 0) { SkipIntroVideos = ( atoi( value ) == 0 ) ? false : true; } else if (stricmp( name, "DrawFPS" ) == 0) { Modified: gemrb/trunk/gemrb/plugins/Core/Projectile.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Projectile.cpp 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/plugins/Core/Projectile.cpp 2008-01-05 22:39:26 UTC (rev 4972) @@ -99,11 +99,6 @@ void Projectile::CreateAnimations(Animation **anims, const ieResRef bamres, int Seq) { - if (!bamres) { - printMessage( "Core", "Projectile BAM resref is null!\n", LIGHT_RED ); - return; - } - AnimationFactory* af = ( AnimationFactory* ) core->GetResourceMgr()->GetFactoryResource( bamres, IE_BAM_CLASS_ID, IE_NORMAL ); Modified: gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/plugins/Core/ScriptedAnimation.cpp 2008-01-05 22:39:26 UTC (rev 4972) @@ -431,10 +431,6 @@ ieDword ScriptedAnimation::GetSequenceDuration(ieDword multiplier) { //P_HOLD * MAX_ORIENT == MAX_ORIENT -int a=P_HOLD; -int b=MAX_ORIENT; -int c=sizeof anims / sizeof anims[0]; -int d=a+b+c; d=0; return anims[P_HOLD*MAX_ORIENT]->GetFrameCount()*multiplier/FrameRate; } Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2008-01-05 22:39:26 UTC (rev 4972) @@ -3093,8 +3093,6 @@ strnuprcpy(monster,fx->Resource,8); strnuprcpy(hit,fx->Resource2,8); strnuprcpy(areahit,fx->Resource3,8); -//areahit = 0 -printf("AREAHIT: %s",areahit); } else { core->GetResRefFrom2DA(monster_summoning_2da[fx->Parameter2], monster, hit, areahit); } Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2008-01-05 22:36:16 UTC (rev 4971) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2008-01-05 22:39:26 UTC (rev 4972) @@ -395,7 +395,7 @@ //handle tooltips unsigned int delay = core->TooltipDelay; - if (!ConsolePopped && (delay<2500) ) { + if (!ConsolePopped && (delay<100) ) { GetTime( time ); /** Display tooltip if mouse is idle */ if (( time - lastMouseTime ) > delay) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-01-06 11:31:21
|
Revision: 4974 http://gemrb.svn.sourceforge.net/gemrb/?rev=4974&view=rev Author: lynxlupodian Date: 2008-01-06 03:31:25 -0800 (Sun, 06 Jan 2008) Log Message: ----------- fixed and cleaned up tooltip display: * the renderer had a too low limit check of 100ms (the last slider position disables tooltips) changed it to be more realistic and better matching bg2 * use a predefined constant in guiscripts and videodriver * added some warnings to make sure that these two are in sync todo: ie stores the slider position*10, not the actual delay todo: games that are not bg2 or tob force immediate tooltip display Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/GUIDefines.py gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py gemrb/trunk/gemrb/plugins/Core/Video.h gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp Modified: gemrb/trunk/gemrb/GUIScripts/GUIDefines.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/GUIDefines.py 2008-01-05 22:42:31 UTC (rev 4973) +++ gemrb/trunk/gemrb/GUIScripts/GUIDefines.py 2008-01-06 11:31:25 UTC (rev 4974) @@ -239,6 +239,9 @@ #game constants PARTY_SIZE = 6 +# !!! Keep this synchronized with Video.h !!! +TOOLTIP_DELAY_FACTOR = 250 + #game strings STR_LOADMOS = 0 Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py 2008-01-05 22:42:31 UTC (rev 4973) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUIOPT.py 2008-01-06 11:31:25 UTC (rev 4974) @@ -275,7 +275,7 @@ OptDone ('GameplayOptions', Window, 7) OptCancel ('GameplayOptions', Window, 20) - OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 10) + OptSlider ('TooltipDelay', Window, 1, 'Tooltips', TOOLTIP_DELAY_FACTOR) OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5) OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5) OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2008-01-05 22:42:31 UTC (rev 4973) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIOPT.py 2008-01-06 11:31:25 UTC (rev 4974) @@ -276,7 +276,7 @@ OptDone ('GameplayOptions', Window, 7) OptCancel ('GameplayOptions', Window, 20) - OptSlider ('TooltipDelay', Window, 1, 'Tooltips', 10) + OptSlider ('TooltipDelay', Window, 1, 'Tooltips', TOOLTIP_DELAY_FACTOR) OptSlider ('MouseScrollingSpeed', Window, 2, 'Mouse Scroll Speed', 5) OptSlider ('KeyboardScrollingSpeed', Window, 3, 'Keyboard Scroll Speed', 5) OptSlider ('Difficulty', Window, 12, 'Difficulty Level', 0) Modified: gemrb/trunk/gemrb/plugins/Core/Video.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Video.h 2008-01-05 22:42:31 UTC (rev 4973) +++ gemrb/trunk/gemrb/plugins/Core/Video.h 2008-01-06 11:31:25 UTC (rev 4974) @@ -72,6 +72,10 @@ #define MOUSE_DISABLED 1 #define MOUSE_GRAYED 2 +// !!! Keep this synchronized with GUIDefines.py !!! +// used for calculating the tooltip delay limit and the real tooltip delay +#define TOOLTIP_DELAY_FACTOR 250 + /** * @class Video * Base class for video output plugins. Modified: gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2008-01-05 22:42:31 UTC (rev 4973) +++ gemrb/trunk/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp 2008-01-06 11:31:25 UTC (rev 4974) @@ -395,7 +395,8 @@ //handle tooltips unsigned int delay = core->TooltipDelay; - if (!ConsolePopped && (delay<100) ) { + // The multiplication by 10 is there since the last, disabling slider position is the eleventh + if (!ConsolePopped && (delay<TOOLTIP_DELAY_FACTOR*10) ) { GetTime( time ); /** Display tooltip if mouse is idle */ if (( time - lastMouseTime ) > delay) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-01-27 14:53:13
|
Revision: 5007 http://gemrb.svn.sourceforge.net/gemrb/?rev=5007&view=rev Author: lynxlupodian Date: 2008-01-27 06:53:16 -0800 (Sun, 27 Jan 2008) Log Message: ----------- added GemRBOverridePath, so installing the overrides elsewhere than GemRBPath will work. It defaults to the previous search location - GemRBPath Modified Paths: -------------- gemrb/trunk/gemrb/GemRB.cfg.sample gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.cpp Modified: gemrb/trunk/gemrb/GemRB.cfg.sample =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg.sample 2008-01-26 20:59:38 UTC (rev 5006) +++ gemrb/trunk/gemrb/GemRB.cfg.sample 2008-01-27 14:53:16 UTC (rev 5007) @@ -224,5 +224,16 @@ #GameOverridePath=override ##################################################### +# GemRB Data Override Path [String] # +# # +# This is the path where GemRB looks for the GemRB # +# data override directory. # +# # +# You probably do NOT want to specify this! # +##################################################### + +#GemRBOverridePath=/usr/share/games/gemrb + +##################################################### # END # ##################################################### Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-26 20:59:38 UTC (rev 5006) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-27 14:53:16 UTC (rev 5007) @@ -170,6 +170,7 @@ GemRBPath[0] = 0; PluginsPath[0] = 0; CachePath[0] = 0; + GemRBOverride[0] = 0; GameName[0] = 0; strncpy( GameOverride, "override", sizeof(GameOverride) ); strncpy( GameSounds, "sounds", sizeof(GameSounds) ); @@ -2003,6 +2004,8 @@ strncpy( GameData, value, sizeof(GameData) ); } else if (stricmp( name, "GameOverridePath" ) == 0) { strncpy( GameOverride, value, sizeof(GameOverride) ); + } else if (stricmp( name, "GemRBOverridePath" ) == 0) { + strncpy( GemRBOverride, value, sizeof(GemRBOverride) ); } else if (stricmp( name, "GameScriptsPath" ) == 0) { strncpy( GameScripts, value, sizeof(GameScripts) ); } else if (stricmp( name, "GameSoundsPath" ) == 0) { @@ -2068,6 +2071,10 @@ } #endif + if (!GemRBOverride[0]) { + strcpy( GemRBOverride, GemRBPath ); + } + if (!PluginsPath[0]) { #ifdef PLUGINDIR strcpy( PluginsPath, PLUGINDIR ); @@ -2097,6 +2104,7 @@ FixPath( GUIScriptsPath, true ); FixPath( PluginsPath, true ); FixPath( GemRBPath, true ); + FixPath( GemRBOverride, true ); FixPath( SavePath, false ); mkdir( SavePath, S_IREAD|S_IWRITE|S_IEXEC ); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2008-01-26 20:59:38 UTC (rev 5006) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2008-01-27 14:53:16 UTC (rev 5007) @@ -663,6 +663,7 @@ char GameScripts[_MAX_PATH]; char GamePortraits[_MAX_PATH]; char GameCharacters[_MAX_PATH]; + char GemRBOverride[_MAX_PATH]; ieResRef GameNameResRef; ieResRef GoldResRef; //MISC07.itm Variables *RtRows; Modified: gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.cpp 2008-01-26 20:59:38 UTC (rev 5006) +++ gemrb/trunk/gemrb/plugins/KEYImporter/KeyImp.cpp 2008-01-27 14:53:16 UTC (rev 5007) @@ -216,7 +216,7 @@ //Search it in the GemRB override Directory PathJoin( path, "override", core->GameType, NULL ); //this shouldn't change if (FindIn( core->CachePath, "", resname, type)) return true; - if (FindIn( core->GemRBPath, path, resname, type)) return true; + if (FindIn( core->GemRBOverride, path, resname, type)) return true; if (FindIn( core->GamePath, core->GameOverride, resname, type)) return true; if (FindIn( core->GamePath, core->GameSounds, resname, type)) return true; if (FindIn( core->GamePath, core->GameScripts, resname, type)) return true; @@ -250,7 +250,7 @@ "Found in Cache" ); if (fs) return fs; - fs=SearchIn( core->GemRBPath, path, resname, type, + fs=SearchIn( core->GemRBOverride, path, resname, type, "Found in GemRB Override" ); if (fs) return fs; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-01-28 13:07:49
|
Revision: 5015 http://gemrb.svn.sourceforge.net/gemrb/?rev=5015&view=rev Author: lynxlupodian Date: 2008-01-28 05:07:17 -0800 (Mon, 28 Jan 2008) Log Message: ----------- run FixPath over GamePath, the last variable that needed it. All other either already have it or don't care (Game*, CD*). Removed comment from the samples. Modified Paths: -------------- gemrb/trunk/gemrb/GemRB.cfg.sample gemrb/trunk/gemrb/GemRB.cfg.subdir.sample gemrb/trunk/gemrb/plugins/Core/Interface.cpp Modified: gemrb/trunk/gemrb/GemRB.cfg.sample =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg.sample 2008-01-28 11:18:03 UTC (rev 5014) +++ gemrb/trunk/gemrb/GemRB.cfg.sample 2008-01-28 13:07:17 UTC (rev 5015) @@ -121,12 +121,6 @@ ##################################################### # Paths # ##################################################### -# # -# Note: You have to terminate all paths with the # -# path separator character ('\' for Windows users, # -# '/' for Linux users) # -# # -##################################################### ##################################################### # Game Paths [String] # Modified: gemrb/trunk/gemrb/GemRB.cfg.subdir.sample =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg.subdir.sample 2008-01-28 11:18:03 UTC (rev 5014) +++ gemrb/trunk/gemrb/GemRB.cfg.subdir.sample 2008-01-28 13:07:17 UTC (rev 5015) @@ -121,12 +121,6 @@ ##################################################### # Paths # ##################################################### -# # -# Note: You have to terminate all paths with the # -# path separator character ('\' for Windows users, # -# '/' for Linux users) # -# # -##################################################### ##################################################### # Game Paths [String] # Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-28 11:18:03 UTC (rev 5014) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2008-01-28 13:07:17 UTC (rev 5015) @@ -2106,6 +2106,10 @@ FixPath( GemRBPath, true ); FixPath( GemRBOverride, true ); + if (GamePath[0]) { + FixPath( GamePath, true ); + } + FixPath( SavePath, false ); mkdir( SavePath, S_IREAD|S_IWRITE|S_IEXEC ); chmod( SavePath, S_IREAD|S_IWRITE|S_IEXEC ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-01-28 17:16:50
|
Revision: 5019 http://gemrb.svn.sourceforge.net/gemrb/?rev=5019&view=rev Author: lynxlupodian Date: 2008-01-28 09:16:46 -0800 (Mon, 28 Jan 2008) Log Message: ----------- also install the subdir config example Modified Paths: -------------- gemrb/trunk/gemrb/CMakeLists.txt gemrb/trunk/gemrb/Makefile.am Modified: gemrb/trunk/gemrb/CMakeLists.txt =================================================================== --- gemrb/trunk/gemrb/CMakeLists.txt 2008-01-28 17:01:31 UTC (rev 5018) +++ gemrb/trunk/gemrb/CMakeLists.txt 2008-01-28 17:16:46 UTC (rev 5019) @@ -7,4 +7,4 @@ TARGET_LINK_LIBRARIES(gemrb gemrb_core ) INSTALL( TARGETS gemrb DESTINATION ${CMAKE_INSTALL_PREFIX} ) -INSTALL( FILES GemRB.cfg.sample DESTINATION ${CMAKE_INSTALL_PREFIX} ) \ No newline at end of file +INSTALL( FILES GemRB.cfg.sample GemRB.cfg.subdir.sample DESTINATION ${CMAKE_INSTALL_PREFIX} ) Modified: gemrb/trunk/gemrb/Makefile.am =================================================================== --- gemrb/trunk/gemrb/Makefile.am 2008-01-28 17:01:31 UTC (rev 5018) +++ gemrb/trunk/gemrb/Makefile.am 2008-01-28 17:16:46 UTC (rev 5019) @@ -1,5 +1,5 @@ bin_PROGRAMS = gemrb -sysconf_DATA = GemRB.cfg.sample +sysconf_DATA = GemRB.cfg.sample GemRB.cfg.subdir.sample gemrb_SOURCES = GemRB.cpp gemrb_LDADD = ./plugins/Core/libgemrb_core.la This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-02-01 16:42:11
|
Revision: 5027 http://gemrb.svn.sourceforge.net/gemrb/?rev=5027&view=rev Author: lynxlupodian Date: 2008-02-01 08:42:06 -0800 (Fri, 01 Feb 2008) Log Message: ----------- merged dual class display support to bg2 and removed a stray space Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/bg2/GUIREC.py gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/override/bg2/classes.2da Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2008-02-01 15:55:47 UTC (rev 5026) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2008-02-01 16:42:06 UTC (rev 5027) @@ -100,7 +100,7 @@ if Gears: # Gears (time) Button = GemRB.GetControl (Window, 9) - GemRB.SetAnimation (Window, Button, "CGEAR") + GemRB.SetAnimation (Window, Button, "CPEN") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED, OP_SET) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) rb = 11 @@ -203,7 +203,7 @@ ActionsWindow = Window # Gears (time) when options pane is down Button = GemRB.GetControl (Window, 62) - GemRB.SetAnimation (Window, Button, "CGEAR") + GemRB.SetAnimation (Window, Button, "CPEN") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED, OP_SET) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) UpdateActionsWindow () @@ -429,25 +429,38 @@ UpdateActionsWindow () return -def GetActorClassTitle (actor): - ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) +def GetKitIndex (actor): + Class = GemRB.GetPlayerStat (actor, IE_CLASS) + KitTable = GemRB.LoadTable ("kitlist") Kit = GemRB.GetPlayerStat (actor, IE_KIT) KitIndex = 0 + if Kit&0xc000ffff == 0x40000000: + print "Kit value: 0x%04X"%Kit KitIndex = Kit>>16 & 0xfff - Class = GemRB.GetPlayerStat (actor, IE_CLASS) - ClassTable = GemRB.LoadTable ("classes") - Class = GemRB.FindTableValue ( ClassTable, 5, Class ) - KitTable = GemRB.LoadTable ("kitlist") #looking for kit by the usability flag if KitIndex == 0: KitIndex = GemRB.FindTableValue (KitTable, 6, Kit) if KitIndex == -1: KitIndex = 0 - elif Class != GemRB.GetTableValue (KitTable, KitIndex, 5): +# not sure if this check is needed, even the odd barbarian which is mentioned in +# the kitlist with the fighter class id, has the matching id in classes.2da + elif Class != GemRB.GetTableValue (KitTable, KitIndex, 7): + print "KitIndex before hack", KitIndex KitIndex = 0 + return KitIndex + +def GetActorClassTitle (actor): + ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) + + Class = GemRB.GetPlayerStat (actor, IE_CLASS) + ClassTable = GemRB.LoadTable ("classes") + Class = GemRB.FindTableValue ( ClassTable, 5, Class ) + KitTable = GemRB.LoadTable ("kitlist") + KitIndex = GetKitIndex (actor) + if ClassTitle == 0: if KitIndex == 0: ClassTitle=GemRB.GetTableValue (ClassTable, Class, 2) Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUIREC.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUIREC.py 2008-02-01 15:55:47 UTC (rev 5026) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUIREC.py 2008-02-01 16:42:06 UTC (rev 5027) @@ -148,6 +148,14 @@ else: GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) + # dual-classable + Button = GemRB.GetControl (Window, 0) + Dual = IsDualClassed (pc,0) + if Dual[0] == 1: + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) + else: + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) + # name Label = GemRB.GetControl (Window, 0x1000000e) GemRB.SetText (Window, Label, GemRB.GetPlayerName (pc, 0)) @@ -282,11 +290,11 @@ Class = GemRB.FindTableValue (ClassTable, 5, Class) Multi = GemRB.GetTableValue (ClassTable, Class, 4) Class = GemRB.GetTableRowName (ClassTable, Class) + Dual = IsDualClassed (pc, 1) if Multi: Levels = [IE_LEVEL, IE_LEVEL2, IE_LEVEL3] Classes = [0,0,0] MultiCount = 0 - stats.append ( (19721,1,'c') ) Mask = 1 for i in range (16): if Multi&Mask: @@ -294,21 +302,67 @@ MultiCount += 1 Mask += Mask - for i in range (MultiCount): - #todo get classtitle for this class - Class = Classes[i] - ClassTitle = GemRB.GetString(GemRB.GetTableValue (ClassTable, Class, 2)) + if Dual[0] > 0: # dual classed + stats.append ( (19722,1,'c') ) + + if Dual[0] == 1: + ClassTitle = GemRB.GetString(GemRB.GetTableValue (KitTable, Dual[1], 2)) + elif Dual[0] == 2: + ClassTitle = GemRB.GetString(GemRB.GetTableValue (ClassTable, Dual[1], 2)) GemRB.SetToken("CLASS", ClassTitle) - Class = GemRB.GetTableRowName (ClassTable, i) - Level = GemRB.GetPlayerStat (pc, Levels[i]) + + Level = GemRB.GetPlayerStat (pc, Levels[1]) GemRB.SetToken("LEVEL", str (Level) ) + + # the xp table contains only classes + XPTable = GemRB.LoadTable ("xplevel") + if Dual[0] == 2: + XP1 = GemRB.GetTableRowName (XPTable, Dual[1]) + else: + KitTable = GemRB.LoadTable ("kitlist") + BaseClass = GetKitIndex (pc) + BaseClass = GemRB.GetTableValue (KitTable, BaseClass, 7) + BaseClass = GemRB.GetTableRowName (ClassTable, BaseClass) + XP1 = GemRB.GetTableRowName (XPTable, BaseClass) + # the first class' XP is discarded and set to the minimum level + # requirement, so if you don't dual class right after a levelup, + # the game would eat some of your XP + XP1 = GemRB.GetTableValue (XPTable, XP1, str(Level)) + GemRB.SetToken("EXPERIENCE", str (XP1) ) + + stats.append ( (GemRB.GetString(19720),"",'d') ) + stats.append (None) + + # the second class + ClassTitle = GemRB.GetString(GemRB.GetTableValue (ClassTable, Dual[2], 2)) + GemRB.SetToken("CLASS", ClassTitle) + Class = GemRB.GetTableRowName (ClassTable, Dual[2]) + + Level = GemRB.GetPlayerStat (pc, Levels[0]) + GemRB.SetToken("LEVEL", str (Level) ) GemRB.SetToken("NEXTLEVEL", GetNextLevelExp (Level, Class) ) - GemRB.SetToken("EXPERIENCE", str (GemRB.GetPlayerStat (pc, IE_XP)/MultiCount ) ) - #resolve string immediately - stats.append ( (GemRB.GetString(16480),"",'b') ) + + # remove the first class's XP from IE_XP + XP2 = GemRB.GetPlayerStat (pc, IE_XP) - XP1 + GemRB.SetToken("EXPERIENCE", str (XP2) ) + stats.append ( (16480,1,'c') ) stats.append (None) + else: # multi classed + stats.append ( (19721,1,'c') ) + for i in range (MultiCount): + Class = Classes[i] + ClassTitle = GemRB.GetString(GemRB.GetTableValue (ClassTable, Class, 2)) + GemRB.SetToken("CLASS", ClassTitle) + Class = GemRB.GetTableRowName (ClassTable, i) + Level = GemRB.GetPlayerStat (pc, Levels[i]) + GemRB.SetToken("LEVEL", str (Level) ) + GemRB.SetToken("NEXTLEVEL", GetNextLevelExp (Level, Class) ) + GemRB.SetToken("EXPERIENCE", str (GemRB.GetPlayerStat (pc, IE_XP)/MultiCount ) ) + #resolve string immediately + stats.append ( (GemRB.GetString(16480),"",'d') ) + stats.append (None) - else: + else: # single classed Level = GemRB.GetPlayerStat (pc, IE_LEVEL) GemRB.SetToken("LEVEL", str (Level) ) GemRB.SetToken("NEXTLEVEL", GetNextLevelExp (Level, Class) ) @@ -477,6 +531,8 @@ res.append ("[capital=0]"+strref+": "+str(val) ) elif type == 'c': #normal string res.append ("[capital=0]"+GemRB.GetString (strref) ) + elif type == 'd': #strref is an already resolved string + res.append ("[capital=0]"+strref) elif type == '0': #normal value res.append (GemRB.GetString (strref) + ': ' + str (val) ) else: #normal value + type character, for example percent sign @@ -703,6 +759,50 @@ GemRB.SetButtonState(ExportWindow, ExportDoneButton, IE_GUI_BUTTON_ENABLED) return +# returns an array: first field is 0 - not dual classed; 1 - kit/class; 2 - class/class +# the second and third field hold the kit/class index for each class +# if invoked with verbose==0 only returns 0 or 1 (is or is not dual classed) +def IsDualClassed(actor, verbose): + Dual = GemRB.GetPlayerStat (actor, IE_MC_FLAGS) + Dual = Dual & ~(MC_EXPORTABLE|MC_PLOT_CRITICAL|MC_BEENINPARTY|MC_HIDDEN) + + if verbose: + Class = GemRB.GetPlayerStat (actor, IE_CLASS) + ClassTable = GemRB.LoadTable ("classes") + ClassIndex = GemRB.FindTableValue (ClassTable, 5, Class) + Multi = GemRB.GetTableValue (ClassTable, ClassIndex, 4) + DualInfo = [] + KitIndex = GetKitIndex (actor) + + if (Dual & MC_WAS_ANY_CLASS) > 0: # first (previous) class of the dual class + if KitIndex: + DualInfo.append (1) + DualInfo.append (KitIndex) + else: + DualInfo.append (2) + DualInfo.append (GemRB.FindTableValue (ClassTable, 15, Dual & MC_WAS_ANY_CLASS)) + + # use the first class of the multiclass bunch that isn't the same as the first class + FirstClassIndex = ClassIndex + Mask = 1 + for i in range (16): + if Multi & Mask: + ClassIndex = GemRB.FindTableValue (ClassTable, 5, i+1) + if ClassIndex == FirstClassIndex: + Mask += Mask + continue + DualInfo.append (ClassIndex) + break + Mask += Mask + return DualInfo + else: + return (0,-1,-1) + else: + if (Dual & MC_WAS_ANY_CLASS) > 0: + return (1,-1,-1) + else: + return (0,-1,-1) + def KitInfoWindow(): global KitInfoWindow @@ -715,28 +815,42 @@ #kit or class description TextArea = GemRB.GetControl (KitInfoWindow,0) + pc = GemRB.GameGetSelectedPCSingle () - Kit = GemRB.GetPlayerStat (pc, IE_KIT) - KitIndex = 0 - if Kit&0xc000ffff == 0x40000000: - KitIndex = Kit>>16 & 0xfff - Table = GemRB.LoadTable ("kitlist") - if KitIndex == 0: - KitIndex = GemRB.FindTableValue (Table, Kit, 6) - if (KitIndex < 0): - KitIndex = 0 + Class = GemRB.GetPlayerStat (pc, IE_CLASS) + ClassTable = GemRB.LoadTable ("classes") + ClassIndex = GemRB.FindTableValue (ClassTable, 5, Class) + Multi = GemRB.GetTableValue (ClassTable, ClassIndex, 4) + Dual = IsDualClassed (pc, 1) - if KitIndex: - text = GemRB.GetTableValue (Table, KitIndex, 3) - else: - Table = GemRB.LoadTable ("classes") - Class = GemRB.GetPlayerStat (pc, IE_CLASS) - Class = GemRB.FindTableValue ( Table, 5, Class ) - print Class - text = GemRB.GetTableValue (Table, Class, 1) + if Multi and Dual[0] == 0: # true multi class + text = GemRB.GetTableValue (ClassTable, ClassIndex, 1) + GemRB.SetText (KitInfoWindow, TextArea, text) + GemRB.ShowModal (KitInfoWindow, MODAL_SHADOW_GRAY) + return - GemRB.SetText (KitInfoWindow, TextArea, text) + KitTable = GemRB.LoadTable ("kitlist") + KitIndex = GetKitIndex (pc) + if Dual[0]: # dual class + # first (previous) kit or class of the dual class + if Dual[0] == 1: + text = GemRB.GetTableValue (KitTable, Dual[1], 3) + elif Dual[0] == 2: + text = GemRB.GetTableValue (ClassTable, Dual[1], 1) + + GemRB.SetText (KitInfoWindow, TextArea, text) + GemRB.TextAreaAppend (KitInfoWindow, TextArea, "\n\n") + text = GemRB.GetTableValue (ClassTable, Dual[2], 1) + + else: # ordinary class or kit + if KitIndex: + text = GemRB.GetTableValue (KitTable, KitIndex, 3) + else: + text = GemRB.GetTableValue (ClassTable, ClassIndex, 1) + + GemRB.TextAreaAppend (KitInfoWindow, TextArea, text) + GemRB.ShowModal (KitInfoWindow, MODAL_SHADOW_GRAY) return Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2008-02-01 15:55:47 UTC (rev 5026) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2008-02-01 16:42:06 UTC (rev 5027) @@ -455,7 +455,7 @@ KitIndex = 0 # not sure if this check is needed, even the odd barbarian which is mentioned in # the kitlist with the fighter class id, has the matching id in classes.2da - elif Class != GemRB.GetTableValue (KitTable, KitIndex, 7): + elif Class != GemRB.GetTableValue (KitTable, KitIndex, 7): print "KitIndex before hack", KitIndex KitIndex = 0 Modified: gemrb/trunk/gemrb/override/bg2/classes.2da =================================================================== --- gemrb/trunk/gemrb/override/bg2/classes.2da 2008-02-01 15:55:47 UTC (rev 5026) +++ gemrb/trunk/gemrb/override/bg2/classes.2da 2008-02-01 16:42:06 UTC (rev 5027) @@ -1,24 +1,24 @@ 2DA V1.0 * - NAME_REF DESC_REF CAP_REF SAVE MULTI ID HP USABILITY HUMAN ELF HALF_ELF DWARF HALFLING GNOME HALFORC -FIGHTER 7201 9556 1076 SAVEWAR 0 2 HPWAR 0x800 1 1 1 1 1 1 1 -RANGER 7200 9557 1077 SAVEWAR 0 12 HPWAR 0x200000 1 1 1 0 0 0 0 -PALADIN 7217 9558 1078 SAVEWAR 0 6 HPWAR 0x100000 1 0 1 0 0 0 0 -CLERIC 7204 9559 1079 SAVEPRS 0 3 HPPRS 128 1 1 1 1 1 1 1 -DRUID 7210 9560 1080 SAVEPRS 0 11 HPPRS 0x40000000 1 1 1 1 0 0 0 -MAGE 7203 9563 1081 SAVEWIZ 0 1 HPWIZ 0x40000 1 1 1 0 0 2 0 -THIEF 7202 9561 1082 SAVEROG 0 4 HPROG 0x400000 1 1 1 1 1 1 1 -BARD 7206 9562 1083 SAVEROG 0 5 HPROG 64 1 1 1 1 1 1 1 -FIGHTER_THIEF 7205 9572 1052 * 10 9 * 0x20000 0 1 1 1 1 1 1 -FIGHTER_CLERIC 7211 9573 1053 * 6 8 * 0x4000 0 1 1 1 1 1 1 -FIGHTER_MAGE 7213 9574 1056 * 3 7 * 0x2000 0 1 1 0 0 2 0 -MAGE_THIEF 7216 9575 1057 * 9 13 * 0x80000 0 1 1 0 0 2 0 -CLERIC_MAGE 7207 9577 1058 * 5 14 * 256 0 1 1 0 0 2 0 -CLERIC_THIEF 7209 9578 1065 * 12 15 * 512 0 1 1 1 1 1 1 -FIGHTER_DRUID 7212 9579 1066 * 1026 16 * 0x1000 0 1 1 0 0 0 0 -CLERIC_RANGER 7208 9580 1073 * 2052 18 * 1024 0 1 1 0 0 0 0 -FIGHTER_MAGE_THIEF 7215 9576 1074 * 11 10 * 0x10000 0 1 1 0 0 0 0 -FIGHTER_MAGE_CLERIC 7214 9581 1075 * 7 17 * 0x8000 0 1 1 0 0 0 0 -SORCERER 45849 45866 45856 SAVEWIZ 0 19 HPWIZ 0 1 1 1 0 0 0 0 -MONK 45851 45867 45858 SAVEMONK 0 20 HPMONK 0x20000000 1 0 0 0 0 0 0 -BARBARIAN 45855 45869 45859 SAVEWAR 0 2 HPWAR 0 1 1 1 1 1 1 1 + NAME_REF DESC_REF CAP_REF SAVE MULTI ID HP USABILITY HUMAN ELF HALF_ELF DWARF HALFLING GNOME HALFORC MC_WAS_ID +FIGHTER 7201 9556 1076 SAVEWAR 0 2 HPWAR 0x800 1 1 1 1 1 1 1 0x0008 +RANGER 7200 9557 1077 SAVEWAR 0 12 HPWAR 0x200000 1 1 1 0 0 0 0 0x0100 +PALADIN 7217 9558 1078 SAVEWAR 0 6 HPWAR 0x100000 1 0 1 0 0 0 0 -1 +CLERIC 7204 9559 1079 SAVEPRS 0 3 HPPRS 128 1 1 1 1 1 1 1 0x0020 +DRUID 7210 9560 1080 SAVEPRS 0 11 HPPRS 0x40000000 1 1 1 1 0 0 0 0x0080 +MAGE 7203 9563 1081 SAVEWIZ 0 1 HPWIZ 0x40000 1 1 1 0 0 2 0 0x0010 +THIEF 7202 9561 1082 SAVEROG 0 4 HPROG 0x400000 1 1 1 1 1 1 1 0x0040 +BARD 7206 9562 1083 SAVEROG 0 5 HPROG 64 1 1 1 1 1 1 1 -1 +FIGHTER_THIEF 7205 9572 1052 * 10 9 * 0x20000 0 1 1 1 1 1 1 -1 +FIGHTER_CLERIC 7211 9573 1053 * 6 8 * 0x4000 0 1 1 1 1 1 1 -1 +FIGHTER_MAGE 7213 9574 1056 * 3 7 * 0x2000 0 1 1 0 0 2 0 -1 +MAGE_THIEF 7216 9575 1057 * 9 13 * 0x80000 0 1 1 0 0 2 0 -1 +CLERIC_MAGE 7207 9577 1058 * 5 14 * 256 0 1 1 0 0 2 0 -1 +CLERIC_THIEF 7209 9578 1065 * 12 15 * 512 0 1 1 1 1 1 1 -1 +FIGHTER_DRUID 7212 9579 1066 * 1026 16 * 0x1000 0 1 1 0 0 0 0 -1 +CLERIC_RANGER 7208 9580 1073 * 2052 18 * 1024 0 1 1 0 0 0 0 -1 +FIGHTER_MAGE_THIEF 7215 9576 1074 * 11 10 * 0x10000 0 1 1 0 0 0 0 -1 +FIGHTER_MAGE_CLERIC 7214 9581 1075 * 7 17 * 0x8000 0 1 1 0 0 0 0 -1 +SORCERER 45849 45866 45856 SAVEWIZ 0 19 HPWIZ 0 1 1 1 0 0 0 0 -1 +MONK 45851 45867 45858 SAVEMONK 0 20 HPMONK 0x20000000 1 0 0 0 0 0 0 -1 +BARBARIAN 45855 45869 45859 SAVEWAR 0 2 HPWAR 0 1 1 1 1 1 1 1 -1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-02-23 11:21:51
|
Revision: 5081 http://gemrb.svn.sourceforge.net/gemrb/?rev=5081&view=rev Author: lynxlupodian Date: 2008-02-23 03:01:25 -0800 (Sat, 23 Feb 2008) Log Message: ----------- noted the deprecated status of tob in the config examples Modified Paths: -------------- gemrb/trunk/gemrb/GemRB.cfg.sample gemrb/trunk/gemrb/GemRB.cfg.subdir.sample Modified: gemrb/trunk/gemrb/GemRB.cfg.sample =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg.sample 2008-02-23 10:56:20 UTC (rev 5080) +++ gemrb/trunk/gemrb/GemRB.cfg.sample 2008-02-23 11:01:25 UTC (rev 5081) @@ -26,8 +26,8 @@ # values: # # # # bg1 Baldur's Gate # -# bg2 Baldur's Gate 2 : SoA # -# tob Baldur's Gate 2 : ToB # +# bg2 Baldur's Gate 2 : SoA or ToB # +# tob Baldur's Gate 2 : ToB (obsolete) # # iwd IceWind Dale # # how IceWind Dale : HoW or ToTL # # iwd2 IceWind Dale 2 # Modified: gemrb/trunk/gemrb/GemRB.cfg.subdir.sample =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg.subdir.sample 2008-02-23 10:56:20 UTC (rev 5080) +++ gemrb/trunk/gemrb/GemRB.cfg.subdir.sample 2008-02-23 11:01:25 UTC (rev 5081) @@ -26,8 +26,8 @@ # values: # # # # bg1 Baldur's Gate # -# bg2 Baldur's Gate 2 : SoA # -# tob Baldur's Gate 2 : ToB # +# bg2 Baldur's Gate 2 : SoA or ToB # +# tob Baldur's Gate 2 : ToB (obsolete) # # iwd IceWind Dale # # how IceWind Dale : HoW or ToTL # # iwd2 IceWind Dale 2 # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-02-24 14:54:16
|
Revision: 5092 http://gemrb.svn.sourceforge.net/gemrb/?rev=5092&view=rev Author: lynxlupodian Date: 2008-02-24 06:54:10 -0800 (Sun, 24 Feb 2008) Log Message: ----------- fix the cmake bs for the removal of tob Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/CMakeLists.txt gemrb/trunk/gemrb/override/CMakeLists.txt Modified: gemrb/trunk/gemrb/GUIScripts/CMakeLists.txt =================================================================== --- gemrb/trunk/gemrb/GUIScripts/CMakeLists.txt 2008-02-24 13:23:38 UTC (rev 5091) +++ gemrb/trunk/gemrb/GUIScripts/CMakeLists.txt 2008-02-24 14:54:10 UTC (rev 5092) @@ -9,4 +9,3 @@ ADD_SUBDIRECTORY( iwd2 ) ADD_SUBDIRECTORY( pst ) ADD_SUBDIRECTORY( test1 ) -ADD_SUBDIRECTORY( tob ) \ No newline at end of file Modified: gemrb/trunk/gemrb/override/CMakeLists.txt =================================================================== --- gemrb/trunk/gemrb/override/CMakeLists.txt 2008-02-24 13:23:38 UTC (rev 5091) +++ gemrb/trunk/gemrb/override/CMakeLists.txt 2008-02-24 14:54:10 UTC (rev 5092) @@ -5,4 +5,3 @@ ADD_SUBDIRECTORY( iwd2 ) ADD_SUBDIRECTORY( pst ) ADD_SUBDIRECTORY( test1 ) -ADD_SUBDIRECTORY( tob ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-05-04 20:50:47
|
Revision: 5141 http://gemrb.svn.sourceforge.net/gemrb/?rev=5141&view=rev Author: lynxlupodian Date: 2008-05-04 13:50:52 -0700 (Sun, 04 May 2008) Log Message: ----------- bg2 cg: learn and forget spells right away, so they can be shown in the character summary. This means the character needs to be created earlier. It makes an older bug more obvious - there seems to be an off-by-one error in the specialist mage/spell handling, which resulted in missing spells and now in different spells (usually just the last). Also added stubs for the rest of the missing character summary info. added an error message in an error case in GemRB_RemoveSpell added a comment noting the computerly behaviour of GetKnownSpellsCount Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg2/CharGen.py gemrb/trunk/gemrb/GUIScripts/bg2/CharGen6.py gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py gemrb/trunk/gemrb/GUIScripts/bg2/CharGenCommon.py gemrb/trunk/gemrb/GUIScripts/bg2/GUICG7.py gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg2/CharGen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/CharGen.py 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/GUIScripts/bg2/CharGen.py 2008-05-04 20:50:52 UTC (rev 5141) @@ -21,6 +21,8 @@ GemRB.SetVar("Class Kit",0) #class GemRB.SetVar("Alignment",-1) #alignment + MyChar = GemRB.GetVar ("Slot") + GemRB.CreatePlayer ("charbase", MyChar | 0x8000 ) DisplayOverview (1) return Modified: gemrb/trunk/gemrb/GUIScripts/bg2/CharGen6.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/CharGen6.py 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/GUIScripts/bg2/CharGen6.py 2008-05-04 20:50:52 UTC (rev 5141) @@ -1,6 +1,7 @@ #character generation (GUICG 0) import GemRB from CharGenCommon import * +from GUICG7 import RemoveKnownSpells def OnLoad(): for i in range(0,6): @@ -10,4 +11,6 @@ DisplayOverview (6) + RemoveKnownSpells () + return Modified: gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py 2008-05-04 20:50:52 UTC (rev 5141) @@ -20,7 +20,6 @@ def FinishCharGen(): #set my character up MyChar = GemRB.GetVar ("Slot") - GemRB.CreatePlayer ("charbase", MyChar | 0x8000 ) GemRB.SetPlayerStat (MyChar, IE_SEX, GemRB.GetVar ("Gender") ) KitTable = GemRB.LoadTable ("kitlist") RaceTable = GemRB.LoadTable ("races") @@ -54,13 +53,6 @@ if KitValue == "*": KitValue = 0x4000 SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_WIZARD, 1) - Learnable = GetLearnableMageSpells( KitValue, t, 1) - SpellBook = GemRB.GetVar ("MageSpellBook") - j=1 - for i in range(len(Learnable) ): - if SpellBook & j: - GemRB.LearnSpell (MyChar, Learnable[i], 0) - j=j<<1 else: KitValue = (0x4000 + KitIndex)<<16 Modified: gemrb/trunk/gemrb/GUIScripts/bg2/CharGenCommon.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/CharGenCommon.py 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/GUIScripts/bg2/CharGenCommon.py 2008-05-04 20:50:52 UTC (rev 5141) @@ -3,7 +3,6 @@ from ie_stats import * from GUIDefines import * from GUICommon import * -#from CharGen9 import FinishCharGen CharGenWindow = 0 TextAreaControl = 0 @@ -103,6 +102,8 @@ AlignmentTable = GemRB.LoadTable ("aligns") AbilityTable = GemRB.LoadTable ("ability") + MyChar = GemRB.GetVar ("Slot") + for part in range(1, step+1): if part == 1: TextAreaControl= GemRB.GetControl (CharGenWindow,9) @@ -151,12 +152,29 @@ + str(GemRB.GetVar ("Ability "+str(i))) ) elif part == 7: # TODO: list known spells, proficiencies and thief skills, racial enemy - GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, "\n") - #spells / thieving + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, "\n\n") + # thieving and other skills + #GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 8442) + # arcane spells + info = "" + for level in range(0, 9): + for j in range(0, GemRB.GetKnownSpellsCount (MyChar, IE_SPELL_TYPE_WIZARD, level) ): + Spell = GemRB.GetKnownSpell (MyChar, IE_SPELL_TYPE_WIZARD, level, j) + Spell = GemRB.GetSpell (Spell['SpellResRef'])['SpellName'] + info += GemRB.GetString (Spell) + "\n" + if info != "": + info = "\n" + info + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 11027) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, info) + + #divine spells + #GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 11028) #GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, "\n") #racial enemy + #GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 15982) #GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, "\n") #weapon proficiencies + #GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 9466) elif part == 8: break Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICG7.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG7.py 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICG7.py 2008-05-04 20:50:52 UTC (rev 5141) @@ -20,7 +20,8 @@ # character generation, mage spells (GUICG7) import GemRB -from GUICommon import GetMageSpells +from GUIDefines import * +from GUICommon import GetMageSpells, GetLearnableMageSpells MageSpellsWindow = 0 MageSpellsTextArea = 0 @@ -60,8 +61,6 @@ if GemRB.GetTableValue(TmpTable, Class, 4)=='*': MageSpellsSelectPointsLeft = 3 # TODO make the random Pick method enforce a specialist selection too? - # TODO also write the specialist spells of greater level to the spellbook - # or will it be done on levelup? Or was it just Edwin? else: KitValue = 0x4000 @@ -70,6 +69,8 @@ SpellMask = 0 GemRB.SetVar("SpellMask", 0) + RemoveKnownSpells () + PointsLeftLabel = GemRB.GetControl(MageSpellsWindow, 0x1000001b) GemRB.SetLabelUseRGB(MageSpellsWindow, PointsLeftLabel, 1) GemRB.SetText(MageSpellsWindow, PointsLeftLabel, str(MageSpellsSelectPointsLeft)) @@ -191,10 +192,28 @@ return def MageSpellsDonePress(): + global KitValue + MageSpellBook = GemRB.GetVar ("MageSpellBook") + Learnable = [] + j=1 + for level in range(1, 10): + Learnable = GetLearnableMageSpells ( KitValue, GemRB.GetVar ("Alignment"), level) + for i in range (len(Learnable)): + if MageSpellBook & j: + print "Learning:", GemRB.GetString ((GemRB.GetSpell (Learnable[i])['SpellName'])) + GemRB.LearnSpell (GemRB.GetVar ("Slot"), Learnable[i], 0) + j=j<<1 + GemRB.UnloadWindow(MageSpellsWindow) GemRB.SetNextScript("GUICG6") #abilities return +def RemoveKnownSpells(): + slot = GemRB.GetVar ("Slot") + for level in range(0, 9): + for j in range(GemRB.GetKnownSpellsCount (slot, IE_SPELL_TYPE_WIZARD, level)-1, -1, -1): + GemRB.RemoveSpell (slot, IE_SPELL_TYPE_WIZARD, level, j) + def MageSpellsPickPress(): global MageSpellsSelectPointsLeft, MageSpells Modified: gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp 2008-05-04 20:50:52 UTC (rev 5141) @@ -300,6 +300,7 @@ return total; } +// returns the number of known spells of level (level+1) unsigned int Spellbook::GetKnownSpellsCount(int type, unsigned int level) const { if (type >= NUM_BOOK_TYPES || level >= GetSpellLevelCount(type)) Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2008-04-12 15:01:25 UTC (rev 5140) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2008-05-04 20:50:52 UTC (rev 5141) @@ -5974,12 +5974,12 @@ } Actor* actor = game->FindPC( PartyID ); if (!actor) { - return RuntimeError( "Actor not found" ); + return RuntimeError( "Actor not found!" ); } CREKnownSpell* ks = actor->spellbook.GetKnownSpell( SpellType, Level, Index ); if (! ks) { - return NULL; + return RuntimeError( "Spell not known!" ); } return PyInt_FromLong( actor->spellbook.RemoveSpell( ks ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-06-28 09:34:15
|
Revision: 5222 http://gemrb.svn.sourceforge.net/gemrb/?rev=5222&view=rev Author: lynxlupodian Date: 2008-06-28 02:34:23 -0700 (Sat, 28 Jun 2008) Log Message: ----------- added a GetTableColumnIndex method to round up the table functions and to use it in bg2 Modified Paths: -------------- gemrb/trunk/gemrb/plugins/2DAImporter/2DAImp.h gemrb/trunk/gemrb/plugins/Core/TableMgr.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Added Paths: ----------- gemrb/trunk/gemrb/docs/en/GUIScript/GetTableColumnIndex.txt Added: gemrb/trunk/gemrb/docs/en/GUIScript/GetTableColumnIndex.txt =================================================================== --- gemrb/trunk/gemrb/docs/en/GUIScript/GetTableColumnIndex.txt (rev 0) +++ gemrb/trunk/gemrb/docs/en/GUIScript/GetTableColumnIndex.txt 2008-06-28 09:34:23 UTC (rev 5222) @@ -0,0 +1,11 @@ + +Prototype: GemRB.GetTableColumnIndex(TableIndex, ColumnName) + +Description: Returns the Index of a Column referenced by ColumnName in a 2DA Table. + +Parameters: TableIndex - returned by a previous LoadTable command. +ColumnName - a column label + +Return value: numeric, -1 if column doesn't exist + +See also: LoadTable, GetTableRowIndex Modified: gemrb/trunk/gemrb/plugins/2DAImporter/2DAImp.h =================================================================== --- gemrb/trunk/gemrb/plugins/2DAImporter/2DAImp.h 2008-06-28 07:59:42 UTC (rev 5221) +++ gemrb/trunk/gemrb/plugins/2DAImporter/2DAImp.h 2008-06-28 09:34:23 UTC (rev 5222) @@ -113,6 +113,16 @@ return -1; }; + inline int GetColumnIndex(const char* string) const + { + for (unsigned int index = 0; index < colNames.size(); index++) { + if (stricmp( colNames[index], string ) == 0) { + return index; + } + } + return -1; + }; + inline const char* GetColumnName(unsigned int index) const { if (index < colNames.size()) { Modified: gemrb/trunk/gemrb/plugins/Core/TableMgr.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/TableMgr.h 2008-06-28 07:59:42 UTC (rev 5221) +++ gemrb/trunk/gemrb/plugins/Core/TableMgr.h 2008-06-28 09:34:23 UTC (rev 5222) @@ -66,6 +66,7 @@ * uses column name and row name to search the field, * may return NULL */ virtual const char* QueryField(const char* row, const char* column) const = 0; + virtual int GetColumnIndex(const char* colname) const = 0; virtual int GetRowIndex(const char* rowname) const = 0; virtual const char* GetColumnName(unsigned int index) const = 0; virtual const char* GetRowName(unsigned int index) const = 0; Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2008-06-28 07:59:42 UTC (rev 5221) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2008-06-28 09:34:23 UTC (rev 5222) @@ -1016,6 +1016,28 @@ return PyString_FromString( str ); } +PyDoc_STRVAR( GemRB_GetTableColumnIndex__doc, +"GetTableColumnIndex(TableIndex, ColumnName) => Column\n\n" +"Returns the Index of a Column in a 2DA Table." ); + +static PyObject* GemRB_GetTableColumnIndex(PyObject * /*self*/, PyObject* args) +{ + int ti; + char* colname; + + if (!PyArg_ParseTuple( args, "is", &ti, &colname )) { + return AttributeError( GemRB_GetTableColumnIndex__doc ); + } + + TableMgr* tm = core->GetTable( ti ); + if (tm == NULL) { + return RuntimeError("Can't find resource"); + } + int col = tm->GetColumnIndex( colname ); + //no error if the column doesn't exist + return PyInt_FromLong( col ); +} + PyDoc_STRVAR( GemRB_GetTableColumnName__doc, "GetTableColumnName(TableIndex, ColumnIndex) => string\n\n" "Returns the Name of a Column in a 2DA Table." ); @@ -8278,6 +8300,7 @@ METHOD(FindTableValue, METH_VARARGS), METHOD(GetTableRowIndex, METH_VARARGS), METHOD(GetTableRowName, METH_VARARGS), + METHOD(GetTableColumnIndex, METH_VARARGS), METHOD(GetTableColumnName, METH_VARARGS), METHOD(GetTableRowCount, METH_VARARGS), METHOD(GetTableColumnCount, METH_VARARGS), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |