From: Laszlo T. <ave...@us...> - 2007-02-13 22:37:53
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv24923/Core Modified Files: Actions.cpp Actor.cpp Actor.h GSUtils.cpp Interface.cpp Makefile.am Map.cpp Map.h Added Files: IniSpawn.cpp IniSpawn.h Log Message: added pst feature: handling spawn ini files removed needless area parameter from Actor::SetPosition Index: Actor.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.cpp,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -d -r1.258 -r1.259 *** Actor.cpp 12 Feb 2007 17:30:56 -0000 1.258 --- Actor.cpp 13 Feb 2007 22:37:49 -0000 1.259 *************** *** 1378,1382 **** } ! void Actor::SetPosition(Map *map, Point &position, int jump, int radius) { ClearPath(); --- 1378,1382 ---- } ! void Actor::SetPosition(Point &position, int jump, int radius) { ClearPath(); *************** *** 1385,1391 **** p.y = position.y/12; if (jump && !(Modified[IE_DONOTJUMP] & DNJ_FIT) && size ) { ! map->AdjustPosition( p, radius ); } - area = map; p.x = p.x * 16 + 8; p.y = p.y * 12 + 6; --- 1385,1390 ---- p.y = position.y/12; if (jump && !(Modified[IE_DONOTJUMP] & DNJ_FIT) && size ) { ! GetCurrentArea()->AdjustPosition( p, radius ); } p.x = p.x * 16 + 8; p.y = p.y * 12 + 6; Index: Actor.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.h,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** Actor.h 11 Feb 2007 21:27:17 -0000 1.144 --- Actor.h 13 Feb 2007 22:37:49 -0000 1.145 *************** *** 181,186 **** int attackcount; //when the next attack is scheduled (gametime+initiative) ! ieDword initiative; ! ieDword InTrap; /** 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() */ *************** *** 209,213 **** void SetMap(Map *map, ieWord LID, ieWord GID); /** sets the actor's position, calculating with the nojump flag*/ ! void SetPosition(Map *map, Point &position, int jump, int radius=0); /** you better use SetStat, this stuff is only for special cases*/ void SetAnimationID(unsigned int AnimID); --- 209,213 ---- void SetMap(Map *map, ieWord LID, ieWord GID); /** sets the actor's position, calculating with the nojump flag*/ ! void SetPosition(Point &position, int jump, int radius=0); /** you better use SetStat, this stuff is only for special cases*/ void SetAnimationID(unsigned int AnimID); *************** *** 243,257 **** return (localID<<16) | globalID; } - /** Sets the Dialog ResRef */ - /* - void SetDialog(const char* ResRef) - { - if (ResRef == NULL) { - return; - } - strncpy( Dialog, ResRef, 8 ); - printf("Setting Dialog for %s: %.8s\n",LongName, Dialog); - } - */ /** Sets the Icon ResRef */ //Which - 0 both, 1 Large, 2 Small --- 243,246 ---- *************** *** 333,339 **** 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); --- 322,328 ---- 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); --- NEW FILE: IniSpawn.cpp --- /* GemRB - Infinity Engine Emulator * Copyright (C) 2007 The GemRB Project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Header: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/IniSpawn.cpp,v 1.1 2007/02/13 22:37:49 avenger_teambg Exp $ * */ // This class handles the special spawn structures of planescape torment // (stored in .ini format) #include "../../includes/win32def.h" #include "IniSpawn.h" #include "Game.h" #include "Actor.h" #include "Map.h" #include "ResourceMgr.h" #include "Interface.h" #include "GSUtils.h" IniSpawn::IniSpawn(Map *owner) { map = owner; NamelessSpawnArea[0] = 0; NamelessState = 35; eventspawns = NULL; eventcount = 0; last_spawndate = 0; } IniSpawn::~IniSpawn() { if (eventspawns) { delete[] eventspawns; } } DataFileMgr *GetIniFile(ieResRef DefaultArea) { DataStream* inifile = core->GetResourceMgr()->GetResource( DefaultArea, IE_INI_CLASS_ID ); if (!inifile) { printStatus( "NOT_FOUND", LIGHT_RED ); return NULL; } if (!core->IsAvailable( IE_INI_CLASS_ID )) { printStatus( "ERROR", LIGHT_RED ); printMessage( "IniSpawn","No INI Importer Available.\n",LIGHT_RED ); return NULL; } DataFileMgr *ini = ( DataFileMgr* )core->GetInterface( IE_INI_CLASS_ID ); ini->Open(inifile, true ); //autofree return ini; } /*** initializations ***/ inline int CountElements(const char *s, char separator) { int ret = 1; while(*s) { if (*s==separator) ret++; s++; } return ret; } inline void GetElements(const char *s, ieResRef *storage, int count) { while(count--) { ieResRef *field = storage+count; strnuprcpy(*field, s, sizeof(ieResRef)-1); for(size_t i=0;i<sizeof(ieResRef);i++) { if ((*field)[i]==',') { (*field)[i]='\0'; break; } } while(*s && *s!=',') s++; s++; if (*s==' ') s++; //this is because there is one single screwed up entry in ar1100.ini } } inline void GetElements(const char *s, ieVariable *storage, int count) { while(count--) { ieVariable *field = storage+count; strnuprcpy(*field, s, sizeof(ieVariable)-1); for(size_t i=0;i<sizeof(ieVariable);i++) { if ((*field)[i]==',') { (*field)[i]='\0'; break; } } while(*s && *s!=',') s++; s++; } } void IniSpawn::ReadCreature(DataFileMgr *inifile, const char *crittername, CritterEntry &critter) { const char *s; memset(&critter,0,sizeof(critter)); s = inifile->GetKeyAsString(crittername,"spec",NULL); s = inifile->GetKeyAsString(crittername,"spec_var",NULL); if (s && (strlen(s)>9) && s[6]==':' && s[6]==':') { strnuprcpy(critter.SpecContext, s, 6); strnlwrcpy(critter.SpecVar, s+8, 32); } critter.TotalQuantity = inifile->GetKeyAsInt(crittername,"spec_qty",1); critter.SpawnCount = inifile->GetKeyAsInt(crittername,"create_qty",critter.TotalQuantity); s = inifile->GetKeyAsString(crittername,"cre_file",NULL); if (s) { critter.creaturecount = CountElements(s,','); critter.CreFile=new ieResRef[critter.creaturecount]; GetElements(s, critter.CreFile, critter.creaturecount); } s = inifile->GetKeyAsString(crittername,"point_select",NULL); int ps; if (s) { ps=s[0]; } else { ps=0; } s = inifile->GetKeyAsString(crittername,"spawn_point",NULL); if (s) { //expect more than one spawnpoint if (ps=='r') { //select one of the spawnpoints randomly int count = core->Roll(1,CountElements(s,']'),-1); //go to the selected spawnpoint while(count--) { while(*s++!=']'); } } //parse the selected spawnpoint int x,y,o; if (sscanf(s,"[%d.%d:%d]", &x, &y, &o)==3) { critter.SpawnPoint.x=(short) x; critter.SpawnPoint.y=(short) y; critter.Orientation=o; } } s = inifile->GetKeyAsString(crittername,"spawn_point_global", NULL); if (s) { switch (ps) { case 'e': critter.SpawnPoint.fromDword(CheckVariable(map, s+8,s)); break; default: SetVariable(map, s+8, s, critter.SpawnPoint.asDword()); break; } } //sometimes only the orientation is given, the point is stored in a variable critter.Orientation = inifile->GetKeyAsInt(crittername,"facing",0); s = inifile->GetKeyAsString(crittername,"script_name",NULL); if (s) { strnuprcpy(critter.ScriptName, s, 32); } s = inifile->GetKeyAsString(crittername,"script_override",NULL); if (s) { strnuprcpy(critter.OverrideScript,s, 8); } s = inifile->GetKeyAsString(crittername,"script_class",NULL); if (s) { strnuprcpy(critter.ClassScript,s, 8); } s = inifile->GetKeyAsString(crittername,"script_race",NULL); if (s) { strnuprcpy(critter.RaceScript,s, 8); } s = inifile->GetKeyAsString(crittername,"script_general",NULL); if (s) { strnuprcpy(critter.GeneralScript,s, 8); } s = inifile->GetKeyAsString(crittername,"script_default",NULL); if (s) { strnuprcpy(critter.DefaultScript,s, 8); } s = inifile->GetKeyAsString(crittername,"script_area",NULL); if (s) { strnuprcpy(critter.AreaScript,s, 8); } s = inifile->GetKeyAsString(crittername,"script_specifics",NULL); if (s) { strnuprcpy(critter.SpecificScript,s, 8); } s = inifile->GetKeyAsString(crittername,"dialog",NULL); if (s) { strnuprcpy(critter.Dialog,s, 8); } s = inifile->GetKeyAsString(crittername,"death_scriptname",NULL); if (s && atoi(s)) { critter.Flags|=CF_DEATHVAR; } s = inifile->GetKeyAsString(crittername,"ignore_no_see",NULL); if (s && atoi(s)) { critter.Flags|=CF_IGNORENOSEE; } } void IniSpawn::ReadSpawnEntry(DataFileMgr *inifile, const char *entryname, SpawnEntry &entry) { const char *s; entry.interval = (unsigned int) inifile->GetKeyAsString(entryname,"interval",0); s = inifile->GetKeyAsString(entryname,"critters",NULL); int crittercount = CountElements(s,','); entry.crittercount=crittercount; entry.critters=new CritterEntry[crittercount]; ieVariable *critters = new ieVariable[crittercount]; GetElements(s, critters, crittercount); while(crittercount--) { ReadCreature(inifile, critters[crittercount], entry.critters[crittercount]); } delete[] critters; } void IniSpawn::InitSpawn(ieResRef DefaultArea) { DataFileMgr *inifile; const char *s; inifile = GetIniFile(DefaultArea); if (!inifile) { strnuprcpy(NamelessSpawnArea, DefaultArea, 8); return; } s = inifile->GetKeyAsString("nameless","destare",DefaultArea); strnuprcpy(NamelessSpawnArea, s, 8); s = inifile->GetKeyAsString("nameless","point","[0.0]"); int x,y; if (sscanf(s,"[%d.%d]", &x, &y)!=2) { x=0; y=0; } NamelessSpawnPoint.x=x; NamelessSpawnPoint.y=y; //35 - already standing //36 - getting up NamelessState = inifile->GetKeyAsInt("nameless","state",35); s = inifile->GetKeyAsString("spawn_main","enter",NULL); if (s) { ReadSpawnEntry(inifile, s, enterspawn); } s = inifile->GetKeyAsString("spawn_main","events",NULL); if (s) { eventcount = CountElements(s,','); eventspawns = new SpawnEntry[eventcount]; ieVariable *events = new ieVariable[eventcount]; GetElements(s, events, eventcount); int ec = eventcount; while(ec--) { ReadSpawnEntry(inifile, events[ec], eventspawns[ec]); } delete[] events; } core->FreeInterface(inifile); //maybe not correct InitialSpawn(); } /*** events ***/ //respawn nameless after he bit the dust void IniSpawn::RespawnNameless() { Game *game = core->GetGame(); Actor *nameless = game->FindPC(1); nameless->Heal(0); for (int i=0;i<game->GetPartySize(false);i++) { MoveBetweenAreasCore(game->GetPC(i, false),NamelessSpawnArea,NamelessSpawnPoint,-1, true); } } void IniSpawn::SpawnCreature(CritterEntry &critter) { SetVariable(map,critter.SpecVar,critter.SpecContext,1); if (critter.ScriptName[0]) { if (map->GetActor( critter.ScriptName )) { return; } } else { //count how many actors exists there which match the 'spec' } int x = core->Roll(1,critter.creaturecount,-1); DataStream *stream = core->GetResourceMgr()->GetResource( critter.CreFile[x], IE_CRE_CLASS_ID ); if (!stream) { return; } Actor* cre = core->GetCreature(stream); if (!cre) { return; } map->AddActor(cre); cre->SetPosition( critter.SpawnPoint, 0, 0);//maybe critters could be repositioned cre->SetOrientation(critter.Orientation,false); if (critter.ScriptName[0]) { cre->SetScriptName(critter.ScriptName); } if (critter.Dialog[0]) { cre->SetDialog(critter.Dialog); } } void IniSpawn::SpawnGroup(SpawnEntry &event) { if (!event.critters) { return; } unsigned int interval = event.interval; if (interval) { if(core->GetGame()->GameTime/interval<=last_spawndate/interval) { return; } } last_spawndate=core->GetGame()->GameTime; for(int i=0;i<event.crittercount;i++) { CritterEntry* critter = event.critters+i; for(int j=0;j<critter->SpawnCount;j++) { SpawnCreature(*critter); } } } //execute the initial spawn void IniSpawn::InitialSpawn() { SpawnGroup(enterspawn); } //checks if a respawn event occurred void IniSpawn::CheckSpawn() { for(int i=0;i<eventcount;i++) { SpawnGroup(eventspawns[i]); } } Index: GSUtils.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GSUtils.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** GSUtils.cpp 10 Feb 2007 17:34:15 -0000 1.84 --- GSUtils.cpp 13 Feb 2007 22:37:49 -0000 1.85 *************** *** 651,659 **** } - printf("CreateCreature: %s at [%d.%d] face:%d\n",parameters->string0Parameter, pnt.x,pnt.y,parameters->int0Parameter); Map *map = Sender->GetCurrentArea(); - ab->SetPosition(map, pnt, flags&CC_CHECK_IMPASSABLE, radius ); - ab->SetOrientation(parameters->int0Parameter, false ); map->AddActor( ab ); //if string1 is animation, then we can't use it for a DV too --- 651,658 ---- } Map *map = Sender->GetCurrentArea(); map->AddActor( ab ); + ab->SetPosition( pnt, flags&CC_CHECK_IMPASSABLE, radius ); + ab->SetOrientation(parameters->int0Parameter, false ); //if string1 is animation, then we can't use it for a DV too *************** *** 697,703 **** if (tar) { Map *map = src->GetCurrentArea(); - tar->SetPosition(map, src->Pos, 1); - tar->SetOrientation(src->GetOrientation(), false ); map->AddActor( tar ); src->DestroySelf(); if (effect) { --- 696,702 ---- if (tar) { Map *map = src->GetCurrentArea(); map->AddActor( tar ); + tar->SetPosition(src->Pos, 1); + tar->SetOrientation(src->GetOrientation(), false ); src->DestroySelf(); if (effect) { *************** *** 991,998 **** } } ! else { ! map2=actor->GetCurrentArea(); ! } ! actor->SetPosition(map2, position, adjust); if (face !=-1) { actor->SetOrientation( face, false ); --- 990,994 ---- } } ! actor->SetPosition(position, adjust); if (face !=-1) { actor->SetOrientation( face, false ); Index: Makefile.am =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Makefile.am,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Makefile.am 6 Oct 2006 23:01:09 -0000 1.58 --- Makefile.am 13 Feb 2007 22:37:50 -0000 1.59 *************** *** 102,106 **** Projectile.cpp \ ProjectileServer.cpp \ ! Particles.cpp noinst_HEADERS = *.h --- 102,107 ---- Projectile.cpp \ ProjectileServer.cpp \ ! Particles.cpp \ ! IniSpawn.cpp noinst_HEADERS = *.h Index: Map.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Map.cpp,v retrieving revision 1.263 retrieving revision 1.264 diff -C2 -d -r1.263 -r1.264 *** Map.cpp 10 Feb 2007 14:29:23 -0000 1.263 --- Map.cpp 13 Feb 2007 22:37:50 -0000 1.264 *************** *** 361,364 **** --- 361,365 ---- queue[PR_SCRIPT] = NULL; queue[PR_DISPLAY] = NULL; + INISpawn = NULL; //no one needs this queue //queue[PR_IGNORE] = NULL; *************** *** 394,397 **** --- 395,401 ---- delete TMap; } + if (INISpawn) { + delete INISpawn; + } aniIterator aniidx; for (aniidx = animations.begin(); aniidx != animations.end(); aniidx++) { *************** *** 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 --- 709,716 ---- 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 *************** *** 2040,2044 **** int dist = Distance(tar,d); if (dist>=MinDistance) { ! break; } StartNode = StartNode->Parent; --- 2044,2048 ---- int dist = Distance(tar,d); if (dist>=MinDistance) { ! break; } StartNode = StartNode->Parent; *************** *** 2180,2183 **** --- 2184,2193 ---- } //--------spawning------------------ + void Map::LoadIniSpawn() + { + INISpawn = new IniSpawn(this); + INISpawn->InitSpawn(WEDResRef); + } + void Map::SpawnCreature(Point &pos, char *CreName, int radius) { *************** *** 2189,2194 **** creature = core->GetCreature(stream); if ( creature ) { - creature->SetPosition( this, pos, true, radius ); AddActor(creature); } return; --- 2199,2204 ---- creature = core->GetCreature(stream); if ( creature ) { AddActor(creature); + creature->SetPosition( pos, true, radius ); } return; *************** *** 2202,2207 **** creature = core->GetCreature(stream); if ( creature ) { - creature->SetPosition( this, pos, true, radius ); AddActor(creature); } } --- 2212,2217 ---- creature = core->GetCreature(stream); if ( creature ) { AddActor(creature); + creature->SetPosition( pos, true, radius ); } } Index: Map.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Map.h,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** Map.h 10 Feb 2007 14:29:23 -0000 1.124 --- Map.h 13 Feb 2007 22:37:50 -0000 1.125 *************** *** 25,30 **** #define MAP_H - #include "ActorBlock.h" #include "../../includes/globals.h" #include <queue> --- 25,31 ---- #define MAP_H #include "../../includes/globals.h" + #include "ActorBlock.h" + #include "IniSpawn.h" #include <queue> *************** *** 210,217 **** ImageMgr* HeightMap; ImageMgr* SmallMap; ieDword AreaFlags; ieWord AreaType; ieWord Rain, Snow, Fog, Lightning; - //bool ChangeArea; //set true if movement is allowed between areas ieByte* ExploredBitmap; ieByte* VisibleBitmap; --- 211,218 ---- ImageMgr* HeightMap; ImageMgr* SmallMap; + IniSpawn *INISpawn; ieDword AreaFlags; ieWord AreaType; ieWord Rain, Snow, Fog, Lightning; ieByte* ExploredBitmap; ieByte* VisibleBitmap; *************** *** 379,382 **** --- 380,384 ---- //spawns + void LoadIniSpawn(); Spawn *AddSpawn(char* Name, int XPos, int YPos, ieResRef *creatures, unsigned int count); Spawn *GetSpawn(int i) { return spawns[i]; } --- NEW FILE: IniSpawn.h --- /* GemRB - Infinity Engine Emulator * Copyright (C) 2007 The GemRB Project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Header: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/IniSpawn.h,v 1.1 2007/02/13 22:37:49 avenger_teambg Exp $ * */ /** * @file IniSpawn.h * Declares IniSpawn a class for the special creature re/spawn features * PST has. The information is originally stored in <arearesref>.ini files * @author The GemRB Project */ #ifndef INISPAWN_H #define INISPAWN_H #include "../../includes/ie_types.h" #include "Region.h" #include "DataFileMgr.h" class Map; #ifdef WIN32 #ifdef GEM_BUILD_DLL #define GEM_EXPORT __declspec(dllexport) #else #define GEM_EXPORT __declspec(dllimport) #endif #else #define GEM_EXPORT #endif /** * @struct CritterEntry */ //critter flags #define CF_IGNORENOSEE 1 #define CF_DEATHVAR 2 //spec ids flags #define AI_EA 0 #define AI_GENERAL 1 #define AI_RACE 2 #define AI_CLASS 3 #define AI_GENDER 4 #define AI_SPECIFICS 5 #define AI_ALIGNMENT 6 #define AI_FACTION 7 #define AI_TEAM 8 //spawn point could be: // s - single // r - random // e - preset // save_select_point saves the spawnpoint struct CritterEntry { int creaturecount; ieResRef *CreFile; //spawn one of these creatures ieByte Spec[9]; //existance check IDS qualifier ieVariable ScriptName; //existance check scripting name ieVariable SpecVar; //condition variable ieResRef SpecContext; //condition variable context ieResRef OverrideScript; //override override script ieResRef ClassScript; //overrride class script ieResRef RaceScript; //override race script ieResRef GeneralScript; //override general script ieResRef DefaultScript; //override default script ieResRef AreaScript; //override area script ieResRef SpecificScript; //override specific script ieResRef Dialog; //override dialog ieVariable SpawnPointVar; //spawn point saved location Point SpawnPoint; //spawn point int Orientation; //spawn orientation int Flags; //CF_IGNORENOSEE, CF_DEATHVAR int TotalQuantity; //total number int SpawnCount; //create quantity }; /** * @class SpawnEntry */ class SpawnEntry { public: ieDword interval; int crittercount; CritterEntry *critters; SpawnEntry() { interval = 0; crittercount = 0; critters = NULL; } ~SpawnEntry() { if (critters) { for (int i=0;i<crittercount;i++) { delete[] critters[i].CreFile; } delete[] critters; } } }; /** * @class Spawn * Class for the special creature re/spawn features that are unique to PST. */ class GEM_EXPORT IniSpawn { public: IniSpawn(Map *owner); ~IniSpawn(); private: Map *map; //owner ieResRef NamelessSpawnArea; Point NamelessSpawnPoint; int NamelessState; SpawnEntry enterspawn; int eventcount; int last_spawndate; SpawnEntry *eventspawns; void ReadCreature(DataFileMgr *inifile, const char *crittername, CritterEntry &critter); void ReadSpawnEntry(DataFileMgr *inifile, const char *entryname, SpawnEntry &entry); //spawns a single creature void SpawnCreature(CritterEntry &critter); void SpawnGroup(SpawnEntry &event); public: void InitSpawn(ieResRef DefaultArea); void RespawnNameless(); void InitialSpawn(); void CheckSpawn(); }; #endif // ! INISPAWN_H Index: Interface.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Interface.cpp,v retrieving revision 1.462 retrieving revision 1.463 diff -C2 -d -r1.462 -r1.463 *** Interface.cpp 12 Feb 2007 20:51:40 -0000 1.462 --- Interface.cpp 13 Feb 2007 22:37:49 -0000 1.463 *************** *** 2466,2472 **** Map *map = target->GetCurrentArea(); - - ab->SetPosition(map, position, true, 0); map->AddActor(ab); if (vvcres[0]) { ScriptedAnimation* vvc = GetScriptedAnimation(vvcres); --- 2466,2471 ---- Map *map = target->GetCurrentArea(); map->AddActor(ab); + ab->SetPosition(position, true, 0); if (vvcres[0]) { ScriptedAnimation* vvc = GetScriptedAnimation(vvcres); Index: Actions.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actions.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** Actions.cpp 11 Feb 2007 12:07:08 -0000 1.110 --- Actions.cpp 13 Feb 2007 22:37:48 -0000 1.111 *************** *** 99,103 **** } ! // this action stops modal actions, so... void GameScript::NoAction(Scriptable* Sender, Action* /*parameters*/) { --- 99,103 ---- } ! // this action stops modal actions, so... void GameScript::NoAction(Scriptable* Sender, Action* /*parameters*/) { *************** *** 437,442 **** } Actor* ab = ( Actor* ) Sender; ! Map *map = Sender->GetCurrentArea(); ! ab->SetPosition( map, parameters->pointParameter, true ); } --- 437,441 ---- } Actor* ab = ( Actor* ) Sender; ! ab->SetPosition( parameters->pointParameter, true ); } *************** *** 448,453 **** } Actor* ab = ( Actor* ) tar; ! Map *map = Sender->GetCurrentArea(); ! ab->SetPosition( map, parameters->pointParameter, true ); } --- 447,451 ---- } Actor* ab = ( Actor* ) tar; ! ab->SetPosition( parameters->pointParameter, true ); } *************** *** 465,470 **** Actor *actor = (Actor *) tar; Point p((short) actor->GetStat(IE_SAVEDXPOS), (short) actor->GetStat(IE_SAVEDYPOS) ); ! Map *map = Sender->GetCurrentArea(); ! actor->SetPosition( map, p, true ); actor->SetOrientation( actor->GetStat(IE_SAVEDFACE), false ); } --- 463,467 ---- Actor *actor = (Actor *) tar; Point p((short) actor->GetStat(IE_SAVEDXPOS), (short) actor->GetStat(IE_SAVEDYPOS) ); ! actor->SetPosition(p, true ); actor->SetOrientation( actor->GetStat(IE_SAVEDFACE), false ); } *************** *** 500,504 **** while (i--) { Actor *tar = game->GetPC(i, false); ! MoveBetweenAreasCore( tar, parameters->string1Parameter, parameters->pointParameter, -1, true); } --- 497,501 ---- while (i--) { Actor *tar = game->GetPC(i, false); ! MoveBetweenAreasCore( tar, parameters->string1Parameter, parameters->pointParameter, -1, true); } *************** *** 516,520 **** continue; } ! MoveBetweenAreasCore( tar, parameters->string1Parameter, parameters->pointParameter, -1, true); } --- 513,517 ---- continue; } ! MoveBetweenAreasCore( tar, parameters->string1Parameter, parameters->pointParameter, -1, true); } *************** *** 526,530 **** continue; } ! MoveBetweenAreasCore( tar, parameters->string1Parameter, parameters->pointParameter, -1, true); } --- 523,527 ---- continue; } ! MoveBetweenAreasCore( tar, parameters->string1Parameter, parameters->pointParameter, -1, true); } *************** *** 961,966 **** ieDword value = (ieDword) CheckVariable( Sender, parameters->string0Parameter ); p.fromDword(value); ! Map *map = Sender->GetCurrentArea(); ! actor->SetPosition( map, p, true ); } /** iwd2 returntosavedlocation (with stats) */ --- 958,962 ---- ieDword value = (ieDword) CheckVariable( Sender, parameters->string0Parameter ); p.fromDword(value); ! actor->SetPosition(p, true ); } /** iwd2 returntosavedlocation (with stats) */ *************** *** 1063,1067 **** } ! void GameScript::RestorePartyLocation(Scriptable* Sender, Action* /*parameters*/) { Game *game = core->GetGame(); --- 1059,1063 ---- } ! void GameScript::RestorePartyLocation(Scriptable* /*Sender*/, Action* /*parameters*/) { Game *game = core->GetGame(); *************** *** 1070,1078 **** if (act) { ieDword value=CheckVariable( act, "LOCALSsavedlocation"); - Map *map = Sender->GetCurrentArea(); //setting position, don't put actor on another actor Point p; p.fromDword(value); ! act->SetPosition( map, p , -1 ); } } --- 1066,1073 ---- if (act) { ieDword value=CheckVariable( act, "LOCALSsavedlocation"); //setting position, don't put actor on another actor Point p; p.fromDword(value); ! act->SetPosition(p, -1); } } *************** *** 1878,1882 **** Door* door = ( Door* ) tar; if (!door->IsOpen() ) { ! //door is already closed Sender->ReleaseCurrentAction(); return; --- 1873,1877 ---- Door* door = ( Door* ) tar; if (!door->IsOpen() ) { ! //door is already closed Sender->ReleaseCurrentAction(); return; *************** *** 2936,2940 **** default:; } ! if (inv) { inv->DestroyItem(parameters->string0Parameter,0,1); //destroy one (even indestructible?) } --- 2931,2935 ---- default:; } ! if (inv) { inv->DestroyItem(parameters->string0Parameter,0,1); //destroy one (even indestructible?) } *************** *** 3466,3470 **** //pickpocket failed trigger sent to the target and sender respectively //slot == -1 here means money ! if (slot == -1) { scr->SetBase(IE_GOLD,scr->GetBase(IE_GOLD)-money); snd->SetBase(IE_GOLD,snd->GetBase(IE_GOLD)+money); --- 3461,3465 ---- //pickpocket failed trigger sent to the target and sender respectively //slot == -1 here means money ! if (slot == -1) { scr->SetBase(IE_GOLD,scr->GetBase(IE_GOLD)-money); snd->SetBase(IE_GOLD,snd->GetBase(IE_GOLD)+money); *************** *** 4526,4530 **** Map *map = Sender->GetCurrentArea(); Spawn *spawn = map->GetSpawn(parameters->objects[1]->objectName); ! if (spawn) { spawn->Flags = 1; } --- 4521,4525 ---- Map *map = Sender->GetCurrentArea(); Spawn *spawn = map->GetSpawn(parameters->objects[1]->objectName); ! if (spawn) { spawn->Flags = 1; } *************** *** 4537,4541 **** Map *map = Sender->GetCurrentArea(); Spawn *spawn = map->GetSpawn(parameters->objects[1]->objectName); ! if (spawn) { spawn->Flags = 0; } --- 4532,4536 ---- Map *map = Sender->GetCurrentArea(); Spawn *spawn = map->GetSpawn(parameters->objects[1]->objectName); ! if (spawn) { spawn->Flags = 0; } *************** *** 4548,4552 **** Map *map = Sender->GetCurrentArea(); Spawn *spawn = map->GetSpawn(parameters->objects[1]->objectName); ! if (spawn) { spawn->Flags = 1; //??? maybe use an unconditionality flag map->TriggerSpawn(spawn); --- 4543,4547 ---- Map *map = Sender->GetCurrentArea(); Spawn *spawn = map->GetSpawn(parameters->objects[1]->objectName); ! if (spawn) { spawn->Flags = 1; //??? maybe use an unconditionality flag map->TriggerSpawn(spawn); *************** *** 5014,5028 **** 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; --- 5009,5023 ---- 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; *************** *** 5210,5214 **** return; } ! ieDword value = CheckVariable( Sender, variable, "GLOBAL" ) + 1; ! SetVariable( Sender, variable, "GLOBAL", value ); } --- 5205,5209 ---- return; } ! ieDword value = CheckVariable( Sender, variable, "GLOBAL" ) + 1; ! SetVariable( Sender, variable, "GLOBAL", value ); } |