this.superweapons_finished = 0;
this.pushltime = 0;
this.istypefrag = 0;
- this.think = func_null;
+ setthink(this, func_null);
this.nextthink = 0;
this.hook_time = 0;
this.deadflag = DEAD_NO;
this.pain_frame = 0;
this.pain_finished = 0;
this.pushltime = 0;
- this.think = func_null; // players have no think function
+ setthink(this, func_null); // players have no think function
this.nextthink = 0;
this.dmg_team = 0;
this.ballistics_density = autocvar_g_ballistics_density_player;
// reset fields the weapons may use
FOREACH(Weapons, true, LAMBDA(
- it.wr_resetplayer(it);
+ it.wr_resetplayer(it, this);
// reload all reloadable weapons
if (it.spawnflags & WEP_FLAG_RELOADABLE) {
this.weapon_load[it.m_id] = it.reloading_ammo;
Unfreeze(this);
- MUTATOR_CALLHOOK(PlayerSpawn, spot);
+ MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
if (autocvar_spawn_debug)
{
}
}
-void ClientInit_misc();
+void ClientInit_misc(entity this);
.float ebouncefactor, ebouncestop; // electro's values
// TODO do we need all these fields, or should we stop autodetecting runtime
// TODO: make easier to use
Registry_send_all();
W_PROP_reload(MSG_ONE, to);
- ClientInit_misc();
+ ClientInit_misc(this);
MUTATOR_CALLHOOK(Ent_Init);
}
-void ClientInit_misc()
+void ClientInit_misc(entity this)
{
- SELFPARAM();
int channel = MSG_ONE;
WriteHeader(channel, ENT_CLIENT_INIT);
WriteByte(channel, g_nexball_meter_period * 32);
WriteCoord(channel, autocvar_g_trueaim_minrange);
}
-void ClientInit_CheckUpdate()
-{SELFPARAM();
+void ClientInit_CheckUpdate(entity this)
+{
this.nextthink = time;
if(this.count != autocvar_g_balance_armor_blockpercent)
{
}
void ClientInit_Spawn()
-{SELFPARAM();
-
+{
entity e = new_pure(clientinit);
- e.think = ClientInit_CheckUpdate;
+ setthink(e, ClientInit_CheckUpdate);
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
- WITHSELF(e, ClientInit_CheckUpdate());
+ WITHSELF(e, ClientInit_CheckUpdate(e));
}
/*
// now I am sure the player IS dead
}
-void KillIndicator_Think()
-{SELFPARAM();
+void KillIndicator_Think(entity this)
+{
if (gameover)
{
this.owner.killindicator = world;
this.killindicator.scale = 0.5;
setattachment(this.killindicator, this, "");
setorigin(this.killindicator, '0 0 52');
- this.killindicator.think = KillIndicator_Think;
+ setthink(this.killindicator, KillIndicator_Think);
this.killindicator.nextthink = starttime + (this.lip) * 0.05;
clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
this.killindicator.cnt = ceil(killtime);
e.killindicator.scale = 0.5;
setattachment(e.killindicator, e, "");
setorigin(e.killindicator, '0 0 52');
- e.killindicator.think = KillIndicator_Think;
+ setthink(e.killindicator, KillIndicator_Think);
e.killindicator.nextthink = starttime + (e.lip) * 0.05;
clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
e.killindicator.cnt = ceil(killtime);
if (!autocvar_g_campaign)
{
this.motd_actived_time = -1;
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
}
if (g_weaponarena_weapons == WEPSET(TUBA))
sv_notice_join(this);
FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
- WITHSELF(it, it.init_for_player(it));
+ it.init_for_player(it, this);
});
MUTATOR_CALLHOOK(ClientConnect, this);
if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
}
-void ChatBubbleThink()
-{SELFPARAM();
+void ChatBubbleThink(entity this)
+{
this.nextthink = time;
if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
{
this.chatbubbleentity = new(chatbubbleentity);
this.chatbubbleentity.owner = this;
this.chatbubbleentity.exteriormodeltoclient = this;
- this.chatbubbleentity.think = ChatBubbleThink;
+ setthink(this.chatbubbleentity, ChatBubbleThink);
this.chatbubbleentity.nextthink = time;
setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
//setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
} else {
if (PHYS_INPUT_BUTTON_INFO(this)) {
this.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
}
}
}
=============
*/
.float usekeypressed;
-void() nexball_setstatus;
.float last_vehiclecheck;
.int items_added;
void PlayerPreThink ()
bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
if (this.deadflag == DEAD_DYING) {
- if ((this.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max) {
+ if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max)) {
this.deadflag = DEAD_RESPAWNING;
} else if (!button_pressed) {
this.deadflag = DEAD_DEAD;
if (this.respawn_flags & RESPAWN_SILENT)
STAT(RESPAWN_TIME, this) = 0;
- else if ((this.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
- STAT(RESPAWN_TIME, this) = this.respawn_time_max;
+ else if ((this.respawn_flags & RESPAWN_FORCE) && this.respawn_time < this.respawn_time_max)
+ {
+ if (time < this.respawn_time)
+ STAT(RESPAWN_TIME, this) = this.respawn_time;
+ else if (this.deadflag != DEAD_RESPAWNING)
+ STAT(RESPAWN_TIME, this) = -this.respawn_time_max;
+ }
else
STAT(RESPAWN_TIME, this) = this.respawn_time;
}
if (frametime) player_anim();
// secret status
- secrets_setstatus();
+ secrets_setstatus(this);
// monsters status
monsters_setstatus(this);
WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, '1 0 0' * v);
}
- playerdemo_write();
+ playerdemo_write(this);
CSQCMODEL_AUTOUPDATE(this);
}