virtual void activate(size_t index) {}
};
-/*
-class vehicle : virtual public gameobject {
-public:
- virtual void vehicle_move() {};
-};
-*/
class loaded_object : virtual public gameobject {
public:
};
+class vehicle : virtual public block_object {
+public:
+ virtual void vehicle_move() {};
+};
+
class wall_block : public loaded_object, public block_object {
public:
wall_block(const char* of, const char* tf, glm::vec3 s) : loaded_object(of, tf, s) {
#define INIT(x)
#endif
-
/* Player globals */
EXTERN glm::vec3 player_position;
EXTERN float player_heading;
EXTERN gameobject *player_platform INIT(0);
EXTERN size_t player_platform_index INIT(0);
EXTERN struct key_status player_key_status;
-
-
-#include "vehicle.h"
-EXTERN flying_carpet *current_vehicle INIT(0);
+EXTERN vehicle *current_vehicle INIT(0);
EXTERN size_t vehicle_index INIT(0);
#include "geometric_objects.h"
#include "hud.h"
#include "door.h"
+#include "vehicle.h"
std::mutex grand_mutex;
objects.push_back(&spawned_blocks);
flying_carpet fc;
- fc.locations.push_back(glm::vec3(30, -5, 450));
+ fc.addpanel(glm::vec3(30, -5, 450), glm::vec2(3.0, 3.0), glm::vec2(1, 1));
objects.push_back(&fc);
/* Initialize game objects */
#include "game.h"
+#include "vehicle.h"
void flying_carpet::vehicle_move() {
- glm::vec3 step_to_point = player_position;
+ glm::vec3 step_to_point = locations[0];
if(player_key_status.forward){
- step_to_point += 0.5f * glm::vec3(sinf(player_heading), 0, cosf(player_heading));
+ step_to_point += 0.5f * glm::vec3(sinf(player_heading), sinf(player_elevation), cosf(player_heading));
}
if(player_key_status.backward){
- step_to_point += 0.5f * glm::vec3(-sinf(player_heading), 0, -cosf(player_heading));
+ step_to_point += 0.5f * glm::vec3(-sinf(player_heading), -sinf(player_elevation), -cosf(player_heading));
}
if(player_key_status.left){
step_to_point += 0.5f * glm::vec3(sinf(player_heading + M_PI/2), 0, cosf(player_heading + M_PI/2));
step_to_point += 0.5f * glm::vec3(-sinf(player_heading + M_PI/2), 0, -cosf(player_heading + M_PI/2));
}
locations[vehicle_index] = step_to_point;
- player_position = step_to_point;
+ player_position = glm::vec3(step_to_point.x, step_to_point.y + 3.0f, step_to_point.z);
+ ups[0] = glm::rotate(glm::mat4(1.0f), player_heading, glm::vec3(0, 1, 0)) * glm::vec4(0, 0, 1, 1);
}
void flying_carpet::activate(size_t index) {
current_vehicle = this;
vehicle_index = index;
+ player_position = locations[0] + glm::vec3(0, 3, 0);
}
#include "geometric_objects.h"
-class flying_carpet : virtual public flat_panel {
+class flying_carpet : virtual public vehicle, virtual public flat_panel {
public:
flying_carpet() : flat_panel("brick.jpg") {
size = glm::vec3(10, 1, 10);