X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FObjects%2FObjects.cpp;h=c12334288f4756aed3bcd8043d8f366c4ee81156;hb=b9dfb15156a7af6710511b5dee1b272173946d2d;hp=4b97666a18aebacf5b4ade0beaad1df0b1f4efb1;hpb=5dfd07829a5eecc87d100dd8825a81eafbaa86be;p=lugaru.git diff --git a/Source/Objects/Objects.cpp b/Source/Objects/Objects.cpp index 4b97666..c123342 100644 --- a/Source/Objects/Objects.cpp +++ b/Source/Objects/Objects.cpp @@ -523,95 +523,6 @@ void Objects::DeleteObject(int which) numobjects--; } -void Objects::MakeObject(int atype, XYZ where, float ayaw, float ascale) -{ - if ((atype != treeleavestype && atype != bushtype) || foliage == 1) { - scale[numobjects] = ascale; - if (atype == treeleavestype) - scale[numobjects] += fabs((float)(Random() % 100) / 900) * ascale; - - onfire[numobjects] = 0; - flamedelay[numobjects] = 0; - type[numobjects] = atype; - - if (atype == firetype) - onfire[numobjects] = 1; - - position[numobjects] = where; - if (atype == bushtype) - position[numobjects].y = terrain.getHeight(position[numobjects].x, position[numobjects].z) - .3; - yaw[numobjects] = ayaw; - - rotxvel[numobjects] = 0; - rotyvel[numobjects] = 0; - rotx[numobjects] = 0; - roty[numobjects] = 0; - - if (atype == boxtype) model[numobjects].loaddecal("Models/Box.solid", 0); - if (atype == cooltype) model[numobjects].loaddecal("Models/Cool.solid", 0); - if (atype == walltype) model[numobjects].loaddecal("Models/Wall.solid", 0); - if (atype == tunneltype) model[numobjects].loaddecal("Models/Tunnel.solid", 0); - if (atype == chimneytype) model[numobjects].loaddecal("Models/Chimney.solid", 0); - if (atype == spiketype) model[numobjects].load("Models/Spike.solid", 0); - if (atype == weirdtype) model[numobjects].loaddecal("Models/Weird.solid", 0); - if (atype == rocktype) model[numobjects].loaddecal("Models/Rock.solid", 0); - if (atype == treetrunktype) model[numobjects].load("Models/TreeTrunk.solid", 0); - if (atype == treeleavestype) model[numobjects].load("Models/Leaves.solid", 0); - if (atype == bushtype) model[numobjects].load("Models/Bush.solid", 0); - - if (atype == boxtype) friction[numobjects] = 1.5; - if (atype == cooltype) friction[numobjects] = 1.5; - if (atype == walltype) friction[numobjects] = 1.5; - if (atype == platformtype) friction[numobjects] = 1.5; - if (atype == tunneltype) friction[numobjects] = 1.5; - if (atype == chimneytype) friction[numobjects] = 1.5; - if (atype == rocktype) friction[numobjects] = .5; - if (atype == rocktype && ascale>.5) friction[numobjects] = 1.5; - if (atype == weirdtype) friction[numobjects] = 1.5; - if (atype == spiketype) friction[numobjects] = .4; - if (atype == treetrunktype) friction[numobjects] = .4; - if (atype == treeleavestype) friction[numobjects] = 0; - - if (atype == platformtype) { - model[numobjects].loaddecal("Models/Platform.solid", 0); - model[numobjects].Rotate(90, 0, 0); - } - - if (type[numobjects] == boxtype || type[numobjects] == cooltype || type[numobjects] == spiketype || type[numobjects] == weirdtype || type[numobjects] == walltype || type[numobjects] == chimneytype || type[numobjects] == tunneltype || type[numobjects] == platformtype) { - model[numobjects].ScaleTexCoords(scale[numobjects] * 1.5); - } - if (type[numobjects] == rocktype) { - model[numobjects].ScaleTexCoords(scale[numobjects] * 3); - } - model[numobjects].flat = 1; - if (atype == treetrunktype || atype == treeleavestype || atype == rocktype) { - model[numobjects].flat = 0; - } - model[numobjects].Scale(.3 * scale[numobjects], .3 * scale[numobjects], .3 * scale[numobjects]); - model[numobjects].Rotate(90, 1, 1); - if (type[numobjects] == rocktype) { - model[numobjects].Rotate(ayaw * 5, 1, 1); - } - model[numobjects].CalculateNormals(1); - model[numobjects].ScaleNormals(-1, -1, -1); - - if (atype == treetrunktype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) { - if (detail == 2) - terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 2, .4, 0); - } - - if (atype == bushtype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) { - if (detail == 2) - terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 1, .4, 0); - } - - if (atype != treeleavestype && atype != bushtype && atype != firetype) - terrain.AddObject(where + DoRotation(model[numobjects].boundingspherecenter, 0, ayaw, 0), model[numobjects].boundingsphereradius, numobjects); - - numobjects++; - } -} - void Objects::MakeObject(int atype, XYZ where, float ayaw, float apitch, float ascale) { if ((atype != treeleavestype && atype != bushtype) || foliage == 1) { @@ -689,18 +600,19 @@ void Objects::MakeObject(int atype, XYZ where, float ayaw, float apitch, float a model[numobjects].CalculateNormals(1); model[numobjects].ScaleNormals(-1, -1, -1); - if (atype == treetrunktype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) { - if (detail == 2) + if (detail == 2) { + if (atype == treetrunktype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) { terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 2, .4, 0); - } + } - if (atype == bushtype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) { - if (detail == 2) + if (atype == bushtype && position[numobjects].y < terrain.getHeight(position[numobjects].x, position[numobjects].z) + 1) { terrain.MakeDecal(shadowdecalpermanent, position[numobjects], 1, .4, 0); + } } - if (atype != treeleavestype && atype != bushtype && atype != firetype) + if (atype != treeleavestype && atype != bushtype && atype != firetype) { terrain.AddObject(where + DoRotation(model[numobjects].boundingspherecenter, 0, ayaw, 0), model[numobjects].boundingsphereradius, numobjects); + } numobjects++; }