static int config_debug_opengl = 0;
/* render improvements */
static int config_improve_extend_roads = 1; /* set to 1 to extend roads */
+static int config_improve_smooth_planets = 1; /* set to 1 to rotate planets smoothly */
#define CPU_SPEED 7093790.0;
frame_render = 0;
/* start capturing for improved graphics */
if (render_improved)
- render_capture_start(config_fov, config_improve_extend_roads, config_debug_transparent);
+ render_capture_start(config_fov, config_improve_extend_roads, config_improve_smooth_planets, config_debug_transparent);
/* execute until the rendered image is ready (wait for VBL) */
cycle_count = 0;
uint32_t mercenary_object_vertex_register(void);
void mercenary_get_orientation(double *roll, double *pitch, double *yaw);
void mercenary_get_orientation_raw(int16_t *pitch, uint16_t *yaw);
-void mercenary_get_orientation_planet(double *inclination, double *azimuth);
+void mercenary_get_orientation_planet(double *inclination, double *azimuth, int improved);
void mercenary_get_location(int32_t *east, int32_t *height, int32_t *north);
void mercenary_get_object_info(int *id, int32_t *east, int32_t *height, int32_t *north);
void mercenary_coord_building_interior(int16_t *east, int32_t *height1, int32_t *height2, int32_t *height3, int32_t *height4, int16_t *north);
*yaw = m68k_read_memory_16(0x007AA2);
}
-void mercenary_get_orientation_planet(double *inclination, double *azimuth)
+void mercenary_get_orientation_planet(double *inclination, double *azimuth, int improved)
{
- int16_t r;
+ uint32_t t;
+
+ if (!improved) {
+ /* get plant's inclination and azimuth */
+ t = m68k_read_memory_16(0x42C70) & 0x3ff;
+ *inclination = (double)t / 0x400 * 2 * M_PI;
+ t = m68k_read_memory_16(0x42C6c) & 0x3ff;
+ *azimuth = -(double)t / 0x400 * 2 * M_PI;
+ } else {
+ /* inclination depends on north/south position */
+ t = m68k_read_memory_32(0x007ABA) >> 2; /* get position */
+ t += 0x01000000;
+ t &= 0x03ffffff;
+ *inclination = (double)t / 0x04000000 * 2 * M_PI;
+ /* azimuth depends on east/west position and planet's rotation */
+ t = m68k_read_memory_32(0x007AA6); /* get planet index */
+ t = m68k_read_memory_32(25322 + t); /* get rotation of planet */
+ t += m68k_read_memory_32(0x007AB2) >> 2; /* add position */
+ t &= 0x03ffffff;
+ *azimuth = -(double)t / 0x04000000 * 2 * M_PI;
- /* get plant's inclination and rotation */
- r = (int16_t)((m68k_read_memory_16(0x42C70)) & 0x3ff);
- *inclination = (double)r / 1024.0 * 2 * M_PI;
- r = (int16_t)((m68k_read_memory_16(0x42C6c)) & 0x3ff);
- *azimuth = -(double)r / 1024.0 * 2 * M_PI;
+ }
}
void mercenary_get_location(int32_t *east, int32_t *height, int32_t *north)
*yaw = m68k_read_memory_16(DS_0+0x1E2a);
}
-void mercenary_get_orientation_planet(double *inclination, double *azimuth)
+void mercenary_get_orientation_planet(double *inclination, double *azimuth, int improved)
{
- int16_t r;
+ uint32_t t;
+
+ if (!improved) {
+ /* get plant's inclination and azimuth */
+ t = m68k_read_memory_16(0x42C70) & 0x3ff;
+ *inclination = (double)t / 0x400 * 2 * M_PI;
+ t = m68k_read_memory_16(0x42C6c) & 0x3ff;
+ *azimuth = -(double)t / 0x400 * 2 * M_PI;
+ } else {
+ /* inclination depends on north/south position */
+ t = m68k_read_memory_32(DS_0+0x1E42) >> 2; /* get position */
+ t += 0x01000000;
+ t &= 0x03ffffff;
+ *inclination = (double)t / 0x04000000 * 2 * M_PI;
+ /* azimuth depends on east/west position and planet's rotation */
+ t = m68k_read_memory_32(DS_0+0x1E2E); /* get planet index */
+ t = m68k_read_memory_32(22362 + t); /* get rotation of planet */
+ t += m68k_read_memory_32(DS_0+0x1E3A) >> 2; /* add position */
+ t &= 0x03ffffff;
+ *azimuth = -(double)t / 0x04000000 * 2 * M_PI;
- /* get plant's inclination and rotation */
- r = (int16_t)((m68k_read_memory_16(0x42C70)) & 0x3ff);
- *inclination = (double)r / 1024.0 * 2 * M_PI;
- r = (int16_t)((m68k_read_memory_16(0x42C6c)) & 0x3ff);
- *azimuth = -(double)r / 1024.0 * 2 * M_PI;
+ }
}
void mercenary_get_location(int32_t *east, int32_t *height, int32_t *north)
}
/* rendering starts, initialize variables */
-void render_capture_start(double _fov, int _extend_roads, int debug)
+void render_capture_start(double _fov, int _extend_roads, int _smooth_planets, int debug)
{
#if defined(DEBUG_COLOR) || defined(DEBUG_VERTEX)
printf("start rendering a new frame...\n");
mercenary_get_orientation(&motion_new.orientation_roll, &motion_new.orientation_pitch, &motion_new.orientation_yaw);
mercenary_get_orientation_raw(&motion_new.orientation_raw_pitch, &motion_new.orientation_raw_yaw);
motion_new.planet_rotation = motion_old.planet_rotation;
- mercenary_get_orientation_planet(&motion_new.planet_inclination, &motion_new.planet_azimuth);
+ mercenary_get_orientation_planet(&motion_new.planet_inclination, &motion_new.planet_azimuth, _smooth_planets);
render_item_object_info = NULL;
render_item_vertices_0 = render_item_vertices_1 = render_item_vertices_2 = NULL;
-void render_capture_start(double _fov, int _extend_roads, int debug);
+void render_capture_start(double _fov, int _extend_roads, int _smooth_planets, int debug);
void render_capture_stop(void);
void render_capture_event(int event);
int render_all_items(double inter, int vr);