MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RefuelPlayer

Function RefuelPlayer

Descent3/object.cpp:3029–3056  ·  view source on GitHub ↗

Give the player fuel. Called when the player is in an energy center

Source from the content-addressed store, hash-verified

3027
3028// Give the player fuel. Called when the player is in an energy center
3029void RefuelPlayer(object *objp) {
3030 float max, amount;
3031
3032 ASSERT(objp->type == OBJ_PLAYER);
3033 ASSERT(Rooms[objp->roomnum].flags & RF_FUELCEN);
3034
3035 max = INITIAL_ENERGY - Players[objp->id].energy;
3036 amount = FUELCEN_GIVE_RATE * Frametime;
3037
3038 if (amount > max)
3039 amount = max;
3040
3041 if ((amount > 0)) {
3042 Players[objp->id].energy += amount;
3043
3044 Sound_system.Play3dSound(SOUND_REFUELING, SND_PRIORITY_HIGH, objp);
3045
3046 ain_hear hear;
3047 hear.f_directly_player = true;
3048 hear.hostile_level = 0.01f;
3049 hear.curiosity_level = 1.0f;
3050 hear.max_dist = Sounds[SOUND_REFUELING].max_distance;
3051 AINotify(objp, AIN_HEAR_NOISE, (void *)&hear);
3052
3053 // if (Game_mode & GM_MULTI)
3054 // multi_send_play_sound(SOUND_REFUEL_STATION_GIVING_FUEL, F1_0/2);
3055 }
3056}
3057
3058// Clears the secret flag in the specified room, and recursively, all connected rooms
3059void ClearSecretFlags(room *rp) {

Callers 1

DoSpecialPlayerStuffFunction · 0.85

Calls 2

AINotifyFunction · 0.85
Play3dSoundMethod · 0.80

Tested by

no test coverage detected