1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:53:52 +00:00

Issue #474: adjust global variable pcrace

This commit is contained in:
Marc Zinnschlag 2012-12-04 10:58:43 +01:00
parent 3db850a7d1
commit 8e1a2e3a13

View file

@ -193,7 +193,7 @@ namespace MWWorld
mRendering->attachCameraTo(mPlayer->getPlayer()); mRendering->attachCameraTo(mPlayer->getPlayer());
mPhysics->addActor(mPlayer->getPlayer()); mPhysics->addActor(mPlayer->getPlayer());
// global variables // global variables
mGlobalVariables = new Globals (mStore); mGlobalVariables = new Globals (mStore);
@ -203,6 +203,8 @@ namespace MWWorld
mGlobalVariables->setInt ("chargenstate", 1); mGlobalVariables->setInt ("chargenstate", 1);
} }
mGlobalVariables->setInt ("pcrace", 3);
mWorldScene = new Scene(*mRendering, mPhysics); mWorldScene = new Scene(*mRendering, mPhysics);
setFallbackValues(fallbackMap); setFallbackValues(fallbackMap);
@ -660,7 +662,7 @@ namespace MWWorld
{ {
MWWorld::Class::get(ptr).adjustScale(ptr,scale); MWWorld::Class::get(ptr).adjustScale(ptr,scale);
ptr.getCellRef().mScale = scale; ptr.getCellRef().mScale = scale;
if(ptr.getRefData().getBaseNode() == 0) if(ptr.getRefData().getBaseNode() == 0)
return; return;
mRendering->scaleObject(ptr, Vector3(scale,scale,scale)); mRendering->scaleObject(ptr, Vector3(scale,scale,scale));
@ -673,7 +675,7 @@ namespace MWWorld
rot.x = Ogre::Degree(x).valueRadians(); rot.x = Ogre::Degree(x).valueRadians();
rot.y = Ogre::Degree(y).valueRadians(); rot.y = Ogre::Degree(y).valueRadians();
rot.z = Ogre::Degree(z).valueRadians(); rot.z = Ogre::Degree(z).valueRadians();
float *objRot = ptr.getRefData().getPosition().rot; float *objRot = ptr.getRefData().getPosition().rot;
if(ptr.getRefData().getBaseNode() == 0 || !mRendering->rotateObject(ptr, rot, adjust)) if(ptr.getRefData().getBaseNode() == 0 || !mRendering->rotateObject(ptr, rot, adjust))
{ {
@ -781,7 +783,7 @@ namespace MWWorld
const ESM::Potion *World::createRecord (const ESM::Potion& record) const ESM::Potion *World::createRecord (const ESM::Potion& record)
{ {
return mStore.insert(record); return mStore.insert(record);
} }
const ESM::Class *World::createRecord (const ESM::Class& record) const ESM::Class *World::createRecord (const ESM::Class& record)
@ -802,7 +804,23 @@ namespace MWWorld
const ESM::NPC *World::createRecord(const ESM::NPC &record) const ESM::NPC *World::createRecord(const ESM::NPC &record)
{ {
bool update = false; bool update = false;
if (StringUtils::ciEqual(record.mId, "player")) {
if (StringUtils::ciEqual(record.mId, "player"))
{
static const char *sRaces[] =
{
"Argonian", "Breton", "Dark Elf", "High Elf", "Imperial", "Khajiit", "Nord", "Orc", "Redguard",
"Woodelf", 0
};
int i=0;
for (; sRaces[i]; ++i)
if (StringUtils::ciEqual (sRaces[i], record.mRace))
break;
mGlobalVariables->setInt ("pcrace", sRaces[i] ? i+1 : 0);
const ESM::NPC *player = const ESM::NPC *player =
mPlayer->getPlayer().get<ESM::NPC>()->mBase; mPlayer->getPlayer().get<ESM::NPC>()->mBase;
@ -834,7 +852,7 @@ namespace MWWorld
/// \todo split this function up into subfunctions /// \todo split this function up into subfunctions
mWorldScene->update (duration, paused); mWorldScene->update (duration, paused);
float pitch, yaw; float pitch, yaw;
Ogre::Vector3 eyepos; Ogre::Vector3 eyepos;
mRendering->getPlayerData(eyepos, pitch, yaw); mRendering->getPlayerData(eyepos, pitch, yaw);