Path: blob/master/src/game/behaviors/beta_holdable_object.inc.c
7861 views
/**1* Behavior for bhvBetaHoldableObject.2* This is a simple implementation of a holdable object, probably used3* for testing. This was previously assumed to be a beta shell, as there4* are unused shell models left in the game; however, there is no evidence5* to support this theory.6*/78/**9* Initialization function for bhvBetaHoldableObject.10* Just sets various physics constants for the object.11*/12void bhv_beta_holdable_object_init(void) {13o->oGravity = 2.5;14o->oFriction = 0.8;15o->oBuoyancy = 1.3;16}1718/**19* Drop the object.20*/21static void beta_holdable_object_drop(void) {22// Re-enable rendering23cur_obj_enable_rendering();2425cur_obj_get_dropped();2627o->oHeldState = HELD_FREE;2829o->oForwardVel = 0;30o->oVelY = 0;31}3233/**34* Throw the object.35*/36static void beta_holdable_object_throw(void) {37// cur_obj_enable_rendering_2 just calls cur_obj_enable_rendering and does38// nothing else; it's useless here. Maybe it originally did more?39cur_obj_enable_rendering_2();40cur_obj_enable_rendering();4142o->oHeldState = HELD_FREE;4344// This flag is never set, why is it cleared?45o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW;4647// Set initial velocity48o->oForwardVel = 40.0;49o->oVelY = 20.0;50}5152/**53* Update function for bhvBetaHoldableObject.54* Apply standard physics to the object if not held;55* otherwise, handle holding logic.56*/57void bhv_beta_holdable_object_loop(void) {58switch (o->oHeldState) {59case HELD_FREE:60// Apply standard physics61object_step();62break;6364case HELD_HELD:65// Disable rendering to hide the object while it's held66cur_obj_disable_rendering();67break;6869case HELD_THROWN:70beta_holdable_object_throw();71break;7273case HELD_DROPPED:74beta_holdable_object_drop();75break;76}77}787980