Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into 335
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrus88 committed Jun 29, 2010
2 parents 8aa9348 + 198b26d commit a8018a9
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 7 deletions.
4 changes: 3 additions & 1 deletion sql/mangos.sql
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_10109_01_mangos_creature_model_info` bit(1) default NULL
`required_10119_01_mangos_creature_model_info` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -978,6 +978,8 @@ INSERT INTO `creature_model_info` VALUES
(54, 0.3470, 1.5, 1, 53),
(55, 0.3890, 1.5, 0, 56),
(56, 0.3060, 1.5, 1, 55),
(57, 0.3830, 1.5, 0, 58),
(58, 0.3830, 1.5, 1, 57),
(59, 0.9747, 1.5, 0, 60),
(60, 0.8725, 1.5, 1, 59),
(1478, 0.3060, 1.5, 0, 1479),
Expand Down
6 changes: 6 additions & 0 deletions sql/updates/10119_01_mangos_creature_model_info.sql
@@ -0,0 +1,6 @@
ALTER TABLE db_version CHANGE COLUMN required_10109_01_mangos_creature_model_info required_10119_01_mangos_creature_model_info bit;

DELETE FROM creature_model_info WHERE modelid IN (57,58);
INSERT INTO creature_model_info (modelid, bounding_radius, combat_reach, gender, modelid_other_gender) VALUES
(57, 0.3830, 1.5, 0, 58),
(58, 0.3830, 1.5, 1, 57);
2 changes: 2 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -95,6 +95,7 @@ pkgdata_DATA = \
10106_02_mangos_mangos_string.sql \
10107_01_mangos_mangos_string.sql \
10109_01_mangos_creature_model_info.sql \
10119_01_mangos_creature_model_info.sql \
README

## Additional files to include when running 'make dist'
Expand Down Expand Up @@ -170,4 +171,5 @@ EXTRA_DIST = \
10106_02_mangos_mangos_string.sql \
10107_01_mangos_mangos_string.sql \
10109_01_mangos_creature_model_info.sql \
10119_01_mangos_creature_model_info.sql \
README
13 changes: 13 additions & 0 deletions src/game/DynamicObject.cpp
Expand Up @@ -74,7 +74,20 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
SetObjectScale(DEFAULT_OBJECT_SCALE);

SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());

/* Bytes field, so it's really 4 bit fields. These flags are unknown, but we do know that 0x00000001 is set for most.
Farsight for example, does not have this flag, instead it has 0x80000002.
Flags are set dynamically with some conditions, so one spell may have different flags set, depending on those conditions.
The size of the visual may be controlled to some degree with these flags.
uint32 bytes = 0x00000000;
bytes |= 0x01;
bytes |= 0x00 << 8;
bytes |= 0x00 << 16;
bytes |= 0x00 << 24;
*/
SetUInt32Value(DYNAMICOBJECT_BYTES, 0x00000001);

SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime()); // new 2.4.0
Expand Down
3 changes: 0 additions & 3 deletions src/game/Object.cpp
Expand Up @@ -124,9 +124,6 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh )

void Object::SetObjectScale(float newScale)
{
if (newScale <= 0.0f)
newScale = DEFAULT_OBJECT_SCALE;

SetFloatValue(OBJECT_FIELD_SCALE_X, newScale);
}

Expand Down
66 changes: 66 additions & 0 deletions src/game/ObjectMgr.cpp
Expand Up @@ -1030,6 +1030,64 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}

// character races expected have model info data in table
for(uint32 race = 1; race < sChrRacesStore.GetNumRows(); ++race)
{
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race);
if (!raceEntry)
continue;

if (!((1 << (race-1)) & RACEMASK_ALL_PLAYABLE))
continue;

if (CreatureModelInfo const *minfo = GetCreatureModelInfo(raceEntry->model_f))
{
if (minfo->gender != GENDER_FEMALE)
sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u female model id %u", minfo->gender, race, raceEntry->model_f);

if (minfo->modelid_other_gender != raceEntry->model_m)
sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u female model id %u", minfo->modelid_other_gender, race, raceEntry->model_f);

if (minfo->bounding_radius <= 0.0f)
{
sLog.outErrorDb("Table `creature_model_info` have wrong bounding_radius %f for character race %u female model id %u, use %f instead", minfo->bounding_radius, race, raceEntry->model_f, DEFAULT_WORLD_OBJECT_SIZE);
const_cast<CreatureModelInfo*>(minfo)->bounding_radius = DEFAULT_WORLD_OBJECT_SIZE;
}

if (minfo->combat_reach != 1.5f)
{
sLog.outErrorDb("Table `creature_model_info` have wrong combat_reach %f for character race %u female model id %u, expected always 1.5f", minfo->combat_reach, race, raceEntry->model_f);
const_cast<CreatureModelInfo*>(minfo)->combat_reach = 1.5f;
}
}
else
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f);

if (CreatureModelInfo const *minfo = GetCreatureModelInfo(raceEntry->model_m))
{
if (minfo->gender != GENDER_MALE)
sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u male model id %u", minfo->gender, race, raceEntry->model_m);

if (minfo->modelid_other_gender != raceEntry->model_f)
sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u male model id %u", minfo->modelid_other_gender, race, raceEntry->model_m);

if (minfo->bounding_radius <= 0.0f)
{
sLog.outErrorDb("Table `creature_model_info` have wrong bounding_radius %f for character race %u male model id %u, use %f instead", minfo->bounding_radius, race, raceEntry->model_f, DEFAULT_WORLD_OBJECT_SIZE);
const_cast<CreatureModelInfo*>(minfo)->bounding_radius = DEFAULT_WORLD_OBJECT_SIZE;
}

if (minfo->combat_reach != 1.5f)
{
sLog.outErrorDb("Table `creature_model_info` have wrong combat_reach %f for character race %u male model id %u, expected always 1.5f", minfo->combat_reach, race, raceEntry->model_m);
const_cast<CreatureModelInfo*>(minfo)->combat_reach = 1.5f;
}
}
else
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m);

}

sLog.outString( ">> Loaded %u creature model based info", sCreatureModelStorage.RecordCount );
sLog.outString();
}
Expand Down Expand Up @@ -6000,6 +6058,14 @@ void ObjectMgr::LoadGameobjectInfo()
if (!goInfo)
continue;


if (goInfo->size <= 0.0f) // prevent use too small scales
{
ERROR_DB_STRICT_LOG("Gameobject (Entry: %u GoType: %u) have too small size=%f",
goInfo->id, goInfo->type, goInfo->size);
const_cast<GameObjectInfo*>(goInfo)->size = DEFAULT_OBJECT_SCALE;
}

// some GO types have unused go template, check goInfo->displayId at GO spawn data loading or ignore

switch(goInfo->type)
Expand Down
2 changes: 1 addition & 1 deletion src/game/SpellEffects.cpp
Expand Up @@ -4239,7 +4239,7 @@ void Spell::EffectAddFarsight(SpellEffectIndex eff_idx)
return;
}

// DYNAMICOBJECT_BYTES is appareltly different from the default bytes set in ::Create
// DYNAMICOBJECT_BYTES is apparently different from the default bytes set in ::Create
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002);

m_caster->AddDynObject(dynObj);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10117"
#define REVISION_NR "10121"
#endif // __REVISION_NR_H__
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
@@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_10051_01_characters_character_aura"
#define REVISION_DB_MANGOS "required_10109_01_mangos_creature_model_info"
#define REVISION_DB_MANGOS "required_10119_01_mangos_creature_model_info"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__

0 comments on commit a8018a9

Please sign in to comment.