From c3075c8e5b6489494875bd382d311883855fc794 Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Tue, 13 Sep 2011 22:51:43 +0000 Subject: [PATCH] Fixes AI building angles to face bottom right corner of the map. Cleans up the same concept in random maps. This was SVN commit r10275. --- .../mods/public/maps/random/cantabrian_highlands.js | 6 ++++-- binaries/data/mods/public/maps/random/islands.js | 11 +++++------ binaries/data/mods/public/maps/random/latium.js | 6 ++++-- .../mods/public/maps/random/neareastern_badlands.js | 6 ++++-- binaries/data/mods/public/maps/random/new_rms_test.js | 6 ++++-- .../mods/public/simulation/ai/jubot/plan-building.js | 5 ++--- .../public/simulation/ai/testbot/plan-building.js | 4 ++-- 7 files changed, 25 insertions(+), 19 deletions(-) diff --git a/binaries/data/mods/public/maps/random/cantabrian_highlands.js b/binaries/data/mods/public/maps/random/cantabrian_highlands.js index dfc045ef0a..5696d47839 100644 --- a/binaries/data/mods/public/maps/random/cantabrian_highlands.js +++ b/binaries/data/mods/public/maps/random/cantabrian_highlands.js @@ -46,6 +46,8 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml"; const pForestD = [tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest + TERRAIN_SEPARATOR + oOakLarge, tGrassDForest]; const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oPine, tGrassPForest + TERRAIN_SEPARATOR + oAleppoPine, tGrassPForest]; +const BUILDING_ANGlE = 0.75*PI; + // initialize map log("Initializing map..."); @@ -137,14 +139,14 @@ for (var i = 0; i < numPlayers; i++) // create the TC var group = new SimpleGroup( // elements (type, min/max count, min/max distance, min/max angle) - [new SimpleObject(civEntities[0].Template, 1,1, 0,0, 0.75*PI, 0.75*PI)], + [new SimpleObject(civEntities[0].Template, 1,1, 0,0, BUILDING_ANGlE, BUILDING_ANGlE)], true, null, ix, iz ); createObjectGroup(group, i+1); // create starting units var uDist = 8; - var uAngle = -0.75*PI + randFloat(-PI/8, PI/8); + var uAngle = -BUILDING_ANGlE + randFloat(-PI/8, PI/8); for (var j = 1; j < civEntities.length; ++j) { var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); diff --git a/binaries/data/mods/public/maps/random/islands.js b/binaries/data/mods/public/maps/random/islands.js index eea6570166..2ec445de5f 100644 --- a/binaries/data/mods/public/maps/random/islands.js +++ b/binaries/data/mods/public/maps/random/islands.js @@ -69,6 +69,9 @@ var pPalmForest = [tForestFloor+TERRAIN_SEPARATOR+oPalm, tGrass]; var pPineForest = [tForestFloor+TERRAIN_SEPARATOR+oPine, tGrass]; var pPoplarForest = [tForestFloor+TERRAIN_SEPARATOR+oLombardyPoplar, tGrass]; var pMainForest = [tForestFloor+TERRAIN_SEPARATOR+oCarob, tForestFloor+TERRAIN_SEPARATOR+oBeech, tGrass, tGrass]; + +const BUILDING_ANGlE = 0.75*PI; + // initialize map log("Initializing map..."); @@ -270,19 +273,15 @@ if((numPlayers>=6)||(i==startingPlaces[numPlayers-1][nPlayer])){ var civEntities = getStartingEntities(nPlayer); // create the TC - var angletemple = 1.5*PI-islandAngle[i]; - angletemple = 0.75*PI; - //angletemple = (angletemple<0)?angletemple+2*PI:angletemple; var group = new SimpleGroup( // elements (type, min/max count, min/max distance) - [new SimpleObject(civEntities[0].Template, 1,1, 0,0, angletemple, angletemple)], + [new SimpleObject(civEntities[0].Template, 1,1, 0,0, BUILDING_ANGlE, BUILDING_ANGlE)], true, null, ix, iz ); createObjectGroup(group, nPlayer+1); // create starting units var uDist = 8; - var uAngle = islandAngle[i] + PI + randFloat(-PI/8, PI/8); - + var uAngle = -BUILDING_ANGlE + randFloat(-PI/8, PI/8); for (var j = 1; j < civEntities.length; ++j) { var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); diff --git a/binaries/data/mods/public/maps/random/latium.js b/binaries/data/mods/public/maps/random/latium.js index 53c7dfe8e2..b945deac86 100644 --- a/binaries/data/mods/public/maps/random/latium.js +++ b/binaries/data/mods/public/maps/random/latium.js @@ -63,6 +63,8 @@ var pPineForest = [tForestFloor+TERRAIN_SEPARATOR+oPine, tGrass]; var pPoplarForest = [tForestFloor+TERRAIN_SEPARATOR+oLombardyPoplar, tGrass]; var pMainForest = [tForestFloor+TERRAIN_SEPARATOR+oCarob, tForestFloor+TERRAIN_SEPARATOR+oBeech, tGrass, tGrass]; +const BUILDING_ANGlE = 0.75*PI; + // initialize map log("Initializing map..."); @@ -418,14 +420,14 @@ for (var i = 1; i <= numPlayers; i++) // create the TC var group = new SimpleGroup( // elements (type, min/max count, min/max distance, min/max angle) - [new SimpleObject(civEntities[0].Template, 1,1, 0,0, 0.75*PI, 0.75*PI)], + [new SimpleObject(civEntities[0].Template, 1,1, 0,0, BUILDING_ANGlE, BUILDING_ANGlE)], true, null, ix, iz ); createObjectGroup(group, i); // create starting units var uDist = 8; - var uAngle = -0.75*PI + randFloat(-PI/8, PI/8); + var uAngle = -BUILDING_ANGlE + randFloat(-PI/8, PI/8); for (var j = 1; j < civEntities.length; ++j) { var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); diff --git a/binaries/data/mods/public/maps/random/neareastern_badlands.js b/binaries/data/mods/public/maps/random/neareastern_badlands.js index fdb046815c..ddc15330ed 100644 --- a/binaries/data/mods/public/maps/random/neareastern_badlands.js +++ b/binaries/data/mods/public/maps/random/neareastern_badlands.js @@ -43,6 +43,8 @@ const aDecorativeRock = "actor|geology/stone_desert_med.xml"; var pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor]; var pForestOasis = [tGrass + TERRAIN_SEPARATOR + oDatePalm, tGrass + TERRAIN_SEPARATOR + oSDatePalm, tGrass]; +const BUILDING_ANGlE = 0.75*PI; + // initialize map log("Initializing map..."); @@ -112,14 +114,14 @@ for (var i = 0; i < numPlayers; i++) // create the TC var group = new SimpleGroup( // elements (type, min/max count, min/max distance, min/max angle) - [new SimpleObject(civEntities[0].Template, 1,1, 0,0, 0.75*PI, 0.75*PI)], + [new SimpleObject(civEntities[0].Template, 1,1, 0,0, BUILDING_ANGlE, BUILDING_ANGlE)], true, null, ix, iz ); createObjectGroup(group, i+1); // create starting units var uDist = 8; - var uAngle = -0.75*PI + randFloat(-PI/8, PI/8); + var uAngle = -BUILDING_ANGlE + randFloat(-PI/8, PI/8); for (var j = 1; j < civEntities.length; ++j) { var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); diff --git a/binaries/data/mods/public/maps/random/new_rms_test.js b/binaries/data/mods/public/maps/random/new_rms_test.js index f4f926dd6f..ef60dbc02c 100644 --- a/binaries/data/mods/public/maps/random/new_rms_test.js +++ b/binaries/data/mods/public/maps/random/new_rms_test.js @@ -1,5 +1,7 @@ RMS.LoadLibrary("rmgen"); +const BUILDING_ANGlE = 0.75*PI; + // initialize map log("Initializing map..."); @@ -49,14 +51,14 @@ for (var i=0; i < numPlayers; i++) // create the TC var group = new SimpleGroup( // elements (type, min/max count, min/max distance, min/max angle) - [new SimpleObject(civEntities[0].Template, 1,1, 0,0, 0.75*PI, 0.75*PI)], + [new SimpleObject(civEntities[0].Template, 1,1, 0,0, BUILDING_ANGlE, BUILDING_ANGlE)], true, null, ix, iz ); createObjectGroup(group, i+1); // create starting units var uDist = 8; - var uAngle = -0.75*PI + randFloat(-PI/8, PI/8); + var uAngle = -BUILDING_ANGlE + randFloat(-PI/8, PI/8); for (var j = 1; j < civEntities.length; ++j) { var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1); diff --git a/binaries/data/mods/public/simulation/ai/jubot/plan-building.js b/binaries/data/mods/public/simulation/ai/jubot/plan-building.js index 11a10bf099..440a19519a 100644 --- a/binaries/data/mods/public/simulation/ai/jubot/plan-building.js +++ b/binaries/data/mods/public/simulation/ai/jubot/plan-building.js @@ -208,9 +208,8 @@ var BuildingConstructionPlan = Class({ // Engine.DumpImage("tiles1.png", obstructionTiles, map.width, map.height, 32); // Engine.DumpImage("tiles2.png", friendlyTiles, map.width, map.height, 256); - // Randomise the angle a little, to look less artificial - //var angle = Math.PI + (Math.random()*2-1) * Math.PI/24; - var angle = Math.PI + (Math.PI / 4); + // Fixed angle to match fixed starting cam + var angle = 0.75*Math.PI; return { "x": x, diff --git a/binaries/data/mods/public/simulation/ai/testbot/plan-building.js b/binaries/data/mods/public/simulation/ai/testbot/plan-building.js index 8784e6557f..86440a02a5 100644 --- a/binaries/data/mods/public/simulation/ai/testbot/plan-building.js +++ b/binaries/data/mods/public/simulation/ai/testbot/plan-building.js @@ -184,8 +184,8 @@ var BuildingConstructionPlan = Class({ // Engine.DumpImage("tiles1.png", obstructionTiles, map.width, map.height, 32); // Engine.DumpImage("tiles2.png", friendlyTiles, map.width, map.height, 256); - // Randomise the angle a little, to look less artificial - var angle = Math.PI + (Math.random()*2-1) * Math.PI/24; + // Fixed angle to match fixed starting cam + var angle = 0.75*Math.PI; return { "x": x,