New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D1 emulation issues #38

Merged
merged 3 commits into from Feb 20, 2015
Jump to file or symbol
Failed to load files and symbols.
+23 −37
Diff settings

Always

Just for now

Enable D1 boss behavior in d2x build.

So we get correct boss behavior when emulating D1, and 3rd party mn2s can include D1 bosses.
  • Loading branch information...
btb committed Feb 8, 2015
commit 28bd4c1650bab8c9fd309efce0960c13b4b399d5
View
@@ -59,9 +59,11 @@ struct PHYSFS_File;
#define ROBOT_FIRE_AGITATION 94
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_I)
extern int Boss_hit_this_frame;
#elif defined(DXX_BUILD_DESCENT_II)
extern sbyte Boss_hit_this_frame;
#define BOSS_D1 1
#define BOSS_SUPER 2
#if defined(DXX_BUILD_DESCENT_II)
#define BOSS_D2 21 // Minimum D2 boss value.
#define BOSS_COOL 21
#define BOSS_WATER 22
@@ -95,7 +97,7 @@ extern fix64 Boss_cloak_start_time, Boss_cloak_end_time;
extern boss_teleport_segment_array_t Boss_teleport_segs;
extern fix64 Last_teleport_time;
extern fix Boss_cloak_duration;
extern int Boss_dying;
extern sbyte Boss_dying;
extern vms_vector Believed_player_pos;
@@ -244,7 +246,6 @@ extern fix Gate_interval;
extern fix64 Boss_dying_start_time;
extern sbyte Boss_dying_sound_playing;
extern fix64 Boss_hit_time;
// -- extern int Boss_been_hit;
// ------ John: End of variables which must be saved as part of gamesave. -----
// These globals are set by a call to find_vector_intersection, which is a slow routine,
View
@@ -160,8 +160,7 @@ fix Boss_cloak_duration = BOSS_CLOAK_DURATION;
fix64 Last_gate_time = 0;
fix Gate_interval = F1_0*6;
fix64 Boss_dying_start_time;
#if defined(DXX_BUILD_DESCENT_I)
int Boss_dying, Boss_dying_sound_playing, Boss_hit_this_frame;
sbyte Boss_dying, Boss_dying_sound_playing, Boss_hit_this_frame;
int Boss_been_hit=0;
// ------ John: End of variables which must be saved as part of gamesave. -----
@@ -195,10 +194,8 @@ int Boss_been_hit=0;
static const sbyte Super_boss_gate_list[] = {0, 1, 8, 9, 10, 11, 12, 15, 16, 18, 19, 20, 22, 0, 8, 11, 19, 20, 8, 20, 8};
#define MAX_GATE_INDEX ( sizeof(Super_boss_gate_list) / sizeof(Super_boss_gate_list[0]) )
#elif defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_II)
fix64 Boss_hit_time;
int Boss_dying;
sbyte Boss_dying_sound_playing;
// ------ John: End of variables which must be saved as part of gamesave. -----
@@ -407,9 +404,8 @@ int ai_behavior_to_mode(int behavior)
// Call every time the player starts a new ship.
void ai_init_boss_for_ship(void)
{
#if defined(DXX_BUILD_DESCENT_I)
Boss_been_hit = 0;
#elif defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_II)
Boss_hit_time = -F1_0*10;
#endif
}
@@ -518,8 +514,8 @@ void init_ai_objects(void)
init_boss_segments(Boss_gate_segs, 0, 0);
init_boss_segments(Boss_teleport_segs, 1, 0);
#if defined(DXX_BUILD_DESCENT_I)
Boss_been_hit = 0;
#if defined(DXX_BUILD_DESCENT_I)
Gate_interval = F1_0*5 - Difficulty_level*F1_0/2;
#elif defined(DXX_BUILD_DESCENT_II)
Gate_interval = F1_0*4 - Difficulty_level*i2f(2)/3;
@@ -1243,11 +1239,9 @@ player_led: ;
set_next_fire_time(obj, ailp, robptr, gun_num);
#if defined(DXX_BUILD_DESCENT_I)
// If the boss fired, allow him to teleport very soon (right after firing, cool!), pending other factors.
if (robptr->boss_flag)
if (robptr->boss_flag == BOSS_D1 || robptr->boss_flag == BOSS_SUPER)
Last_teleport_time -= Boss_teleport_interval/2;
#endif
}
// --------------------------------------------------------------------------------------------------------------------
@@ -2014,13 +2008,11 @@ objptridx_t gate_in_robot(int type, segnum_t segnum)
return create_gated_robot(segnum, type, NULL);
}
#if defined(DXX_BUILD_DESCENT_I)
static objptridx_t gate_in_robot(int type)
{
auto segnum = Boss_gate_segs[(d_rand() * Boss_gate_segs.count()) >> 15];
return gate_in_robot(type, segnum);
}
#endif
// --------------------------------------------------------------------------------------------------------------------
static int boss_fits_in_seg(const vobjptridx_t boss_objp, const vsegptridx_t segp)
@@ -2435,7 +2427,6 @@ fix Prev_boss_shields = -1;
// --------------------------------------------------------------------------------------------------------------------
// Do special stuff for a boss.
#if defined(DXX_BUILD_DESCENT_I)
static void do_boss_stuff(const vobjptridx_t objp)
{
#ifndef NDEBUG
@@ -2522,7 +2513,7 @@ static void do_super_boss_stuff(const vobjptridx_t objp, fix dist_to_player, int
}
}
#elif defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_II)
static void do_boss_stuff(const vobjptridx_t objp, int player_visibility)
{
int boss_id, boss_index;
@@ -3259,8 +3250,7 @@ void do_ai_frame(const vobjptridx_t obj)
case 0:
break;
case 1:
#if defined(DXX_BUILD_DESCENT_I)
case BOSS_D1:
if (aip->GOAL_STATE == AIS_FLIN)
aip->GOAL_STATE = AIS_FIRE;
if (aip->CURRENT_STATE == AIS_FLIN)
@@ -3270,10 +3260,7 @@ void do_ai_frame(const vobjptridx_t obj)
do_boss_stuff(obj);
dist_to_player *= 4;
break;
#endif
case 2:
// FIXME!!!!
#if defined(DXX_BUILD_DESCENT_I)
case BOSS_SUPER:
if (aip->GOAL_STATE == AIS_FLIN)
aip->GOAL_STATE = AIS_FIRE;
if (aip->CURRENT_STATE == AIS_FLIN)
@@ -3291,7 +3278,6 @@ void do_ai_frame(const vobjptridx_t obj)
do_super_boss_stuff(obj, dtp, pv);
}
#endif
break;
default:
@@ -4462,11 +4448,13 @@ int ai_save_state(PHYSFS_file *fp)
tmptime32 = -1;
}
PHYSFS_write(fp, &tmptime32, sizeof(fix), 1);
PHYSFS_write(fp, &Boss_dying, sizeof(int), 1);
int boss_dying = Boss_dying;
PHYSFS_write(fp, &boss_dying, sizeof(int), 1);
int boss_dying_sound_playing = Boss_dying_sound_playing;
PHYSFS_write(fp, &boss_dying_sound_playing, sizeof(int), 1);
#if defined(DXX_BUILD_DESCENT_I)
PHYSFS_write(fp, &Boss_hit_this_frame, sizeof(int), 1);
int boss_hit_this_frame = Boss_hit_this_frame;
PHYSFS_write(fp, &boss_hit_this_frame, sizeof(int), 1);
PHYSFS_write(fp, &Boss_been_hit, sizeof(int), 1);
#elif defined(DXX_BUILD_DESCENT_II)
if (Boss_hit_time - GameTime64 < F1_0*(-18000))
@@ -4621,7 +4609,6 @@ int ai_restore_state(PHYSFS_file *fp, int version, int swap)
#elif defined(DXX_BUILD_DESCENT_II)
tmptime32 = PHYSFSX_readSXE32(fp, swap);
Boss_hit_time = (fix64)tmptime32;
// -- MK, 10/21/95, unused! -- PHYSFS_read(fp, &Boss_been_hit, sizeof(int), 1);
if (version >= 8) {
Escort_kill_object = PHYSFSX_readSXE32(fp, swap);
View
@@ -1350,9 +1350,8 @@ int apply_damage_to_robot(const vobjptridx_t robot, fix damage, objnum_t killer_
const robot_info *robptr = &Robot_info[get_robot_id(robot)];
if (robptr->boss_flag)
#if defined(DXX_BUILD_DESCENT_I)
Boss_been_hit = 1;
#elif defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_II)
Boss_hit_time = GameTime64;
// Buddy invulnerable on level 24 so he can give you his important messages. Bah.
@@ -1578,9 +1577,8 @@ static void collide_robot_and_weapon(const vobjptridx_t robot, const vobjptridx
const robot_info *robptr = &Robot_info[get_robot_id(robot)];
if (robptr->boss_flag)
{
#if defined(DXX_BUILD_DESCENT_I)
Boss_hit_this_frame = 1;
#elif defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_II)
Boss_hit_time = GameTime64;
if (robptr->boss_flag >= BOSS_D2) {
damage_flag = do_boss_weapon_collision(robot, weapon, collision_point);
@@ -991,9 +991,8 @@ void multi_do_boss_cloak(const ubyte *buf)
Int3(); // Got boss actions for a robot who's not a boss?
return;
}
#if defined(DXX_BUILD_DESCENT_I)
Boss_hit_this_frame = 0;
#elif defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_II)
Boss_hit_time = -F1_0*10;
#endif
Boss_cloak_start_time = GameTime64;
View
@@ -55,6 +55,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "powerup.h"
#include "fuelcen.h"
#include "mission.h"
#include "ai.h"
#include "compiler-range_for.h"
#include "highest_valid.h"
@@ -166,7 +167,7 @@ static void paging_touch_robot( int robot_index )
paging_touch_weapon( Robot_info[robot_index].weapon_type );
// A super-boss can gate in robots...
if ( Robot_info[robot_index].boss_flag==2 ) {
if ( Robot_info[robot_index].boss_flag == BOSS_SUPER ) {
for (int i=0; i<13; i++ )
paging_touch_robot(super_boss_gate_type_list[i]);
ProTip! Use n and p to navigate between commits in a pull request.