Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16921/plugins/Core Modified Files: Actions.cpp Actor.cpp Actor.h ActorBlock.cpp ActorBlock.h GSUtils.cpp GSUtils.h GameControl.cpp GameControl.h GameScript.cpp GameScript.h Interface.cpp Interface.h Map.cpp Map.h MapControl.cpp TileMap.cpp TileMap.h Triggers.cpp Log Message: Pass all 3 parameters of QuitGame to guiscript pst: use first 2 parameters of QuitGame for movies, the 3rd unused param for the hardcoded game_over feature handle disabled portals in pst correctly triggers now can initiate dialogs (pst feature) InTrap trigger fixed pathfinder to handle MinDistance correctly fixed StateCheck triggers to return correct value Index: Actor.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.cpp,v retrieving revision 1.255 retrieving revision 1.256 diff -C2 -d -r1.255 -r1.256 *** Actor.cpp 9 Feb 2007 19:36:58 -0000 1.255 --- Actor.cpp 10 Feb 2007 14:29:23 -0000 1.256 *************** *** 164,168 **** Modified[i] = 0; } - Dialog[0] = 0; SmallPortrait[0] = 0; LargePortrait[0] = 0; --- 164,167 ---- *************** *** 197,200 **** --- 196,200 ---- attackcount = 0; initiative = 0; + InTrap = 0; inventory.SetInventoryType(INVENTORY_CREATURE); *************** *** 2236,2239 **** --- 2236,2255 ---- } + void Actor::SetInTrap(ieDword setreset) + { + InTrap = setreset; + if (setreset) { + InternalFlags |= IF_INTRAP; + } else { + InternalFlags &= ~IF_INTRAP; + } + } + + void Actor::SetRunFlags(ieDword flags) + { + InternalFlags &= ~IF_RUNFLAGS; + InternalFlags |= (flags & IF_RUNFLAGS); + } + void Actor::WalkTo(Point &Des, ieDword flags, int MinDistance) { *************** *** 2241,2246 **** return; } ! InternalFlags &= ~IF_RUNFLAGS; ! InternalFlags |= (flags & IF_RUNFLAGS); // is this true??? if (Des.x==-2 && Des.y==-2) { --- 2257,2261 ---- return; } ! SetRunFlags(flags); // is this true??? if (Des.x==-2 && Des.y==-2) { *************** *** 2340,2343 **** --- 2355,2362 ---- } + if (InTrap) { + area->ClearTrap(this, InTrap-1); + } + //visual feedback CharAnimations* ca = GetAnims(); Index: GSUtils.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GSUtils.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** GSUtils.h 9 Feb 2007 20:36:11 -0000 1.30 --- GSUtils.h 10 Feb 2007 14:29:23 -0000 1.31 *************** *** 64,67 **** --- 64,68 ---- bool ResolveSpellName(ieResRef spellres, Action *parameter); void EscapeAreaCore(Actor *src, const char *resref, Point &enter, Point &exit, int flags); + void GoNear(Scriptable *Sender, Point &p); void GoNearAndRetry(Scriptable *Sender, Scriptable *target, bool destination, int distance); void GoNearAndRetry(Scriptable *Sender, Point &p, int distance); Index: GSUtils.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GSUtils.cpp,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** GSUtils.cpp 9 Feb 2007 20:36:11 -0000 1.82 --- GSUtils.cpp 10 Feb 2007 14:29:23 -0000 1.83 *************** *** 722,725 **** --- 722,744 ---- } + void GetTalkPositionFromScriptable(Scriptable* scr, Point &position) + { + switch (scr->Type) { + case ST_AREA: case ST_GLOBAL: + position = scr->Pos; //fake + break; + case ST_ACTOR: + //if there are other moveables, put them here + position = ((Movable *) scr)->GetMostLikelyPosition(); + break; + case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: + position=((InfoPoint *) scr)->TrapLaunch; + break; + case ST_DOOR: case ST_CONTAINER: + position=((Highlightable *) scr)->TrapLaunch; + break; + } + } + void GetPositionFromScriptable(Scriptable* scr, Point &position, bool dest) { *************** *** 763,768 **** scr = Sender; } ! if (!scr || scr->Type != ST_ACTOR) { ! printf("[GameScript]: Speaker for dialog couldn't be found (Sender: %s, Type: %d).\n", Sender->GetScriptName(), Sender->Type); Sender->ReleaseCurrentAction(); return; --- 782,789 ---- scr = Sender; } ! if (!scr) { ! //if (!scr || scr->Type != ST_ACTOR) { ! printMessage("GameScript"," ",LIGHT_RED); ! printf("Speaker for dialog couldn't be found (Sender: %s, Type: %d) Flags:%d.\n", Sender->GetScriptName(), Sender->Type, Flags); Sender->ReleaseCurrentAction(); return; *************** *** 770,774 **** if (!tar || tar->Type!=ST_ACTOR) { ! printf("[GameScript]: Target for dialog couldn't be found (Sender: %s, Type: %d).\n", Sender->GetScriptName(), Sender->Type); if (Sender->Type == ST_ACTOR) { ((Actor *) Sender)->DebugDump(); --- 791,796 ---- if (!tar || tar->Type!=ST_ACTOR) { ! printMessage("GameScript"," ",LIGHT_RED); ! printf("Target for dialog couldn't be found (Sender: %s, Type: %d).\n", Sender->GetScriptName(), Sender->Type); if (Sender->Type == ST_ACTOR) { ((Actor *) Sender)->DebugDump(); *************** *** 786,792 **** Actor *speaker, *target; ! speaker = (Actor *) scr; target = (Actor *) tar; if (!CanSee(scr, target, false, 0) ) { printf("CanSee returned false! Speaker and target are:\n"); ((Actor *) scr)->DebugDump(); --- 808,815 ---- Actor *speaker, *target; ! speaker = NULL; target = (Actor *) tar; if (!CanSee(scr, target, false, 0) ) { + printMessage("GameScript"," ",LIGHT_RED); printf("CanSee returned false! Speaker and target are:\n"); ((Actor *) scr)->DebugDump(); *************** *** 795,819 **** return; } ! if (speaker->GetStat(IE_STATE_ID)&STATE_DEAD) { ! printf("Speaker is dead, cannot start dialogue. Speaker and target are:\n"); ! ((Actor *) scr)->DebugDump(); ! ((Actor *) tar)->DebugDump(); ! Sender->ReleaseCurrentAction(); ! return; ! } ! ! //CHECKDIST works only for mobile scriptables ! if (Flags&BD_CHECKDIST) { ! if (Distance(speaker, target)>speaker->GetStat(IE_DIALOGRANGE)*15 ) { ! //this is unsure, the target's path will be cleared ! GoNearAndRetry(Sender, tar, true, speaker->GetStat(IE_DIALOGRANGE)*15); Sender->ReleaseCurrentAction(); return; } } ! //making sure speaker is the protagonist, player, actor ! bool swap = false; ! if ( target->InParty == 1) swap = true; ! else if ( speaker->InParty !=1 && target->InParty) swap = true; GameControl* gc = core->GetGameControl(); --- 818,870 ---- return; } ! bool swap = false; ! if (scr->Type==ST_ACTOR) { ! speaker = (Actor *) scr; ! if (speaker->GetStat(IE_STATE_ID)&STATE_DEAD) { ! printMessage("GameScript"," ",LIGHT_RED); ! printf("Speaker is dead, cannot start dialogue. Speaker and target are:\n"); ! speaker->DebugDump(); ! target->DebugDump(); Sender->ReleaseCurrentAction(); return; } + ieDword range = MAX_OPERATING_DISTANCE; + //making sure speaker is the protagonist, player, actor + if ( target->InParty == 1) swap = true; + else if ( speaker->InParty !=1 && target->InParty) swap = true; + //CHECKDIST works only for mobile scriptables + if (Flags&BD_CHECKDIST) { + if (PersonalDistance(scr, target)>range ) { + //this is unsure, the target's path will be cleared + GoNearAndRetry(Sender, tar, true, range); + Sender->ReleaseCurrentAction(); + return; + } + } + } else { + //pst style dialog with trigger points + swap=true; + if (Flags&BD_CHECKDIST) { + Point TalkPos; + + if (target->InMove()) { + //waiting for target + Sender->AddActionInFront( Sender->CurrentAction ); + Sender->ReleaseCurrentAction(); + Sender->SetWait(1); + return; + } + GetTalkPositionFromScriptable(scr, TalkPos); + if (Distance(TalkPos, target)>MAX_OPERATING_DISTANCE ) { + //try to force the target to come closer??? + GoNear(target, TalkPos); + Sender->AddActionInFront( Sender->CurrentAction ); + Sender->ReleaseCurrentAction(); + Sender->SetWait(1); + return; + } + } } ! GameControl* gc = core->GetGameControl(); *************** *** 844,854 **** Dialog = parameters->string0Parameter; if (Flags & BD_SETDIALOG) { ! speaker->SetDialog( Dialog ); } break; case BD_SOURCE: case BD_TARGET: ! if (swap) Dialog = speaker->Dialog; ! else Dialog = target->Dialog; break; case BD_RESERVED: --- 895,905 ---- Dialog = parameters->string0Parameter; if (Flags & BD_SETDIALOG) { ! scr->SetDialog( Dialog ); } break; case BD_SOURCE: case BD_TARGET: ! if (swap) Dialog = scr->GetDialog(); ! else Dialog = target->GetDialog(true); break; case BD_RESERVED: *************** *** 859,863 **** case BD_INTERACT: //using the source for the dialog pdtable = core->LoadTable( "interdia" ); ! const char* scriptingname = ((Actor *) scr)->GetScriptName(); //Dialog is a borrowed reference, we cannot free pdtable while it is being used if (pdtable!=-1) { --- 910,914 ---- case BD_INTERACT: //using the source for the dialog pdtable = core->LoadTable( "interdia" ); ! const char* scriptingname = scr->GetScriptName(); //Dialog is a borrowed reference, we cannot free pdtable while it is being used if (pdtable!=-1) { *************** *** 879,886 **** if (speaker!=target) { if (swap) { ! Actor *tmp = target; ! target = speaker; ! speaker = tmp; ! } else { if (!(Flags & BD_INTERRUPT)) { if (tar->GetNextAction()) { --- 930,937 ---- if (speaker!=target) { if (swap) { ! Scriptable *tmp = tar; ! tar = scr; ! scr = tmp; ! } else { if (!(Flags & BD_INTERRUPT)) { if (tar->GetNextAction()) { *************** *** 895,901 **** //don't clear target's actions, because a sequence like this will be broken: //StartDialog([PC]); SetGlobal("Talked","LOCALS",1); ! speaker->ClearActions(); ! speaker->SetOrientation(GetOrient( target->Pos, speaker->Pos), true); ! target->SetOrientation(GetOrient( speaker->Pos, target->Pos), true); if (Dialog[0]) { --- 946,957 ---- //don't clear target's actions, because a sequence like this will be broken: //StartDialog([PC]); SetGlobal("Talked","LOCALS",1); ! if (scr!=tar) { ! if (scr->Type==ST_ACTOR) { ! ((Actor *) scr)->SetOrientation(GetOrient( tar->Pos, scr->Pos), true); ! } ! if (tar->Type==ST_ACTOR) { ! ((Actor *) tar)->SetOrientation(GetOrient( scr->Pos, tar->Pos), true); ! } ! } if (Dialog[0]) { *************** *** 908,912 **** core->GetDictionary()->SetAt("DialogChoose",(ieDword) -1); ! gc->InitDialog( speaker, target, Dialog); } //if pdtable was allocated, free it now, it will release Dialog --- 964,968 ---- core->GetDictionary()->SetAt("DialogChoose",(ieDword) -1); ! gc->InitDialog( scr, tar, Dialog); } //if pdtable was allocated, free it now, it will release Dialog *************** *** 1393,1396 **** --- 1449,1465 ---- } + void GoNear(Scriptable *Sender, Point &p) + { + if (Sender->CurrentAction) { + printMessage("GameScript","Target busy???\n",LIGHT_RED); + return; + } + Sender->AddActionInFront( Sender->CurrentAction ); + char Tmp[256]; + sprintf( Tmp, "MoveToPoint([%hd.%hd])", p.x, p.y ); + Action * action = GenerateAction( Tmp); + Sender->AddActionInFront( action ); + } + void GoNearAndRetry(Scriptable *Sender, Scriptable *target, bool flag, int distance) { Index: GameScript.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.cpp,v retrieving revision 1.394 retrieving revision 1.395 diff -C2 -d -r1.394 -r1.395 *** GameScript.cpp 9 Feb 2007 21:12:26 -0000 1.394 --- GameScript.cpp 10 Feb 2007 14:29:23 -0000 1.395 *************** *** 179,182 **** --- 179,183 ---- {"internallt", GameScript::InternalLT, 0}, {"interactingwith", GameScript::InteractingWith, 0}, + {"intrap", GameScript::InTrap, 0}, {"inventoryfull", GameScript::InventoryFull, 0}, {"inview", GameScript::LOS, 0}, //it seems the same, needs research *************** *** 462,465 **** --- 463,467 ---- {"dialogueinterrupt", GameScript::DialogueInterrupt,0}, {"disablefogdither", GameScript::DisableFogDither, 0}, + {"disablespritedither", GameScript::DisableSpriteDither, 0}, {"displaymessage", GameScript::DisplayMessage, 0}, {"displaystring", GameScript::DisplayString, 0}, *************** *** 476,479 **** --- 478,482 ---- {"enablefogdither", GameScript::EnableFogDither, 0}, {"enableportaltravel", GameScript::EnablePortalTravel, 0}, + {"enablespritedither", GameScript::EnableSpriteDither, 0}, {"endcredits", GameScript::EndCredits, 0},//movie {"endcutscenemode", GameScript::EndCutSceneMode, 0}, *************** *** 506,512 **** {"floatmessagefixedrnd", GameScript::FloatMessageFixedRnd, 0}, {"floatmessagernd", GameScript::FloatMessageRnd, 0}, {"follow", GameScript::Follow, 0}, ! {"followcreature", GameScript::FollowCreature, 0}, //pst ! {"followobjectformation", GameScript::FollowObjectFormation, 0}, {"forceaiscript", GameScript::ForceAIScript, 0}, {"forceattack", GameScript::ForceAttack, 0}, --- 509,516 ---- {"floatmessagefixedrnd", GameScript::FloatMessageFixedRnd, 0}, {"floatmessagernd", GameScript::FloatMessageRnd, 0}, + {"floatrebus", GameScript::FloatRebus, 0}, {"follow", GameScript::Follow, 0}, ! {"followcreature", GameScript::FollowCreature, AF_BLOCKING}, //pst ! {"followobjectformation", GameScript::FollowObjectFormation, AF_BLOCKING}, {"forceaiscript", GameScript::ForceAIScript, 0}, {"forceattack", GameScript::ForceAttack, 0}, *************** *** 516,519 **** --- 520,524 ---- {"forcespell", GameScript::ForceSpell, AF_BLOCKING}, {"fullheal", GameScript::FullHeal, 0}, + {"fullhealex", GameScript::FullHeal, 0}, //pst, not sure what's different {"generatepartymember", GameScript::GeneratePartyMember, 0}, {"getitem", GameScript::GetItem, 0}, *************** *** 671,674 **** --- 676,680 ---- {"runawayfromnointerrupt", GameScript::RunAwayFromNoInterrupt,AF_BLOCKING}, {"runawayfrompoint", GameScript::RunAwayFromPoint,AF_BLOCKING}, + {"runfollow", GameScript::RunAwayFrom,AF_BLOCKING}, {"runningattack", GameScript::RunningAttack,AF_BLOCKING}, {"runningattacknosound", GameScript::RunningAttackNoSound,AF_BLOCKING}, Index: GameControl.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameControl.cpp,v retrieving revision 1.305 retrieving revision 1.306 diff -C2 -d -r1.305 -r1.306 *** GameControl.cpp 8 Feb 2007 22:56:56 -0000 1.305 --- GameControl.cpp 10 Feb 2007 14:29:23 -0000 1.306 *************** *** 123,127 **** dlg = NULL; targetID = 0; ! speakerID = 0; } --- 123,128 ---- dlg = NULL; targetID = 0; ! speakerID = 0; ! targetOB = NULL; } *************** *** 788,796 **** } ! overInfoPoint = area->TMap->GetInfoPoint( p ); if (overInfoPoint) { ! if (overInfoPoint->Type != ST_PROXIMITY) { ! nextCursor = overInfoPoint->Cursor; ! } } --- 789,795 ---- } ! overInfoPoint = area->TMap->GetInfoPoint( p, true ); if (overInfoPoint) { ! nextCursor = overInfoPoint->Cursor; } *************** *** 1490,1494 **** } ! void GameControl::InitDialog(Actor* spk, Actor* tgt, const char* dlgref) { if (tgt->GetInternalFlag()&IF_NOINT) { --- 1489,1493 ---- } ! void GameControl::InitDialog(Scriptable* spk, Scriptable* tgt, const char* dlgref) { if (tgt->GetInternalFlag()&IF_NOINT) { *************** *** 1514,1521 **** //and external link, we need to find the new target (whose dialog was //linked to) ! targetID = tgt->globalID; ! spk->LastTalkedTo=targetID; ! speakerID = spk->globalID; ! tgt->LastTalkedTo=speakerID; //check if we are already in dialog --- 1513,1533 ---- //and external link, we need to find the new target (whose dialog was //linked to) ! ! Actor *spe = (Actor *) spk; ! speakerID = spe->globalID; ! if (tgt->Type!=ST_ACTOR) { ! targetID=0xffff; ! //most likely this dangling object reference ! //won't cause problems, because trigger points don't ! //get destroyed during a dialog ! targetOB=tgt; ! spk->LastTalkedTo=0; ! } else { ! Actor *tar = (Actor *) tgt; ! speakerID = spe->globalID; ! targetID = tar->globalID; ! spe->LastTalkedTo=targetID; ! tar->LastTalkedTo=speakerID; ! } //check if we are already in dialog *************** *** 1527,1531 **** DialogueFlags |= DF_IN_DIALOG; ! tgt->DialogInterrupt(); //allow mouse selection from dialog (even though screen is locked) --- 1539,1546 ---- DialogueFlags |= DF_IN_DIALOG; ! if (tgt->Type==ST_ACTOR) { ! Actor *tar = (Actor *) tgt; ! tar->DialogInterrupt(); ! } //allow mouse selection from dialog (even though screen is locked) *************** *** 1548,1563 **** } ! /* I'm not convinced we should call these, but it is possible ! Actor *target = GetTarget(); ! Actor *speaker = GetSpeaker(); ! if (target) { ! target->ReleaseCurrentAction(); ! } ! if (speaker) { ! speaker->ReleaseCurrentAction(); ! } ! */ ! ! speakerID = 0; targetID = 0; ds = NULL; --- 1563,1568 ---- } ! speakerID = 0; ! targetOB = NULL; targetID = 0; ds = NULL; *************** *** 1582,1599 **** return; } - Actor *speaker = GetSpeaker(); - if (!speaker) { - printMessage("GameControl","Speaker gone???",LIGHT_RED); - EndDialog(); - return; - } - - Actor *target = GetTarget(); - if (!target) { - printMessage("GameControl","Target gone???",LIGHT_RED); - EndDialog(); - return; - } //get the first state with true triggers! int si; --- 1587,1614 ---- return; } + + Actor *speaker = GetSpeaker(); + if (!speaker) { + printMessage("GameControl","Speaker gone???",LIGHT_RED); + EndDialog(); + return; + } + Actor *tgt; + Scriptable *target; + + if (targetID!=0xffff) { + tgt = GetTarget(); + target = tgt; + } else { + //risky!!! + target = targetOB; + tgt=NULL; + } + if (!target) { + printMessage("GameControl","Target gone???",LIGHT_RED); + EndDialog(); + return; + } //get the first state with true triggers! int si; *************** *** 1606,1617 **** return; } ! //increasing talkcount after top level condition was determined ! if (DialogueFlags&DF_TALKCOUNT) { ! DialogueFlags&=~DF_TALKCOUNT; ! target->TalkCount++; ! } else if (DialogueFlags&DF_INTERACT) { ! DialogueFlags&=~DF_INTERACT; ! target->InteractCount++; ! } ds = dlg->GetState( si ); } else { --- 1621,1635 ---- return; } ! //increasing talkcount after top level condition was determined ! ! if (tgt) { ! if (DialogueFlags&DF_TALKCOUNT) { ! DialogueFlags&=~DF_TALKCOUNT; ! tgt->TalkCount++; ! } else if (DialogueFlags&DF_INTERACT) { ! DialogueFlags&=~DF_INTERACT; ! tgt->InteractCount++; ! } ! } ds = dlg->GetState( si ); } else { *************** *** 1675,1679 **** if (tr->Dialog[0] && strnicmp( tr->Dialog, dlg->ResRef, 8 )) { //target should be recalculated! ! target = target->GetCurrentArea()->GetActorByDialog(tr->Dialog); if (!target) { printMessage("Dialog","Can't redirect dialog\n",YELLOW); --- 1693,1698 ---- if (tr->Dialog[0] && strnicmp( tr->Dialog, dlg->ResRef, 8 )) { //target should be recalculated! ! tgt = target->GetCurrentArea()->GetActorByDialog(tr->Dialog); ! target = tgt; if (!target) { printMessage("Dialog","Can't redirect dialog\n",YELLOW); *************** *** 1682,1686 **** return; } ! targetID = target->globalID; // we have to make a backup, tr->Dialog is freed ieResRef tmpresref; --- 1701,1705 ---- return; } ! targetID = tgt->globalID; // we have to make a backup, tr->Dialog is freed ieResRef tmpresref; Index: TileMap.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/TileMap.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** TileMap.cpp 27 Nov 2006 18:48:25 -0000 1.56 --- TileMap.cpp 10 Feb 2007 14:29:23 -0000 1.57 *************** *** 480,484 **** return ip; } ! InfoPoint* TileMap::GetInfoPoint(Point &p) { for (size_t i = 0; i < infoPoints.size(); i++) { --- 480,486 ---- return ip; } ! ! //if detectable is set, then only detectable infopoints will be returned ! InfoPoint* TileMap::GetInfoPoint(Point &p, bool detectable) { for (size_t i = 0; i < infoPoints.size(); i++) { *************** *** 489,492 **** --- 491,505 ---- continue; + if (detectable) { + if (ip->Type==ST_PROXIMITY) { + continue; + } + if (ip->Type==ST_TRAVEL) { + if (!(ip->Trapped&PORTAL_CURSOR)) { + continue; + } + } + } + if (!(ip->GetInternalFlag()&IF_ACTIVE)) continue; Index: TileMap.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/TileMap.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** TileMap.h 26 Nov 2006 23:19:19 -0000 1.40 --- TileMap.h 10 Feb 2007 14:29:23 -0000 1.41 *************** *** 74,78 **** InfoPoint* AddInfoPoint(const char* Name, unsigned short Type, Gem_Polygon* outline); ! InfoPoint* GetInfoPoint(Point &position); InfoPoint* GetInfoPoint(const char* Name); InfoPoint* GetInfoPoint(unsigned int idx); --- 74,78 ---- InfoPoint* AddInfoPoint(const char* Name, unsigned short Type, Gem_Polygon* outline); ! InfoPoint* GetInfoPoint(Point &position, bool detectable); InfoPoint* GetInfoPoint(const char* Name); InfoPoint* GetInfoPoint(unsigned int idx); Index: Actions.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actions.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** Actions.cpp 9 Feb 2007 21:12:26 -0000 1.108 --- Actions.cpp 10 Feb 2007 14:29:23 -0000 1.109 *************** *** 3080,3083 **** --- 3080,3084 ---- //Heal() might contain curing of some conditions //if FullHeal doesn't do that, replace this with a SetBase + //fullhealex might still be the curing action scr->Heal(0); } *************** *** 3552,3561 **** //death text, etc //this covers: ! //QuitGame (play one of 3 movies in PST) //EndGame (display death screen with strref) void GameScript::QuitGame(Scriptable* Sender, Action* parameters) { ClearAllActions(Sender, parameters); ! core->GetDictionary()->SetAt("QuitGame", (ieDword) parameters->int0Parameter); strncpy( core->NextScript, "QuitGame", sizeof(core->NextScript) ); core->QuitFlag |= QF_CHANGESCRIPT; --- 3553,3564 ---- //death text, etc //this covers: ! //QuitGame (play two of 3 movies in PST, display death screen with strref) //EndGame (display death screen with strref) void GameScript::QuitGame(Scriptable* Sender, Action* parameters) { ClearAllActions(Sender, parameters); ! core->GetDictionary()->SetAt("QuitGame1", (ieDword) parameters->int0Parameter); ! core->GetDictionary()->SetAt("QuitGame2", (ieDword) parameters->int1Parameter); ! core->GetDictionary()->SetAt("QuitGame3", (ieDword) parameters->int2Parameter); strncpy( core->NextScript, "QuitGame", sizeof(core->NextScript) ); core->QuitFlag |= QF_CHANGESCRIPT; *************** *** 4697,4703 **** InfoPoint *tar = (InfoPoint *) ip; if (parameters->int0Parameter) { ! tar->Trapped|=1; } else { ! tar->Trapped&=~1; } } --- 4700,4706 ---- InfoPoint *tar = (InfoPoint *) ip; if (parameters->int0Parameter) { ! tar->Trapped|=PORTAL_CURSOR; } else { ! tar->Trapped&=~PORTAL_CURSOR; } } *************** *** 4721,4727 **** InfoPoint *tar = (InfoPoint *) ip; if (parameters->int0Parameter) { ! tar->Trapped|=2; } else { ! tar->Trapped&=~2; } } --- 4724,4730 ---- InfoPoint *tar = (InfoPoint *) ip; if (parameters->int0Parameter) { ! tar->Trapped|=PORTAL_TRAVEL; } else { ! tar->Trapped&=~PORTAL_TRAVEL; } } *************** *** 5008,5011 **** --- 5011,5033 ---- } + void GameScript::RunFollow(Scriptable* Sender, Action* parameters) + { + if (Sender->Type!=ST_ACTOR) { + return; + } + + Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); + if (!tar || tar->Type!=ST_ACTOR) { + return; + } + Actor *scr = (Actor *)Sender; + Actor *actor = (Actor *)tar; + scr->LastFollowed = actor->GetID(); + scr->FollowOffset.x = -1; + scr->FollowOffset.y = -1; + scr->WalkTo(actor->Pos, IF_RUNNING, 1); + Sender->ReleaseCurrentAction(); + } + void GameScript::ProtectPoint(Scriptable* Sender, Action* parameters) { *************** *** 5014,5018 **** } Actor *scr = (Actor *)Sender; ! scr->WalkTo( parameters->pointParameter, 0, 0 ); Sender->ReleaseCurrentAction(); } --- 5036,5040 ---- } Actor *scr = (Actor *)Sender; ! scr->WalkTo( parameters->pointParameter, 0, 1 ); Sender->ReleaseCurrentAction(); } *************** *** 5057,5060 **** --- 5079,5084 ---- ieDword pos = parameters->int1Parameter; scr->FollowOffset = gc->GetFormationOffset(formation, pos); + scr->WalkTo( tar->Pos, 0, 1 ); + Sender->ReleaseCurrentAction(); } *************** *** 5121,5130 **** void GameScript::EnableFogDither(Scriptable* /*Sender*/, Action* /*parameters*/) { ! core->FogOfWar|=1; } void GameScript::DisableFogDither(Scriptable* /*Sender*/, Action* /*parameters*/) { ! core->FogOfWar&=~1; } --- 5145,5197 ---- void GameScript::EnableFogDither(Scriptable* /*Sender*/, Action* /*parameters*/) { ! core->FogOfWar|=FOG_DRAWFOG; } void GameScript::DisableFogDither(Scriptable* /*Sender*/, Action* /*parameters*/) { ! core->FogOfWar&=~FOG_DRAWFOG; } + void DeleteAllSpriteCovers() + { + Game *game = core->GetGame(); + int i = game->GetPartySize(false); + while (i--) { + Selectable *tar = (Selectable *) game->GetPC(i, false); + tar->SetSpriteCover(NULL); + } + } + + void GameScript::EnableSpriteDither(Scriptable* /*Sender*/, Action* /*parameters*/) + { + core->FogOfWar&=~FOG_DITHERSPRITES; + DeleteAllSpriteCovers(); + } + + void GameScript::DisableSpriteDither(Scriptable* /*Sender*/, Action* /*parameters*/) + { + core->FogOfWar|=~FOG_DITHERSPRITES; + DeleteAllSpriteCovers(); + } + + //the PST crew apparently loved hardcoding stuff + ieResRef RebusResRef={"DABUS1"}; + + void GameScript::FloatRebus(Scriptable* Sender, Action* parameters) + { + Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); + if (!tar || tar->Type!=ST_ACTOR) { + return; + } + Actor *actor = (Actor *)tar; + RebusResRef[5]=(char) core->Roll(1,5,'0'); + ScriptedAnimation *vvc = core->GetScriptedAnimation(RebusResRef); + if (vvc) { + //setting the height + vvc->ZPos=actor->size*20; + vvc->PlayOnce(); + //maybe this needs setting up some time + vvc->SetDefaultDuration(20); + actor->AddVVCell(vvc); + } + } Index: GameScript.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.h,v retrieving revision 1.267 retrieving revision 1.268 diff -C2 -d -r1.267 -r1.268 *** GameScript.h 9 Feb 2007 21:12:26 -0000 1.267 --- GameScript.h 10 Feb 2007 14:29:23 -0000 1.268 *************** *** 782,785 **** --- 782,786 ---- static int InternalGT(Scriptable* Sender, Trigger* parameters); static int InternalLT(Scriptable* Sender, Trigger* parameters); + static int InTrap(Scriptable* Sender, Trigger* parameters); static int InventoryFull(Scriptable* Sender, Trigger* parameter); static int InWeaponRange(Scriptable* Sender, Trigger* parameter); *************** *** 1026,1029 **** --- 1027,1031 ---- static void DialogueInterrupt(Scriptable* Sender, Action* parameters); static void DisableFogDither(Scriptable* Sender, Action* parameters); + static void DisableSpriteDither(Scriptable* Sender, Action* parameters); static void DisplayMessage(Scriptable* Sender, Action* parameters); static void DisplayString(Scriptable* Sender, Action* parameters); *************** *** 1038,1041 **** --- 1040,1044 ---- static void EnableFogDither(Scriptable* Sender, Action* parameters); static void EnablePortalTravel(Scriptable* Sender, Action* parameters); + static void EnableSpriteDither(Scriptable* Sender, Action* parameters); static void EndCredits(Scriptable* Sender, Action* parameters); static void EndCutSceneMode(Scriptable* Sender, Action* parameters); *************** *** 1062,1065 **** --- 1065,1069 ---- static void FloatMessageFixedRnd(Scriptable* Sender, Action* parameters); static void FloatMessageRnd(Scriptable* Sender, Action* parameters); + static void FloatRebus(Scriptable* Sender, Action* parameters); static void Follow(Scriptable* Sender, Action* parameters); static void FollowCreature(Scriptable* Sender, Action* parameters); *************** *** 1209,1212 **** --- 1213,1217 ---- static void RunAwayFrom(Scriptable* Sender, Action* parameters); static void RunAwayFromNoInterrupt(Scriptable* Sender, Action* parameters); + static void RunFollow(Scriptable* Sender, Action* parameters); static void RunningAttack(Scriptable* Sender, Action* parameters); static void RunningAttackNoSound(Scriptable* Sender, Action* parameters); Index: MapControl.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/MapControl.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** MapControl.cpp 9 Dec 2006 15:00:26 -0000 1.42 --- MapControl.cpp 10 Feb 2007 14:29:23 -0000 1.43 *************** *** 90,94 **** MyMap = core->GetGame()->GetCurrentArea(); MapMOS = MyMap->SmallMap->GetImage(); ! if (core->FogOfWar&1) DrawFog(); } --- 90,94 ---- MyMap = core->GetGame()->GetCurrentArea(); MapMOS = MyMap->SmallMap->GetImage(); ! if (core->FogOfWar&FOG_DRAWFOG) DrawFog(); } Index: Map.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Map.cpp,v retrieving revision 1.262 retrieving revision 1.263 diff -C2 -d -r1.262 -r1.263 *** Map.cpp 14 Jan 2007 19:06:58 -0000 1.262 --- Map.cpp 10 Feb 2007 14:29:23 -0000 1.263 *************** *** 477,484 **** int y=SearchMap->GetHeight(); while(y--) { ! int x=SearchMap->GetWidth(); ! while(x--) { ! SearchMap->SetPixelIndex(x,y,Passable[SearchMap->GetPixelIndex(x,y)&PATH_MAP_AREAMASK]); ! } } } --- 477,484 ---- int y=SearchMap->GetHeight(); while(y--) { ! int x=SearchMap->GetWidth(); ! while(x--) { ! SearchMap->SetPixelIndex(x,y,Passable[SearchMap->GetPixelIndex(x,y)&PATH_MAP_AREAMASK]); ! } } } *************** *** 705,709 **** Actor* actor = queue[PR_SCRIPT][q]; if (ip->Type == ST_PROXIMITY) { ! ip->Entered(actor); } else { //ST_TRAVEL --- 705,712 ---- Actor* actor = queue[PR_SCRIPT][q]; if (ip->Type == ST_PROXIMITY) { ! if(ip->Entered(actor)) { ! //if trap triggered, then mark actor ! actor->SetInTrap(ipCount); ! } } else { //ST_TRAVEL *************** *** 944,951 **** } ! if ((core->FogOfWar&2) && SearchMap) { DrawSearchMap(screen); } else { ! if ((core->FogOfWar&1) && TMap) { TMap->DrawFogOfWar( ExploredBitmap, VisibleBitmap, screen ); } --- 947,954 ---- } ! if ((core->FogOfWar&FOG_DRAWSEARCHMAP) && SearchMap) { DrawSearchMap(screen); } else { ! if ((core->FogOfWar&FOG_DRAWFOG) && TMap) { TMap->DrawFogOfWar( ExploredBitmap, VisibleBitmap, screen ); } *************** *** 1253,1257 **** while (i--) { Actor* actor = actors[i]; ! if (strnicmp( actor->Dialog, resref, 8 ) == 0) { return actor; } --- 1256,1260 ---- while (i--) { Actor* actor = actors[i]; ! if (strnicmp( actor->GetDialog(false), resref, 8 ) == 0) { return actor; } *************** *** 2029,2036 **** } //stepping back on the calculated path ! while (MinDistance-- && StartNode->Parent) { ! StartNode = StartNode->Parent; ! delete StartNode->Next; ! StartNode->Next = NULL; } return Return; --- 2032,2049 ---- } //stepping back on the calculated path ! if (MinDistance) { ! while (StartNode->Parent) { ! Point tar; ! ! tar.x=StartNode->Parent->x*16; ! tar.y=StartNode->Parent->y*12; ! int dist = Distance(tar,d); ! if (dist>=MinDistance) { ! break; ! } ! StartNode = StartNode->Parent; ! delete StartNode->Next; ! StartNode->Next = NULL; ! } } return Return; *************** *** 2317,2321 **** void Map::UpdateFog() { ! if (!(core->FogOfWar&1) ) { SetMapVisibility( -1 ); return; --- 2330,2334 ---- void Map::UpdateFog() { ! if (!(core->FogOfWar&FOG_DRAWFOG) ) { SetMapVisibility( -1 ); return; *************** *** 2565,2568 **** --- 2578,2593 ---- } + //remove flags from actor if it has left the trigger area it had last entered + void Map::ClearTrap(Actor *actor, ieDword InTrap) + { + InfoPoint *trap = TMap->GetInfoPoint(InTrap); + if (!trap) { + actor->SetInTrap(0); + } else { + if(!trap->outline->PointIn(actor->Pos)) { + actor->SetInTrap(0); + } + } + } ////////////////////AreaAnimation////////////////// //Area animation Index: Map.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Map.h,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** Map.h 9 Jan 2007 23:05:29 -0000 1.123 --- Map.h 10 Feb 2007 14:29:23 -0000 1.124 *************** *** 392,395 **** --- 392,396 ---- bool HasWeather(); int GetWeather(); + void ClearTrap(Actor *actor, ieDword InTrap); private: Index: Triggers.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Triggers.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Triggers.cpp 8 Feb 2007 22:10:10 -0000 1.62 --- Triggers.cpp 10 Feb 2007 14:29:24 -0000 1.63 *************** *** 322,325 **** --- 322,337 ---- } + int GameScript::InTrap(Scriptable* Sender, Trigger* parameters) + { + Scriptable* scr = GetActorFromObject( Sender, parameters->objectParameter ); + if (!scr) { + return 0; + } + if (scr->GetInternalFlag()&IF_INTRAP) { + return 1; + } + return 0; + } + int GameScript::School(Scriptable* Sender, Trigger* parameters) { *************** *** 2018,2022 **** } Actor* actor = ( Actor* ) tar; ! return actor->GetStat(IE_STATE_ID) & parameters->int0Parameter; } --- 2030,2037 ---- } Actor* actor = ( Actor* ) tar; ! if (actor->GetStat(IE_STATE_ID) & parameters->int0Parameter) { ! return 1; ! } ! return 0; } *************** *** 2028,2032 **** } Actor* actor = ( Actor* ) tar; ! return actor->GetStat(IE_EXTSTATE_ID) & parameters->int0Parameter; } --- 2043,2050 ---- } Actor* actor = ( Actor* ) tar; ! if (actor->GetStat(IE_EXTSTATE_ID) & parameters->int0Parameter) { ! return 1; ! } ! return 0; } *************** *** 2038,2042 **** } Actor* actor = ( Actor* ) tar; ! return actor->GetStat(IE_STATE_ID) & ~parameters->int0Parameter; } --- 2056,2063 ---- } Actor* actor = ( Actor* ) tar; ! if (actor->GetStat(IE_STATE_ID) & ~parameters->int0Parameter) { ! return 1; ! } ! return 0; } Index: Interface.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Interface.cpp,v retrieving revision 1.457 retrieving revision 1.458 diff -C2 -d -r1.457 -r1.458 *** Interface.cpp 9 Feb 2007 21:12:26 -0000 1.457 --- Interface.cpp 10 Feb 2007 14:29:23 -0000 1.458 *************** *** 4035,4039 **** { unsigned int speaker_color; ! char *name; switch (speaker->Type) { --- 4035,4039 ---- { unsigned int speaker_color; ! const char *name; switch (speaker->Type) { *************** *** 4043,4046 **** --- 4043,4050 ---- speaker_color = (ActorColor[4].r<<16) | (ActorColor[4].g<<8) | ActorColor[4].b; break; + case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: + name = GetString( ((InfoPoint *) speaker)->DialogName ); + speaker_color = 0xc0c0c0; + break; default: name = ""; *************** *** 4063,4068 **** { unsigned int attacker_color; ! char *name1; ! char *name2; switch (attacker->Type) { --- 4067,4072 ---- { unsigned int attacker_color; ! const char *name1; ! const char *name2; switch (attacker->Type) { *************** *** 4100,4104 **** { unsigned int speaker_color; ! char *name; switch (speaker->Type) { --- 4104,4108 ---- { unsigned int speaker_color; ! const char *name; switch (speaker->Type) { *************** *** 4107,4111 **** GetPalette( ((Actor *) speaker)->GetStat(IE_MAJOR_COLOR),8, ActorColor ); speaker_color = (ActorColor[4].r<<16) | (ActorColor[4].g<<8) | ActorColor[4].b; ! break; default: name = ""; --- 4111,4119 ---- GetPalette( ((Actor *) speaker)->GetStat(IE_MAJOR_COLOR),8, ActorColor ); speaker_color = (ActorColor[4].r<<16) | (ActorColor[4].g<<8) | ActorColor[4].b; ! break; ! case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: ! name = GetString( ((InfoPoint *) speaker)->DialogName ); ! speaker_color = 0xc0c0c0; ! break; default: name = ""; *************** *** 4115,4119 **** char* text = GetString( stridx, flags); - int newlen = (int)(strlen( DisplayFormatName ) + strlen( name ) + + strlen( text ) + 10); --- 4123,4126 ---- Index: Actor.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.h,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** Actor.h 8 Feb 2007 22:56:56 -0000 1.142 --- Actor.h 10 Feb 2007 14:29:23 -0000 1.143 *************** *** 114,118 **** ieDword Modified[MAX_STATS]; PCStatsStruct* PCStats; - ieResRef Dialog; ieResRef SmallPortrait; ieResRef LargePortrait; --- 114,117 ---- *************** *** 182,186 **** int attackcount; //when the next attack is scheduled (gametime+initiative) ! ieDword initiative; /** paint the actor itself. Called internally by Draw() */ --- 181,186 ---- int attackcount; //when the next attack is scheduled (gametime+initiative) ! ieDword initiative; ! ieDword InTrap; /** paint the actor itself. Called internally by Draw() */ *************** *** 244,247 **** --- 244,248 ---- } /** Sets the Dialog ResRef */ + /* void SetDialog(const char* ResRef) { *************** *** 252,255 **** --- 253,257 ---- printf("Setting Dialog for %s: %.8s\n",LongName, Dialog); } + */ /** Sets the Icon ResRef */ //Which - 0 both, 1 Large, 2 Small *************** *** 279,283 **** char* GetName(int which) const { ! if(which==-1) which=!TalkCount; if (which) { return LongName; --- 281,285 ---- char* GetName(int which) const { ! if(which==-1) which=TalkCount; if (which) { return LongName; *************** *** 331,335 **** void GetSpellSlotInfo(SpellExtHeader *spell, int which); /* updates quickslots */ ! void ReinitQuickSlots(); private: /* checks a weapon quick slot and resets it to fist if it is empty */ --- 333,341 ---- void GetSpellSlotInfo(SpellExtHeader *spell, int which); /* updates quickslots */ ! void ReinitQuickSlots(); ! /* actor is in trap */ ! void SetInTrap(ieDword tmp); ! /* sets some of the internal flags */ ! void SetRunFlags(ieDword flags); private: /* checks a weapon quick slot and resets it to fist if it is empty */ Index: Interface.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Interface.h,v retrieving revision 1.220 retrieving revision 1.221 diff -C2 -d -r1.220 -r1.221 *** Interface.h 9 Feb 2007 21:12:26 -0000 1.220 --- Interface.h 10 Feb 2007 14:29:23 -0000 1.221 *************** *** 202,205 **** --- 202,211 ---- #define SLOT_EFFECT_LEFT 6 //shield (left hand) slot + + //fog of war bits + #define FOG_DRAWFOG 1 + #define FOG_DRAWSEARCHMAP 2 + #define FOG_DITHERSPRITES 4 + /** * @class Interface Index: ActorBlock.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/ActorBlock.h,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** ActorBlock.h 4 Feb 2007 14:22:05 -0000 1.118 --- ActorBlock.h 10 Feb 2007 14:29:23 -0000 1.119 *************** *** 59,63 **** #define SCR_GENERAL 6 #define SCR_DEFAULT 7 ! //trigger flags #define TRAP_INVISIBLE 1 --- 59,66 ---- #define SCR_GENERAL 6 #define SCR_DEFAULT 7 ! ! //pst trap flags (portal) ! #define PORTAL_CURSOR 1 ! #define PORTAL_TRAVEL 2 //trigger flags #define TRAP_INVISIBLE 1 *************** *** 113,117 **** #define IF_VISIBLE 0x4000 #define IF_ONCREATION 0x8000 ! #define IF_IDLE 0x10000 //the actor should stop attacking #define IF_STOPATTACK (IF_JUSTDIED|IF_REALLYDIED|IF_CLEANUP|IF_IDLE) --- 116,122 ---- #define IF_VISIBLE 0x4000 #define IF_ONCREATION 0x8000 ! #define IF_IDLE 0x10000 ! #define IF_INTRAP 0x20000 //actor is currently in a trap (intrap trigger event) ! //the actor should stop attacking #define IF_STOPATTACK (IF_JUSTDIED|IF_REALLYDIED|IF_CLEANUP|IF_IDLE) *************** *** 168,175 **** ieDword InternalFlags; //for triggers Scriptable* CutSceneId; public: Variables* locals; ScriptableType Type; ! Point Pos; GameScript* Scripts[MAX_SCRIPTS]; char* overHeadText; --- 173,182 ---- ieDword InternalFlags; //for triggers Scriptable* CutSceneId; + ieResRef Dialog; public: Variables* locals; ScriptableType Type; ! Point Pos; ! ieStrRef DialogName; GameScript* Scripts[MAX_SCRIPTS]; char* overHeadText; *************** *** 185,188 **** --- 192,203 ---- unsigned long playDeadCounter; public: + /** Gets the Dialog ResRef */ + const char* GetDialog(void) const + { + return Dialog; + } + void SetDialog(const char *resref) { + strnuprcpy(Dialog, resref, 8); + } void SetScript(ieResRef aScript, int idx); void SetWait(unsigned long time); *************** *** 266,270 **** ieDword Cursor; bool Highlight; - ieResRef DialogResRef; Point TrapLaunch; ieResRef KeyResRef; --- 281,284 ---- *************** *** 273,281 **** void DrawOutline(); void SetCursor(unsigned char CursorIndex); - /** Gets the Dialog ResRef */ - const char* GetDialog(void) const - { - return DialogResRef; - } const char* GetKey(void) const { --- 287,290 ---- *************** *** 494,498 **** //overheadtext contains the string, but we have to save this ieStrRef StrRef; ! Point UsePoint; }; --- 503,508 ---- //overheadtext contains the string, but we have to save this ieStrRef StrRef; ! Point UsePoint; ! Point TalkPos; }; Index: ActorBlock.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/ActorBlock.cpp,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** ActorBlock.cpp 4 Feb 2007 14:22:05 -0000 1.161 --- ActorBlock.cpp 10 Feb 2007 14:29:23 -0000 1.162 *************** *** 570,573 **** --- 570,577 ---- int Selectable::WantDither() { + //if dithering is disabled globally, don't do it + if (core->FogOfWar&4) { + return 0; + } //if actor is dead, dither it if polygon wants if (Selected&0x80) { *************** *** 1197,1201 **** TrapLaunch.x = 0; TrapLaunch.y = 0; ! DialogResRef[0] = 0; } --- 1201,1206 ---- TrapLaunch.x = 0; TrapLaunch.y = 0; ! Dialog[0] = 0; ! DialogName = 0; } *************** *** 1290,1294 **** { if (outline->PointIn( actor->Pos ) ) { ! goto check; } if (Distance(Pos, actor->Pos)<MAX_OPERATING_DISTANCE) { --- 1295,1302 ---- { if (outline->PointIn( actor->Pos ) ) { ! //don't trigger again for this actor ! if (!(actor->GetInternalFlag()&IF_INTRAP)) { ! goto check; ! } } if (Distance(Pos, actor->Pos)<MAX_OPERATING_DISTANCE) { *************** *** 1335,1339 **** name = Scripts[0]->GetName(); } ! printf( "Script: %s, Key: %s, Dialog: %s\n", name, KeyResRef, DialogResRef ); printf( "Active: %s\n", YESNO(InternalFlags&IF_ACTIVE)); } --- 1343,1347 ---- name = Scripts[0]->GetName(); } ! printf( "Script: %s, Key: %s, Dialog: %s\n", name, KeyResRef, Dialog ); printf( "Active: %s\n", YESNO(InternalFlags&IF_ACTIVE)); } Index: GameControl.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameControl.h,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** GameControl.h 8 Feb 2007 22:56:56 -0000 1.91 --- GameControl.h 10 Feb 2007 14:29:23 -0000 1.92 *************** *** 158,165 **** Dialog* dlg; public: - //Actor* speaker; - //Actor* target; ieWord speakerID; ! ieWord targetID; public: Actor *GetTarget(); --- 158,165 ---- Dialog* dlg; public: ieWord speakerID; ! ieWord targetID; ! //no idea if this is viable ! Scriptable *targetOB; public: Actor *GetTarget(); *************** *** 177,181 **** Point GetFormationOffset(ieDword formation, ieDword pos); void MoveToPointFormation(Actor *actor, Point p, int Orient); ! void InitDialog(Actor* speaker, Actor* target, const char* dlgref); void EndDialog(bool try_to_break=false); void DialogChoose(unsigned int choose); --- 177,181 ---- Point GetFormationOffset(ieDword formation, ieDword pos); void MoveToPointFormation(Actor *actor, Point p, int Orient); ! void InitDialog(Scriptable* speaker, Scriptable* target, const char* dlgref); void EndDialog(bool try_to_break=false); void DialogChoose(unsigned int choose); |