#include "game.h" void load_level(){ /* Level Loading Area */ g.player_position = vec3(0, 100, 10); FloorPanel *floor = (FloorPanel*)add_object(new FloorPanel, "The Floor", true); floor->texture_file = "textures/stones.png"; for(int i = -90; i < 90; i+= 5) for(int j = -90; j < 90; j+= 5) floor->add_location_size(vec3(i, -2, j), vec3(5, 1, 5)); /* New Way */ WaterTank *tank = (WaterTank*)add_object(new WaterTank, "Water Tank", true); tank->object_file = "objects/cylinder.obj"; tank->texture_file = "textures/metal.jpg"; tank->add_location_size(vec3(-25, 3, -25), vec3(10, 10, 10)); /* FloorPanel *walls = new FloorPanel; if(!walls->init("objects/cube.obj", "textures/brick.jpg")){ printf("Object failed to load, giving up!\n"); return 1; } walls->add_location_size(vec3(10, 2, 0), vec3(10, 10, 10)); walls->add_location_size(vec3(10, 2, 10), vec3(10, 10, 10)); walls->add_location_size(vec3(0, 2, 0), vec3(10, 10, 10)); for(float height = 5; height > -3; height -= 1){ floor->add_location_size(vec3( -16 + height * 2, height, 0), vec3(2, 2, 2)); } VanishBlock *bridge = new VanishBlock; if(!bridge->init("objects/cube.obj", "textures/brick.jpg")){ printf("Object failed to load, giving up!\n"); return 1; } for(float zpos = 6; zpos < 32; zpos += 2){ bridge->add_location_size(vec3(0, 6, zpos), vec3(2, 2, 2)); } SlipperyBlock *sliprock = new SlipperyBlock; if(!sliprock->init("objects/cube.obj", "textures/rock.jpg")){ printf("Object failed to load, giving up!\n"); return 1; } for(float zpos = -6; zpos > -32; zpos -= 2){ sliprock->add_location_size(vec3(0, 6, zpos), vec3(20, 2, 2)); } game_objects.push_back(tank); solid_objects.push_back(tank); game_objects.push_back(sliprock); solid_objects.push_back(sliprock); game_objects.push_back(bridge); solid_objects.push_back(bridge); game_objects.push_back(floor); solid_objects.push_back(floor); game_objects.push_back(walls); solid_objects.push_back(walls); */ /* GameObject *cube = new GameObject; cube->spin_rate = 0.05f; if(!cube->init("cube.obj", "brick.jpg")) return 1; for(int i = -8; i < 8; i += 3) cube->add_location(vec3(i, 3, 0)); game_objects.push_back(cube); */ } GameObject* add_object(GameObject *new_object, string name, bool solid){ game_objects.push_back(new_object); if(solid) solid_objects.push_back((SolidObject*)new_object); /* TODO: Make sure the name is unique */ new_object->name = name; return new_object; }