From: Laszlo T. <ave...@us...> - 2012-07-01 11:57:31
|
gemrb: Infinity Engine emulator The branch master has been updated via 6b3ababaf9130393e5fa7ce5856bdd1028627f04 (commit) via c855a84d8c51dbf1a2976f4d6e2e158c02464978 (commit) via 0f702110a3b0f6c50bca48da823e4d479ea86ef5 (commit) Summary of changes: gemrb/core/GameScript/GSUtils.cpp | 9 +++- gemrb/core/Map.cpp | 68 +++++++++++++++-------------- gemrb/core/Map.h | 8 ++-- gemrb/core/Scriptable/Actor.cpp | 4 +- gemrb/core/Scriptable/Actor.h | 2 +- gemrb/plugins/OpenALAudio/OpenALAudio.cpp | 18 ++++++++ 6 files changed, 67 insertions(+), 42 deletions(-) from 56625e65142cf082980ffc9af69bc895b357028b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=6b3ababaf9130393e5fa7ce5856bdd1028627f04 commit 6b3ababaf9130393e5fa7ce5856bdd1028627f04 Merge: c855a84 56625e6 Author: Avenger <ave...@so...> Date: Sun Jul 1 13:57:14 2012 +0200 Merge branch 'master' of ssh://gemrb.git.sourceforge.net/gitroot/gemrb/gemrb http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=c855a84d8c51dbf1a2976f4d6e2e158c02464978 commit c855a84d8c51dbf1a2976f4d6e2e158c02464978 Author: Avenger <ave...@so...> Date: Sun Jul 1 13:56:10 2012 +0200 list openal devices in case of failed init diff --git a/gemrb/plugins/OpenALAudio/OpenALAudio.cpp b/gemrb/plugins/OpenALAudio/OpenALAudio.cpp index 057a2cf..c020136 100644 --- a/gemrb/plugins/OpenALAudio/OpenALAudio.cpp +++ b/gemrb/plugins/OpenALAudio/OpenALAudio.cpp @@ -152,6 +152,23 @@ OpenALAudioDriver::OpenALAudioDriver(void) ambim = NULL; } +void OpenALAudioDriver::PrintDeviceList () +{ + char *deviceList; + + if (alcIsExtensionPresent(NULL, (ALchar*)"ALC_ENUMERATION_EXT") == AL_TRUE) { // try out enumeration extension + Log(MESSAGE, "OpenAL", "Usable audio output devices:"); + deviceList = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); + + while(deviceList && *deviceList) { + Log(MESSAGE,"OpenAL", "Devices: %s", deviceList); + deviceList+=strlen(deviceList)+1; + } + return; + } + Log(MESSAGE, "OpenAL", "No device enumeration present."); +} + bool OpenALAudioDriver::Init(void) { ALCdevice *device; @@ -160,6 +177,7 @@ bool OpenALAudioDriver::Init(void) device = alcOpenDevice (NULL); if (device == NULL) { showALCError("Failed to open device", ERROR, device); + PrintDeviceList(); return false; } http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=0f702110a3b0f6c50bca48da823e4d479ea86ef5 commit 0f702110a3b0f6c50bca48da823e4d479ea86ef5 Author: Avenger <ave...@so...> Date: Sun Jul 1 13:54:28 2012 +0200 fixed createcreatureoffscreen diff --git a/gemrb/core/GameScript/GSUtils.cpp b/gemrb/core/GameScript/GSUtils.cpp index a54fd02..93c9b91 100644 --- a/gemrb/core/GameScript/GSUtils.cpp +++ b/gemrb/core/GameScript/GSUtils.cpp @@ -704,7 +704,11 @@ void CreateCreatureCore(Scriptable* Sender, Action* parameters, int flags) case CC_OFFSCREEN: { Region vp = core->GetVideoDriver()->GetViewport(); - radius=vp.w/2; //actually it must be further divided by the tile size, hmm 16? + radius=vp.w/2; + //center of screen + pnt.x = vp.x+radius; + pnt.y = vp.y+vp.h/2; + break; } //falling through case CC_OBJECT://use object + offset @@ -726,7 +730,8 @@ void CreateCreatureCore(Scriptable* Sender, Action* parameters, int flags) Map *map = Sender->GetCurrentArea(); map->AddActor( ab, true ); - ab->SetPosition( pnt, flags&CC_CHECK_IMPASSABLE, radius ); + //radius adjusted to tile size + ab->SetPosition( pnt, flags&CC_CHECK_IMPASSABLE, radius/16, radius/12 ); ab->SetOrientation(parameters->int0Parameter, false ); //if string1 is animation, then we can't use it for a DV too diff --git a/gemrb/core/Map.cpp b/gemrb/core/Map.cpp index d7100c3..044978b 100644 --- a/gemrb/core/Map.cpp +++ b/gemrb/core/Map.cpp @@ -2270,27 +2270,27 @@ void Map::SetupNode(unsigned int x, unsigned int y, unsigned int size, unsigned InternalStack.push( ( x << 16 ) | y ); } -bool Map::AdjustPositionX(Point &goal, unsigned int radius) +bool Map::AdjustPositionX(Point &goal, unsigned int radiusx, unsigned int radiusy) { unsigned int minx = 0; - if ((unsigned int) goal.x > radius) - minx = goal.x - radius; - unsigned int maxx = goal.x + radius + 1; + if ((unsigned int) goal.x > radiusx) + minx = goal.x - radiusx; + unsigned int maxx = goal.x + radiusx + 1; if (maxx > Width) maxx = Width; for (unsigned int scanx = minx; scanx < maxx; scanx++) { - if ((unsigned int) goal.y >= radius) { - if (GetBlocked( scanx, goal.y - radius ) & PATH_MAP_PASSABLE) { + if ((unsigned int) goal.y >= radiusy) { + if (GetBlocked( scanx, goal.y - radiusy ) & PATH_MAP_PASSABLE) { goal.x = (ieWord) scanx; - goal.y = (ieWord) (goal.y - radius); + goal.y = (ieWord) (goal.y - radiusy); return true; } } - if (goal.y + radius < Height) { - if (GetBlocked( scanx, goal.y + radius ) & PATH_MAP_PASSABLE) { + if (goal.y + radiusy < Height) { + if (GetBlocked( scanx, goal.y + radiusy ) & PATH_MAP_PASSABLE) { goal.x = (ieWord) scanx; - goal.y = (ieWord) (goal.y + radius); + goal.y = (ieWord) (goal.y + radiusy); return true; } } @@ -2298,25 +2298,25 @@ bool Map::AdjustPositionX(Point &goal, unsigned int radius) return false; } -bool Map::AdjustPositionY(Point &goal, unsigned int radius) +bool Map::AdjustPositionY(Point &goal, unsigned int radiusx, unsigned int radiusy) { unsigned int miny = 0; - if ((unsigned int) goal.y > radius) - miny = goal.y - radius; - unsigned int maxy = goal.y + radius + 1; + if ((unsigned int) goal.y > radiusy) + miny = goal.y - radiusy; + unsigned int maxy = goal.y + radiusy + 1; if (maxy > Height) maxy = Height; for (unsigned int scany = miny; scany < maxy; scany++) { - if ((unsigned int) goal.x >= radius) { - if (GetBlocked( goal.x - radius, scany ) & PATH_MAP_PASSABLE) { - goal.x = (ieWord) (goal.x - radius); + if ((unsigned int) goal.x >= radiusx) { + if (GetBlocked( goal.x - radiusx, scany ) & PATH_MAP_PASSABLE) { + goal.x = (ieWord) (goal.x - radiusx); goal.y = (ieWord) scany; return true; } } - if (goal.x + radius < Width) { - if (GetBlocked( goal.x + radius, scany ) & PATH_MAP_PASSABLE) { - goal.x = (ieWord) (goal.x + radius); + if (goal.x + radiusx < Width) { + if (GetBlocked( goal.x + radiusx, scany ) & PATH_MAP_PASSABLE) { + goal.x = (ieWord) (goal.x + radiusx); goal.y = (ieWord) scany; return true; } @@ -2325,12 +2325,8 @@ bool Map::AdjustPositionY(Point &goal, unsigned int radius) return false; } -void Map::AdjustPosition(Point &goal, unsigned int radius) +void Map::AdjustPosition(Point &goal, unsigned int radiusx, unsigned int radiusy) { - unsigned int maxr = Width; - if (maxr < Height) { - maxr = Height; - } if ((unsigned int) goal.x > Width) { goal.x = (ieWord) Width; } @@ -2338,23 +2334,29 @@ void Map::AdjustPosition(Point &goal, unsigned int radius) goal.y = (ieWord) Height; } - for (; radius < maxr; radius++) { + while(radiusx<Width || radiusy<Height) { //lets make it slightly random where the actor will appear if (rand()&1) { - if (AdjustPositionX(goal, radius)) { + if (AdjustPositionX(goal, radiusx, radiusy)) { return; } - if (AdjustPositionY(goal, radius)) { + if (AdjustPositionY(goal, radiusy, radiusx)) { return; } } else { - if (AdjustPositionY(goal, radius)) { + if (AdjustPositionY(goal, radiusx, radiusy)) { return; } - if (AdjustPositionX(goal, radius)) { + if (AdjustPositionX(goal, radiusx, radiusy)) { return; } } + if (radiusx<Width) { + radiusx++; + } + if (radiusy<Height) { + radiusy++; + } } } @@ -2970,7 +2972,7 @@ void Map::LoadIniSpawn() INISpawn->InitSpawn(WEDResRef); } -void Map::SpawnCreature(const Point &pos, const char *CreName, int radius) +void Map::SpawnCreature(const Point &pos, const char *CreName, int radiusx, int radiusy) { SpawnGroup *sg=NULL; Actor *creature; @@ -2979,7 +2981,7 @@ void Map::SpawnCreature(const Point &pos, const char *CreName, int radius) creature = gamedata->GetCreature(CreName); if ( creature ) { AddActor(creature, true); - creature->SetPosition( pos, true, radius ); + creature->SetPosition( pos, true, radiusx, radiusy ); creature->RefreshEffects(NULL); } return; @@ -3008,7 +3010,7 @@ void Map::SpawnCreature(const Point &pos, const char *CreName, int radius) creature = gamedata->GetCreature(sg->ResRefs[count]); if ( creature ) { AddActor(creature, true); - creature->SetPosition( pos, true, radius ); + creature->SetPosition( pos, true, radiusx, radiusy ); creature->RefreshEffects(NULL); } } diff --git a/gemrb/core/Map.h b/gemrb/core/Map.h index 459d3fb..ffc1258 100644 --- a/gemrb/core/Map.h +++ b/gemrb/core/Map.h @@ -419,7 +419,7 @@ public: void UpdateFog(); //PathFinder /* Finds the nearest passable point */ - void AdjustPosition(Point &goal, unsigned int radius=0); + void AdjustPosition(Point &goal, unsigned int radiusx=0, unsigned int radiusy=0); /* Finds the path which leads the farthest from d */ PathNode* RunAway(const Point &s, const Point &d, unsigned int size, unsigned int PathLen, int flags); /* Returns true if there is no path to d */ @@ -457,7 +457,7 @@ public: /* May spawn creature(s), returns the remaining number of (unrested) hours for interrupted rest */ int Rest(const Point &pos, int hours, int day); /* Spawns creature(s) in radius of position */ - void SpawnCreature(const Point &pos, const char *CreName, int radius = 0); + void SpawnCreature(const Point &pos, const char *CreName, int radiusx = 0, int radiusy = 0); //spawns void LoadIniSpawn(); @@ -502,8 +502,8 @@ private: //actor uses travel region void UseExit(Actor *pc, InfoPoint *ip); //separated position adjustment, so their order could be randomised */ - bool AdjustPositionX(Point &goal, unsigned int radius); - bool AdjustPositionY(Point &goal, unsigned int radius); + bool AdjustPositionX(Point &goal, unsigned int radiusx, unsigned int radiusy); + bool AdjustPositionY(Point &goal, unsigned int radiusx, unsigned int radiusy); void DrawPortal(InfoPoint *ip, int enable); }; diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index 2b3d919..faf1134 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -3923,7 +3923,7 @@ void Actor::SetMap(Map *map) } } -void Actor::SetPosition(const Point &position, int jump, int radius) +void Actor::SetPosition(const Point &position, int jump, int radiusx, int radiusy) { PathTries = 0; ClearPath(); @@ -3935,7 +3935,7 @@ void Actor::SetPosition(const Point &position, int jump, int radius) Map *map = GetCurrentArea(); //clear searchmap so we won't block ourselves map->ClearSearchMapFor(this); - map->AdjustPosition( p, radius ); + map->AdjustPosition( p, radiusx, radiusy ); } if (p==q) { MoveTo( position ); diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h index 7942a22..c234d80 100644 --- a/gemrb/core/Scriptable/Actor.h +++ b/gemrb/core/Scriptable/Actor.h @@ -409,7 +409,7 @@ public: /** places the actor on the map */ void SetMap(Map *map); /** sets the actor's position, calculating with the nojump flag*/ - void SetPosition(const Point &position, int jump, int radius=0); + void SetPosition(const Point &position, int jump, int radiusx=0, int radiusy=0); /** you better use SetStat, this stuff is only for special cases*/ void SetAnimationID(unsigned int AnimID); /** returns the animations */ ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |