Skip to content

Commit 78054b1

Browse files
committed
Clean up comments and finish TODOs
1 parent d5f8269 commit 78054b1

File tree

11 files changed

+14
-26
lines changed

11 files changed

+14
-26
lines changed

code/model/animation/modelanimation_driver.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ namespace animation {
9898
}
9999
}
100100

101-
// ADD PROP HERE
102101
template<typename property, property ship::* property_ptr, float property::* subproperty_ptr>
103102
static float get_ship_subproperty_float(polymodel_instance* pmi){
104103
int objnum = get_pmi_objnum(pmi);

code/model/modelread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4925,7 +4925,7 @@ void model_get_moving_submodel_list(SCP_vector<int> &submodel_vector, const obje
49254925

49264926
int model_instance_num;
49274927
int model_num;
4928-
// ADD PROP HERE
4928+
49294929
if (objp->type == OBJ_SHIP) {
49304930
model_instance_num = Ships[objp->instance].model_instance_num;
49314931
model_num = Ship_info[Ships[objp->instance].ship_info_index].model_num;

code/model/modelrender.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,6 @@ int model_render_determine_elapsed_time(int objnum, uint64_t flags)
13301330
if ( objnum >= 0 ) {
13311331
object *objp = &Objects[objnum];
13321332

1333-
// ADD PROP HERE
13341333
if ( objp->type == OBJ_SHIP ) {
13351334
return timestamp_since(Ships[objp->instance].base_texture_anim_timestamp);
13361335
}
@@ -1927,7 +1926,6 @@ void model_render_set_glow_points(const polymodel *pm, int objnum)
19271926
if ( objnum > -1 ) {
19281927
object *objp = &Objects[objnum];
19291928

1930-
// ADD PROP HERE
19311929
if ( objp != NULL && objp->type == OBJ_SHIP ) {
19321930
shipp = &Ships[Objects[objnum].instance];
19331931
sip = &Ship_info[shipp->ship_info_index];
@@ -2612,7 +2610,6 @@ void model_render_queue(const model_render_params* interp, model_draw_list* scen
26122610
objp = &Objects[objnum];
26132611
int tentative_num = -1;
26142612

2615-
// ADD PROP HERE
26162613
if (objp->type == OBJ_SHIP) {
26172614
shipp = &Ships[objp->instance];
26182615
tentative_num = shipp->model_instance_num;

code/nebula/neb.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,6 @@ float neb2_get_lod_scale(int objnum)
714714
ship *shipp;
715715
ship_info *sip;
716716

717-
// ADD PROP HERE
718-
719717
// bogus
720718
if ( (objnum < 0)
721719
|| (objnum >= MAX_OBJECTS)
@@ -1097,7 +1095,7 @@ void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
10971095
return;
10981096
}
10991097

1100-
// ADD PROP HERE
1098+
// Future TODO: Add fog_start_dist and fog_complete_dist to Props
11011099
// determine what fog index to use
11021100
if(objp->type == OBJ_SHIP) {
11031101
Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS));

code/object/collidedebrisship.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include "ship/ship.h"
2525
#include "ship/shiphit.h"
2626

27-
// Need a version of this for PROPS
28-
2927

3028
void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_info);
3129

code/object/collideshipweapon.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include "ship/shiphit.h"
3030
#include "weapon/weapon.h"
3131

32-
// Need a version of this for PROPS
33-
3432
//mc, notify_ai_shield_down, shield_collision, quadrant_num, shield_tri_hit, shield_hitpoint
3533
using ship_weapon_collision_data = std::tuple<std::optional<mc_info>, int, bool, int, int, vec3d>;
3634

code/object/objcollide.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,6 @@ int cpls_aux(vec3d *goal_pos, object *objp2, object *objp)
429429
return 0;
430430
}
431431

432-
// Maybe consider PROP here too
433-
434432
// Return true if objp will collide with some large object.
435433
// Don't check for an object this ship is docked to.
436434
int collide_predict_large_ship(object *objp, float distance)

code/object/object.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,7 @@ void obj_delete_all()
672672
obj_delete(i);
673673
}
674674

675-
// If we've removed all objects then we can safely
676-
// clear the Props vector TODO maybe remove this?
675+
// If we've removed all objects then we can safely clear the Props vector
677676
Props.clear();
678677

679678
mprintf(("Cleanup: Deleted %i objects\n", counter));
@@ -1194,7 +1193,7 @@ void obj_set_flags( object *obj, const flagset<Object::Object_Flags>& new_flags
11941193
if ( obj->type == OBJ_OBSERVER ) {
11951194
return;
11961195
}
1197-
// Maybe add PROP here
1196+
11981197
// sanity checks
11991198
if ( (obj->type != OBJ_SHIP) || (obj->instance < 0) ) {
12001199
return; // return because we really don't want to set the flag
@@ -1279,7 +1278,6 @@ void obj_move_all_pre(object *objp, float frametime)
12791278
case OBJ_RAW_POF:
12801279
break;
12811280
case OBJ_PROP:
1282-
// Handle moving submodels maybe?
12831281
break;
12841282
case OBJ_NONE:
12851283
Int3();
@@ -1544,7 +1542,6 @@ void obj_move_all_post(object *objp, float frametime)
15441542
break;
15451543

15461544
case OBJ_PROP:
1547-
// Not sure if anything will be needed here
15481545
break;
15491546

15501547
case OBJ_NONE:
@@ -1696,7 +1693,7 @@ void obj_move_all(float frametime)
16961693
// and look_at needs to happen last or the angle may be off by a frame)
16971694
model_do_intrinsic_motions(objp);
16981695

1699-
// PROP probably will need something like this
1696+
// Future TODO: Props will need a version of this when submodel animation support is added.
17001697
// For ships, we now have to make sure that all the submodel detail levels remain consistent.
17011698
if (objp->type == OBJ_SHIP)
17021699
ship_model_replicate_submodels(objp);

code/prop/prop.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,8 @@ void prop_render(object* obj, model_draw_list* scene)
798798
// Draft. Props vector uses std::optional to allow for empty slots for deleted props so the indices of the remaining
799799
// props do not change. In long FRED sessions without saving and loading, this can lead to a lot of empty slots. However,
800800
// saving and loading the level will naturally compact the props vector by way of clearing and re-adding props.
801-
void compact_props_vector()
801+
// EDIT: Now that creating props will use empty prop slots, this may not be needed. Keeping it here for posterity.
802+
/*void compact_props_vector()
802803
{
803804
SCP_vector<std::optional<prop>> new_props;
804805
SCP_unordered_map<int, int> index_remap;
@@ -823,7 +824,7 @@ void compact_props_vector()
823824
}
824825
}
825826
}
826-
}
827+
}*/
827828

828829
void props_level_init() {
829830
Props.clear();

code/scripting/api/objs/object.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "object/objcollide.h"
1919
#include "object/objectshield.h"
2020
#include "object/objectsnd.h"
21+
#include "prop/prop.h"
2122
#include "scripting/api/LuaEventCallback.h"
2223
#include "scripting/api/objs/color.h"
2324
#include "scripting/lua/LuaFunction.h"
@@ -544,7 +545,10 @@ ADE_FUNC(
544545
flags = (MC_CHECK_MODEL | MC_CHECK_RAY);
545546
break;
546547
case OBJ_PROP:
547-
// do this
548+
if (Props[obj->instance].has_value()) {
549+
model_num = Prop_info[Props[obj->instance].value().prop_info_index].model_num;
550+
flags = (MC_CHECK_MODEL | MC_CHECK_RAY);
551+
}
548552
break;
549553
default:
550554
return ADE_RETURN_NIL;
@@ -573,7 +577,7 @@ ADE_FUNC(
573577
} else if (obj->type == OBJ_ASTEROID) {
574578
model_instance_num = Asteroids[obj->instance].model_instance_num;
575579
} else if (obj->type == OBJ_PROP) {
576-
model_instance_num = -1; // YOUR MOM
580+
model_instance_num = Props[obj->instance].value().model_instance_num;
577581
}
578582

579583
mc_info hull_check;

0 commit comments

Comments
 (0)