Skip to content

Instantly share code, notes, and snippets.

@pqr
Created March 10, 2015 07:00
Show Gist options
  • Save pqr/956a3229944ec14c3cc5 to your computer and use it in GitHub Desktop.
Save pqr/956a3229944ec14c3cc5 to your computer and use it in GitHub Desktop.
NFK phisics fragment sent by raZor (looks like NOT 0.75 - there is no speedjump)
Нфк код физики 075
Писалось сами знаете когда ;) в детстве. Мне стыдно :) но сами просили...
// -----------------------------------------------------------------------------
procedure playermove(i : byte);
var Msg: TMP_IamRespawn;
Msg2: TMP_GauntletState;
Msg3: TMP_SoundData;
Msg4: TMP_049t4_ShaftEnd;
Msg5: TMP_SV_PlayerRespawn;
MsgSize : word;
e: integer;
SPEED:byte;
nwse:boolean;
begin
if players[i] = nil then exit;
if not MATCH_DDEMOPLAY then
if (players[i].health <= 0) and (players[i].dead = 0) then begin // kill prayer (ANIM ONLY). and DEAD := 2 herre;
players[i].dead := 1; players[i].frame := 0;
players[i].respawn := OPT_FORCERESPAWN*50;
if (players[i].idd = 2) and (bp_donotrespawn_bots) then
players[i].respawn := $FFFF;
players[i].gantl_state := 0;
players[i].gantl_s := 0;
if (MATCH_GAMETYPE=GAMETYPE_TRIXARENA) and (OPT_TRIXMASTA) and (MATCH_STARTSIN=0) then applyHcommand('restart');
end;
// if players[i].loadframe>0 then dec(players[i].loadframe) else players[i].loadframe:=23;
// hack.. fix a bug.
if players[i].justrespawned >50 then players[i].justrespawned:=50;
if players[i].justrespawned >0 then dec(players[i].justrespawned);
if players[i].justrespawned2>0 then dec(players[i].justrespawned2);
// rotating machinegun.
if players[i].mgfiretime > STIME then begin
if players[i].mgspeed < 30 then inc (players[i].mgspeed);
end else if players[i].mgspeed > 0 then dec (players[i].mgspeed);
if (players[i].mgnextframetime < STIME) and (players[i].mgspeed > 0) then begin
players[i].mgnextframetime := STIME + 70 - round(players[i].mgspeed * 1.5);
inc( players[i].mgframe );
if players[i].mgframe >= 6 then players[i].mgframe := 0;
end;
players[i].Location := GetPlayerLocation(I);
if players[i].netobject = true then begin
playerphysic(i);
// special timing for net. or demo player.
if players[i].shaftsttime>0 then dec(players[i].shaftsttime);
if players[i].inlava>0 then dec(players[i].inlava);
if players[i].paintime>0 then dec(players[i].paintime);
if players[i].hitsnd>0 then dec(players[i].hitsnd);
if players[i].rewardtime > 0 then dec(players[i].rewardtime);
if players[i].excellent > 0 then dec(players[i].excellent);
if players[i].gantl_s > 0 then dec(players[i].gantl_s);
if players[i].netnosignal < $FFFF then inc(players[i].netnosignal);
if players[i].netnosignal > 150 then players[i].netupdated := False; // kickin, disconnectin, droppin.
if players[i].gantl_refire > 0 then dec(players[i].gantl_refire);
if players[i].item_quad_time>0 then dec(players[i].item_quad_time);
if players[i].item_regen_time> 0 then dec(players[i].item_regen_time);
if players[i].item_battle_time> 0 then dec(players[i].item_battle_time);
if players[i].item_flight_time> 0 then dec(players[i].item_flight_time);
if players[i].item_haste > 0 then begin
if players[i].item_haste_time = 0 then begin SpawnSmoke(round(players[i].x),round(players[i].y+20)); players[i].item_haste_time := 5;
end
else dec(players[i].item_haste_time);
end;
if players[i].weapon = 0 then begin // gauntlet;
if players[i].gantl_state > 0 then
if players[i].gantl_refire = 0 then
FireGauntlet(players[i]);
if players[i].gantl_state > 0 then
if players[i].gantl_s = 0 then begin
if players[i].gauntl_s_order=0 then begin
playsound(SND_gauntl_r1,players[i].x,players[i].y);
players[i].gauntl_s_order := 1;
end else
begin
playsound(SND_gauntl_r2,players[i].x,players[i].y);
players[i].gauntl_s_order := 0;
end;
players[i].gantl_s := 12;
end;
if players[i].gantl_state > 0 then inc(players[i].gantl_state);
if players[i].gantl_state > 3 then players[i].gantl_state := 1;
end;
exit;
end;
if (MATCH_GAMEEND) then begin
playerphysic(i);
// stop players at gameend.
if (players[i].InertiaX = 0) and (players[i].InertiaX = 0) then begin
if players[i].dir = 0 then players[i].dir := 2;
if players[i].dir = 1 then players[i].dir := 3;
end;
exit;
end;
playerphysic(i);
// timing
if players[i].weapchg > 0 then dec(players[i].weapchg);
if players[i].rewardtime > 0 then dec(players[i].rewardtime);
if players[i].excellent > 0 then dec(players[i].excellent);
if players[i].refire > 0 then dec(players[i].refire);
if players[i].doublejump>0 then dec(players[i].doublejump);
if players[i].shaftsttime>0 then dec(players[i].shaftsttime);
if players[i].ammo_snd>0 then dec(players[i].ammo_snd);
if players[i].inlava>0 then dec(players[i].inlava);
if players[i].paintime>0 then dec(players[i].paintime);
if players[i].hitsnd>0 then dec(players[i].hitsnd);
if players[i].item_quad_time>0 then dec(players[i].item_quad_time);
if players[i].item_regen_time> 0 then dec(players[i].item_regen_time);
if players[i].item_battle_time> 0 then dec(players[i].item_battle_time);
if players[i].item_flight_time> 0 then dec(players[i].item_flight_time);
if players[i].gantl_s > 0 then dec(players[i].gantl_s);
if players[i].gantl_refire > 0 then dec(players[i].gantl_refire);
if not MATCH_DDEMOPLAY then begin// respawn to demo
if(players[i].dead >= 1) then
if players[i].respawn > 0 then dec(players[i].respawn);
end;
if players[i].dead > 0 then
// if players[i].ammo_mg <> 255 then
if players[i].respawn = 0 then begin
// resetplayer(players[i]);
if (ismultip=2) and ((players[i].ammo_mg < 255) or (players[i].clientrespawntimeout < gettickcount)) then begin
players[i].ammo_mg := 255; // avoid double packed send.
MsgSize := SizeOf(TMP_IamRespawn);
Msg.Data := MMP_IAMRESPAWN;
Msg.DXID := players[i].dxid;
mainform.BNETSendData2HOST(Msg, MsgSize,net_Guaranteed);
players[i].clientrespawntimeout := gettickcount + 3000; // avoid cant respawn bug.
end else
if ismultip=1 then begin
resetplayer(players[i]);
FindRespawnPoint(players[i], false); // setrespawn point here;
MsgSize := SizeOf(TMP_SV_PlayerRespawn);
Msg5.Data := MMP_PLAYERRESPAWN;
Msg5.DXID := players[i].dxid;
Msg5.x := SPAWNX;
Msg5.y := SPAWNY;
mainform.BNETSendData2All(Msg5,MsgSize,net_Guaranteed);
end else if (ismultip<>2) then begin
resetplayer(players[i]);
FindRespawnPoint(players[i],false); // setrespawn point here;
end;
end;
if players[i].dead > 0 then begin
if (((ISKEY(CTRL_FIRE) and (players[i].control=1)) or
((ISKEY(CTRL_P2FIRE)) and (players[i].control=2)))) or
((players[i].idd = 2) and (players[i].keys and BKEY_FIRE=BKEY_FIRE))
then
if players[i].respawn >= 3 then
if players[i].respawn < OPT_FORCERESPAWN*50 - OPT_MINRESPAWNTIME then begin
players[i].respawn := 2;
players[i].refire := 25;
end;
exit;
end;
if (players[i].idd <>2) then
if (INCONSOLE) or (INGAMEMENU) or (INCHATPOPUP) then begin
ClipTriggers(players[i]);
if players[i].dir < 2 then players[i].dir := players[i].dir+2;
setcrosshairpos(players[i], trunc(players[i].x),trunc(players[i].y), players[i].clippixel,true);
exit;
end;
if isparamstr('+showinput') then begin
for e := 1 to 255 do
if mainform.dxinput.Keyboard.Keys [e] then addmessage('KEY-'+chr(e)+'-'+inttostr(e));
end;
if MATCH_DDEMOPLAY then exit;
if (players[i].control = 1) then begin // up and down crosshair height; crossheight var is used as clippixel
if (OPT_P1MOUSELOOK) then begin
if OPT_MROTATED=false then begin
e := mainform.dxinput.Mouse.y;
if OPT_MINVERT then e:=-e;
end else begin
e := mainform.dxinput.Mouse.x;
if OPT_MINVERT then e:=-e;
end;
if e > 0 then begin
if OPT_MOUSESMOOTH > 0 then
if e > 0 then if e > OPT_MOUSESMOOTH then e := OPT_MOUSESMOOTH;
players[i].clippixel := players[i].clippixel + (e / (10-OPT_SENS)) + (e * OPT_MOUSEACCELDELIM/(10-OPT_SENS) / 10);
if players[i].clippixel > CROSHDIST+CROSHADD then players[i].clippixel := CROSHDIST+CROSHADD;
end;
if e < 0 then begin
if OPT_MOUSESMOOTH > 0 then
if e < 0 then if e < -OPT_MOUSESMOOTH then e := -OPT_MOUSESMOOTH;
players[i].clippixel := players[i].clippixel + (e / (10-OPT_SENS)) + (e * OPT_MOUSEACCELDELIM/(10-OPT_SENS) / 10);
if players[i].clippixel < -CROSHDIST-CROSHADD then players[i].clippixel := -CROSHDIST-CROSHADD;
end;
end;
// if (not (OPT_P1MOUSELOOK)) OR (NOT((ISKEY(CTRL_LOOKUP) and ISKEY(CTRL_LOOKDOWN)) then
// if not ) then
if not (OPT_P1MOUSELOOK) THEN
IF NOT (ISKEY(CTRL_LOOKUP) and ISKEY(CTRL_LOOKDOWN)) THEN
begin
if OPT_P1KEYBACCELDELIM > 0 then begin
if ISKEY(CTRL_LOOKUP) then begin players[i].clippixel := players[i].clippixel - (OPT_SENS+pkeyaccel div (10-OPT_P1KEYBACCELDELIM)); if pkeyaccel1 = 1 then inc(pkeyaccel) else pkeyaccel := 0; pkeyaccel1 := 1;end else
if ISKEY(CTRL_LOOKDOWN) then begin players[i].clippixel := players[i].clippixel + (OPT_SENS+pkeyaccel div (10-OPT_P1KEYBACCELDELIM)); if pkeyaccel1 = 0 then inc(pkeyaccel) else pkeyaccel := 0; pkeyaccel1 := 0;end else pkeyaccel := 0;
if pkeyaccel > (10-OPT_P1KEYBACCELDELIM)*10 then pkeyaccel := (10-OPT_P1KEYBACCELDELIM)*10;
end else begin
if ISKEY(CTRL_LOOKUP) then begin players[i].clippixel := players[i].clippixel - OPT_SENS end else
if ISKEY(CTRL_LOOKDOWN) then begin players[i].clippixel := players[i].clippixel + OPT_SENS end;
end;
if players[i].clippixel > CROSHDIST+CROSHADD then players[i].clippixel := CROSHDIST+CROSHADD;
if players[i].clippixel < -CROSHDIST-CROSHADD then players[i].clippixel := -CROSHDIST-CROSHADD;
end;
if ISKEY(CTRL_CENTER) then begin
pkeyaccel := 0;
players[i].clippixel := 0;
end;
end;
if (players[i].control = 2) and (players[i].netobject = false) then
if not (ISKEY(CTRL_P2LOOKUP) and ISKEY(CTRL_P2LOOKDOWN)) then
begin // local second prayer. keyboard.
if OPT_KEYBACCELDELIM > 0 then begin
if ISKEY(CTRL_P2LOOKUP) then begin players[i].clippixel := players[i].clippixel - (OPT_KSENS+keyaccel div (10-OPT_KEYBACCELDELIM)); if keyaccel1 = 1 then inc(keyaccel) else keyaccel := 0; keyaccel1 := 1;end else
if ISKEY(CTRL_P2LOOKDOWN) then begin players[i].clippixel := players[i].clippixel + (OPT_KSENS+keyaccel div (10-OPT_KEYBACCELDELIM)); if keyaccel1 = 0 then inc(keyaccel) else keyaccel := 0; keyaccel1 := 0;end else keyaccel := 0;
if keyaccel > (10-OPT_KEYBACCELDELIM)*10 then keyaccel := (10-OPT_KEYBACCELDELIM)*10;
end else begin
if ISKEY(CTRL_P2LOOKUP) then begin players[i].clippixel := players[i].clippixel - OPT_KSENS end else
if ISKEY(CTRL_P2LOOKDOWN) then begin players[i].clippixel := players[i].clippixel + OPT_KSENS end;
end;
if players[i].clippixel > CROSHDIST+CROSHADD then players[i].clippixel := CROSHDIST+CROSHADD;
if players[i].clippixel < -CROSHDIST-CROSHADD then players[i].clippixel := -CROSHDIST-CROSHADD;
end;
if (players[i].control = 2) then
if ISKEY(CTRL_P2CENTER) then begin
keyaccel := 0;
players[i].clippixel := 0;
end;
if (isonground(players[i])) then players[i].inertiay := 0; // really nice thing :)
// team movement block.
if TeamGame then
if SYS_TEAMSELECT>0 then exit;
if (( (ISKEY(CTRL_MOVEUP)) and (players[i].control=1)) or ((ISKEY(CTRL_P2MOVEUP)) and (players[i].control=2)))
or ( (players[i].idd=2) and (players[i].keys and BKEY_MOVEUP = BKEY_MOVEUP) ) // bot
then // JUMP!
begin
if (IsWaterContent(players[i])) or (IsWaterContentJUMP(players[i])) then begin
players[i].inertiay := -1.5;
end else
if (isonground(players[i]) = false) and (brickonhead(players[i]) = false) and (players[i].item_flight > 0) then begin
players[i].inertiay := -2;
players[i].crouch := false;
if players[i].item_flight_time = 0 then begin
playsound(SND_flight,players[i].x,players[i].y);
players[i].item_flight_time := 35;
if ismultip>0 then begin
MsgSize := SizeOf(TMP_SoundData);
Msg3.Data := MMP_SENDSOUND;
Msg3.DXID := players[i].dxid;
Msg3.SoundType := 1; // flight code;
if ismultip=1 then
mainform.BNETSendData2All(Msg3, MsgSize, 0) else
mainform.BNETSendData2HOST(Msg3, MsgSize, 0);
end;
if MATCH_DRECORD then begin
DData.type0 := DDEMO_FLIGHTSOUND;
DData.gametic := gametic;
DData.gametime := gametime;
DFlightSound.x := round(players[i].x);
DFlightSound.y := round(players[i].y);
DemoStream.Write( DData, Sizeof(DData));
DemoStream.Write( DFlightSound, Sizeof(DFlightSound));
end;
end;
end ELSE
if ( (isonground(players[i])) or (isDoubleJumpPossible(players[i])) ) and (brickonhead(players[i]) = false) then begin
if(players[i].doublejump > 4) then // double jumpz
begin
players[i].doublejump := 14;
players[i].inertiay := -3;
players[i].crouch := false;
end else begin
if players[i].doublejump = 0 then
begin
players[i].doublejump := 14;
playsound(players[i].SND_Jump,players[i].x,players[i].y);
if ismultip>0 then begin
MsgSize := SizeOf(TMP_SoundData);
Msg3.Data := MMP_SENDSOUND;
Msg3.DXID := players[i].dxid;
Msg3.SoundType := 0; // jump code;
if ismultip=1 then
mainform.BNETSendData2All(Msg3, MsgSize, 0) else
mainform.BNETSendData2HOST(Msg3, MsgSize, 0);
end;
if MATCH_DRECORD then begin
DData.type0 := DDEMO_JUMPSOUND;
DData.gametic := gametic;
DData.gametime := gametime;
DPlayerJump.dxid := players[i].dxid;
DemoStream.Write( DData, Sizeof(DData));
DemoStream.Write( DPlayerJump, Sizeof(DPlayerJump));
end;
end;
if CON_SIMPLEPHYSICS = true then players[i].inertiay := -2.9 else players[i].inertiay := -2;
end;
end;
end;
// CROUCH
if not (( (ISKEY(CTRL_MOVEUP)) and (players[i].control=1)) or ((ISKEY(CTRL_P2MOVEUP)) and (players[i].control=2))) then
if ((ISKEY(CTRL_MOVEDOWN) and (players[i].control=1)) or
((ISKEY(CTRL_P2MOVEDOWN)) and (players[i].control=2))) then begin
if (IsOnground(players[i])) then
players[i].crouch := true;
end else if not BrickCrouchOnHead(players[i]) then players[i].crouch := false;
// bot crouch..& wpn change. fire
if players[i].idd = 2 then begin
if players[i].keys and BKEY_MOVEUP <> BKEY_MOVEUP then
if players[i].keys and BKEY_MOVEDOWN = BKEY_MOVEDOWN then begin
if (IsOnground(players[i])) then
players[i].crouch := true;
end else if not BrickCrouchOnHead(players[i]) then players[i].crouch := false;
if (players[i].refire = 0) and (players[i].weapon <> players[i].threadweapon) then
players[i].weapon := players[i].threadweapon;
if players[i].refire = 0 then
if players[i].keys and BKEY_FIRE = BKEY_FIRE then
Fire(players[i],players[i].x,players[i].y,90);
end;
if (BrickCrouchOnHead(players[i])=false) and (IsOnground(players[i])=false) then players[i].crouch := false;
if OPT_TREADWEAPON then begin
if (players[i].refire = 0) and (players[i].weapon <> players[i].threadweapon) then begin
players[i].weapon := players[i].threadweapon;
DoWeapBar(i);
end;
end;
// player fire
if players[i].weapchg = 0 then
if ((ISKEY(CTRL_FIRE) and (players[i].control=1)) or
((ISKEY(CTRL_P2FIRE)) and (players[i].control=2))) then begin
if players[i].refire = 0 then Fire(players[i],players[i].x,players[i].y,90);
// Disable Shaft Firing.
end else if players[i].shaft_state > 0 then begin
players[i].shaft_state := 0;
// addmessage('^5SEND: MMP_049test4_SHAFT_END');
if (ismultip>0) then begin
MsgSize := SizeOf(TMP_049t4_ShaftEnd);
Msg4.Data := MMP_049test4_SHAFT_END;
Msg4.DXID := players[i].dxid;
if ismultip=2 then
mainform.BNETSendData2HOST(Msg4, MsgSize,0) else
mainform.BNETSendData2All(Msg4, MsgSize,0);
end;
if MATCH_DRECORD then begin
DData.type0 := DDEMO_NEW_SHAFTEND;
DData.gametic := gametic;
DData.gametime := gametime;
// addmessage('recording: DDEMO_NEW_SHAFTEND');
D_049t4_ShaftEnd.DXID := players[i].DXID;
DemoStream.Write(DData, Sizeof(DData));
DemoStream.Write(D_049t4_ShaftEnd, Sizeof(D_049t4_ShaftEnd));
end;
end;
// disable gauntlet BZZZZZZZ.
if (players[i].refire = 0) then if players[i].gantl_state > 0 then begin
players[i].gantl_state := 0;
// send gauntlet off packet
if ismultip>0 then
if (players[i].netobject =false) then begin
MsgSize := SizeOf(TMP_GauntletState);
Msg2.DATA := MMP_GAUNTLETSTATE;
Msg2.DXID := Players[i].DXID;
Msg2.state := false; // off gauntlet
if ismultip=1 then
mainform.BNETSendData2All(Msg2,MsgSize,0) else
mainform.BNETSendData2HOST(Msg2,MsgSize,0);
end;
if MATCH_DRECORD then begin
DData.type0 := DDEMO_GAUNTLETSTATE;
DData.gametic := gametic;
DData.gametime := gametime;
DGauntletState.DXID := players[i].DXID;
DGauntletState.State := 0;
DemoStream.Write( DData, Sizeof(DData));
DemoStream.Write( DGauntletState, Sizeof(DGauntletState));
end;
end;
// next weapon
if ((ISKEY(CTRL_NEXTWEAPON)) and (players[i].control=1) and (players[i].weapchg = 0)) or // nextweapon
((ISKEY(CTRL_P2NEXTWEAPON)) and (players[i].control=2) and (players[i].weapchg = 0)) then begin
if players[i].control=1 then
nwse := OPT_P1NEXTWPNSKIPEMPTY
else if players[i].control=2 then
nwse := OPT_P2NEXTWPNSKIPEMPTY;
with players[i] do begin
inc(threadweapon);
if (threadweapon = 1) and ((have_mg = false) or ((ammo_mg=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 2) and ((have_sg = false) or ((ammo_sg=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 3) and ((have_gl = false) or ((ammo_gl=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 4) and ((have_rl = false) or ((ammo_rl=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 5) and ((have_sh = false) or ((ammo_sh=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 6) and ((have_rg = false) or ((ammo_rg=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 7) and ((have_pl = false) or ((ammo_pl=0) and (nwse=true)) ) then inc(threadweapon);
if (threadweapon = 8) and ((have_bfg = false) or ((ammo_bfg=0) and (nwse=true)) ) then inc(threadweapon);
if threadweapon > 8 then begin // gauntlet toggle.
if (have_sg=false) and (have_gl=false) and (have_rl=false) and (have_sh=false) and (have_rg=false) and (have_pl=false) and (have_bfg=false) then
threadweapon := 0 else begin
threadweapon := 0;//hheh
if MATCH_GAMETYPE <> GAMETYPE_RAILARENA then begin
if players[i].control = 1 then if not OPT_P1GAUNTLETNEXTWPN then threadweapon := 1;
if players[i].control = 2 then if not OPT_P2GAUNTLETNEXTWPN then threadweapon := 1;
end;
end;
end;
if threadweapon <> C_WPN_SHAFT then players[i].shaft_state := 0;
DoWeapBar(i);
weapchg := 10;
end;
end;
// prev weapon
if ((ISKEY(CTRL_PREVWEAPON)) and (players[i].control=1) and (players[i].weapchg = 0)) or // nextweapon
((ISKEY(CTRL_P2PREVWEAPON)) and (players[i].control=2) and (players[i].weapchg = 0)) then begin
with players[i] do begin
if threadweapon=0 then threadweapon := 8 else
dec(threadweapon);
if threadweapon = 0 then begin // gauntlet toggle.
if (have_sg=false) and (have_gl=false) and (have_rl=false) and (have_sh=false) and (have_rg=false) and (have_pl=false) and (have_bfg=false) then
threadweapon := 0
else begin
threadweapon := 0;//hheh
if MATCH_GAMETYPE <> GAMETYPE_RAILARENA then begin
if players[i].control = 1 then if not OPT_P1GAUNTLETNEXTWPN then threadweapon := 8;
if players[i].control = 2 then if not OPT_P2GAUNTLETNEXTWPN then threadweapon := 8;
end;
end;
end;
if players[i].control=1 then
nwse := OPT_P1NEXTWPNSKIPEMPTY
else if players[i].control=2 then
nwse := OPT_P2NEXTWPNSKIPEMPTY;
if (threadweapon = 8) and ((have_bfg = false) or ((ammo_bfg=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 7) and ((have_pl = false) or ((ammo_pl=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 6) and ((have_rg = false) or ((ammo_rg=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 5) and ((have_sh = false) or ((ammo_sh=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 4) and ((have_rl = false) or ((ammo_rl=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 3) and ((have_gl = false) or ((ammo_gl=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 2) and ((have_sg = false) or ((ammo_sg=0) and (nwse=true)) ) then dec(threadweapon);
if (threadweapon = 1) and ((have_mg = false) or ((ammo_mg=0) and (nwse=true)) ) then dec(threadweapon);
DoWeapBar(i);
weapchg := 10;
end;
end;
//weaponz
if ((ISKEY(CTRL_WEAPON0)) and (players[i].control=1) and (players[i].weapchg = 0)) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 0; end;
if ((ISKEY(CTRL_WEAPON1)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_mg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 1; end;
if ((ISKEY(CTRL_WEAPON2)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_sg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 2; end;
if ((ISKEY(CTRL_WEAPON3)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_gl = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 3; end;
if ((ISKEY(CTRL_WEAPON4)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_rl = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 4; end;
if ((ISKEY(CTRL_WEAPON5)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_sh = true) then begin DoWeapBar(i); if players[i].weapon <> C_WPN_SHAFT then players[i].weapchg := 10; players[i].threadweapon := 5; end;
if ((ISKEY(CTRL_WEAPON6)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_rg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 6; end;
if ((ISKEY(CTRL_WEAPON7)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_pl = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 7; end;
if ((ISKEY(CTRL_WEAPON8)) and (players[i].control=1) and (players[i].weapchg = 0)) and (players[i].have_bfg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 8; end;
if ((ISKEY(CTRL_P2WEAPON0)) and (players[i].control=2) and (players[i].weapchg = 0)) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 0; end;
if ((ISKEY(CTRL_P2WEAPON1)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_mg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 1; end;
if ((ISKEY(CTRL_P2WEAPON2)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_sg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 2; end;
if ((ISKEY(CTRL_P2WEAPON3)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_gl = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 3; end;
if ((ISKEY(CTRL_P2WEAPON4)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_rl = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 4; end;
if ((ISKEY(CTRL_P2WEAPON5)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_sh = true) then begin DoWeapBar(i); if players[i].weapon <> C_WPN_SHAFT then players[i].weapchg := 10; players[i].threadweapon := 5; end;
if ((ISKEY(CTRL_P2WEAPON6)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_rg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 6; end;
if ((ISKEY(CTRL_P2WEAPON7)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_pl = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 7; end;
if ((ISKEY(CTRL_P2WEAPON8)) and (players[i].control=2) and (players[i].weapchg = 0)) and (players[i].have_bfg = true) then begin DoWeapBar(i); players[i].weapchg := 10; players[i].threadweapon := 8; end;
ClipTriggers(players[i]);
if (players[i].control=1) then begin
if (ISKEY(CTRL_MOVELEFT)) and (ISKEY(CTRL_MOVERIGHT)) then begin
if players[i].dir < 2 then players[i].dir := players[i].dir+2;
exit;
end;
end;
if (players[i].control = 2) then begin
if (ISKEY(CTRL_P2MOVELEFT)) and (ISKEY(CTRL_P2MOVERIGHT)) then begin
if players[i].dir < 2 then players[i].dir := players[i].dir+2;
exit;
end;
end;
if players[i].item_haste > 0 then begin
if players[i].item_haste_time = 0 then begin SpawnSmoke(round(players[i].x),round(players[i].y+20)); players[i].item_haste_time := 5;
end
else dec(players[i].item_haste_time);
end;
if players[i].dir < 2 then
players[i].dir := players[i].dir+2;
if (((ISKEY(CTRL_MOVELEFT)) and (players[i].control=1)) or ((ISKEY(CTRL_P2MOVELEFT)) and (players[i].control=2)))
or ( (players[i].idd=2) and (players[i].keys and BKEY_MOVELEFT = BKEY_MOVELEFT) ) then begin
// if players[i].inertiax > -1 then players[i].inertiax := -1;
SPEED := PLAYERMAXSPEED;
if players[i].crouch=true then SPEED := PLAYERMAXSPEED-1;
if players[i].item_haste>0 then SPEED := SPEED+1;
if players[i].inertiax > 0 then players[i].inertiax := players[i].inertiax - 0.8;
if players[i].inertiax > -SPEED then players[i].inertiax := players[i].inertiax - 0.35;
if players[i].inertiax < -SPEED then players[i].inertiax := -SPEED;
players[i].dir := 0;
end;
if (((ISKEY(CTRL_MOVERIGHT)) and (players[i].control=1)) or ((ISKEY(CTRL_P2MOVERIGHT)) and (players[i].control=2)))
or ( (players[i].idd=2) and (players[i].keys and BKEY_MOVERIGHT = BKEY_MOVERIGHT) ) then begin
SPEED := PLAYERMAXSPEED;
if players[i].crouch=true then SPEED := PLAYERMAXSPEED-1;
if players[i].item_haste>0 then SPEED := SPEED+1;
if players[i].inertiax < 0 then players[i].inertiax := players[i].inertiax + 0.8;
if players[i].inertiax < SPEED then players[i].inertiax := players[i].inertiax + 0.35;
if players[i].inertiax > SPEED then players[i].inertiax := SPEED;
players[i].dir := 1;
end;
{ if (OPT_MOUSEANGRY) and (players[i].control=1) then begin
if mainform.PowerInput.mDeltaX > 25 then players[i].dir := 1;
if mainform.PowerInput.mDeltaX < -25 then players[i].dir := 0;
end;
}
end;
function BrickCrouchOnHead(sender:TPlayer) : boolean;//crouch head.
begin
with sender as TPlayer do begin
if (bbb[ trunc(x-8) div 32, trunc(y-9) div 16].block = true) and
(bbb[ trunc(x-8) div 32, trunc(y-7) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+8) div 32, trunc(y-9) div 16].block = true) and
(bbb[ trunc(x+8) div 32, trunc(y-7) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x-8) div 32, trunc(y-23) div 16].block = true) then begin result := true; exit; end;
if (bbb[ trunc(x+8) div 32, trunc(y-23) div 16].block = true) then begin result := true; exit; end;
if (bbb[ trunc(x-8) div 32, trunc(y-16) div 16].block = true) then begin result := true; exit; end;
if (bbb[ trunc(x+8) div 32, trunc(y-16) div 16].block = true) then begin result := true; exit; end;
result := false;
end; end;
function BrickOnHead(sender:TPlayer) :boolean;//do not jump over brickz
var c : byte;
begin
c := 0;
//if sender.crouch then c := 5;
with sender as TPlayer do begin
if (bbb[ trunc(x-9) div 32, trunc(y-25+c) div 16].block = true) and
(bbb[ trunc(x-9) div 32, trunc(y-23+c) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+9) div 32, trunc(y-25+c) div 16].block = true) and
(bbb[ trunc(x+9) div 32, trunc(y-23+c) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x-9) div 32, trunc(y-24+c) div 16].block = true) and
(bbb[ trunc(x-9) div 32, trunc(y-8+c) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+9) div 32, trunc(y-24+c) div 16].block = true) and
(bbb[ trunc(x+9) div 32, trunc(y-8+c) div 16].block = false) then begin result := true; exit; end;
result := false;
end;
end;
function BrickFOnHead(sender:TMonoSprite) : boolean;//whats that?????? brick female on head?":))
// no, it is for monosprite.. dude
begin
with sender as TMonoSprite do begin
if (bbb[ trunc(x-9) div 32, trunc(y-25) div 16].block = true) and
(bbb[ trunc(x-9) div 32, trunc(y-23) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+9) div 32, trunc(y-25) div 16].block = true) and
(bbb[ trunc(x+9) div 32, trunc(y-23) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x-9) div 32, trunc(y-24) div 16].block = true) and
(bbb[ trunc(x-9) div 32, trunc(y-8) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+9) div 32, trunc(y-24) div 16].block = true) and
(bbb[ trunc(x+9) div 32, trunc(y-8) div 16].block = false) then begin result := true; exit; end;
result := false;
end;
end;
function IsFOnground(sender : TMonoSprite) : boolean; // this procedure checkz if the corpse onground
begin // compare current coordinates via brick matrix;
if sender.x < 0 then exit;
if sender.y < 0 then exit;
result := false;
try
with sender as TMonoSprite do begin
if (bbb[ trunc(x-1) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x-1) div 32, trunc(y+23) div 16].block = false) then begin {addmessage('onground');}result := true; exit; end;
if (bbb[ trunc(x+1) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x+1) div 32, trunc(y+23) div 16].block = false) then begin {addmessage('onground');}result := true; exit; end;
if (bbb[ trunc(x-1) div 32, trunc(y+24) div 16].block = true) and
(bbb[ trunc(x-1) div 32, trunc(y-8) div 16].block = false) then begin {addmessage('onground');}result := true; exit; end;
if (bbb[ trunc(x+1) div 32, trunc(y+24) div 16].block = true) and
(bbb[ trunc(x+1) div 32, trunc(y-8) div 16].block = false) then begin {addmessage('onground');}result := true; exit; end;
// result := false;
end;
except exit; end;
end;
function IsWaterContentJUMP(sender : TPlayer) : boolean; // this procedure checkz if the player onground
var img : byte;
begin
result := false;
with sender as TPlayer do begin
img := bbb[ trunc(x) div 32, trunc(y+8) div 16].image;
if (img = CONTENT_WATER) or (img = CONTENT_LAVA) then result:= true;
end;
end;
function IsWaterContentHEAD(sender : TPlayer) : boolean; // this procedure checkz if the player'head in water
var img : byte;
begin
result := false;
with sender as TPlayer do begin
img := bbb[ trunc(sender.x) div 32, trunc(sender.y-20) div 16].image;
if (img = CONTENT_WATER) or (img = CONTENT_LAVA) then result:= true;
end;
end;
function IsWaterContentCrouchHEAD(sender : TPlayer) : boolean; // this procedure checkz if the player'head in water
var img : byte;
begin
result := false;
with sender as TPlayer do begin
img := bbb[ trunc(sender.x) div 32, trunc(sender.y-8) div 16].image;
if (img = CONTENT_WATER) or (img = CONTENT_LAVA) then result:= true;
end;
end;
function IsWaterContent(sender : TPlayer) : boolean; // this procedure checkz if the player inwater.
var img : byte;
begin
result := false;
with sender as TPlayer do begin
// img := bbb[ trunc(x) div 32, trunc(y) div 16].image;
// if (img = CONTENT_WATER) or (img = CONTENT_LAVA) then BEGIN
img := bbb[ trunc(x) div 32, trunc(y) div 16].image;
if (img = CONTENT_WATER) or (img = CONTENT_LAVA) then result:= true;
//END;
end;
end;
function isDoubleJumpPossible(sender : TPlayer) : boolean;
var z : integer;
begin
with sender as TPlayer do begin
z := 9;
result := false;
exit;
if (bbb[ trunc(x+z) div 32, trunc(y+24) div 16].block = true) and
(bbb[ trunc(x+z) div 32, trunc(y+8) div 16].block = false) then begin
doublejump := 10;
playsound(snd_hit,0,0);
result := true; exit; end;
if (bbb[ trunc(x-z+1) div 32, trunc(y+24) div 16].block = true) and
(bbb[ trunc(x-z+1) div 32, trunc(y+8) div 16].block = false) then begin
doublejump := 10;
playsound(snd_hit,0,0);
result := true; exit; end;
end;
end;
function IsOnground(sender : TPlayer) : boolean; // this procedure checkz if the player onground
var z : integer;
begin // compare current coordinates via brick matrix;
with sender as TPlayer do begin
if dead > 0 then z := 0 else z := 9; // corpses donot stuck on wallz
if x <= 0 then x := 100; // HACK: crash fix.
if y <= 0 then y := 100;
if ((y+25) / 16) > BRICK_Y then begin
result:=true;
exit;
end;
if (bbb[ trunc(x-z) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x-z) div 32, trunc(y+23) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+z) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x+z) div 32, trunc(y+23) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x-z) div 32, trunc(y+24) div 16].block = true) and
(bbb[ trunc(x-z) div 32, trunc(y+8) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+z) div 32, trunc(y+24) div 16].block = true) and
(bbb[ trunc(x+z) div 32, trunc(y+8) div 16].block = false) then begin result := true; exit; end;
// mainform.PowerGraph.Line(trunc(x-z-100), trunc(y+25), trunc(x-z), trunc(y+25),cllime,effectNone);
{
if (bbb[ trunc(x-z) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x-z) div 32, trunc(y+16) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+z) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x+z) div 32, trunc(y+16) div 16].block = false) then begin result := true; exit; end;
if (bbb[ trunc(x+z+2) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x+z+2) div 32, trunc(y+23) div 16].block = false) then begin result := true; exit; end;
if inertiax<0 then
if (bbb[ trunc(x-z-2) div 32, trunc(y+25) div 16].block = true) and
(bbb[ trunc(x-z-2) div 32, trunc(y+23) div 16].block = false) then begin result := true; exit; end;
}
result := false;
end;
end;
procedure CorpsePhysic(id : word);
var defx : real;
alph : cardinal;
begin
// aaa[id].dead := 2;
// exit;
if (aaa[id].spawner = nil) then begin
aaa[id].dead := 2;
exit;
end;
defx := aaa[id].x;
// DIE ANIM
if (aaa[id].weapon=0) and (aaa[id].spawner.dead > 0) then begin
aaa[id].x := aaa[id].spawner.TESTPREDICT_X;
aaa[id].y := aaa[id].spawner.TESTPREDICT_y;
aaa[id].inertiax := aaa[id].spawner.inertiax;
aaa[id].inertiay := aaa[id].spawner.inertiay;
end;
if (aaa[id].cx < OPT_CORPSETIME*50 - 20) then
if (aaa[id].spawner.dead = 0) then
aaa[id].weapon := 1;
if aaa[id].cx >= 25 then alph := 255
else alph := trunc(aaa[id].cx*10);
// emulate player dead movement.
if (aaa[id].dir = 1) or (aaa[id].dir = 3) then
mainform.PowerGraph.RenderEffectCol(mainform.Images[aaa[id].spawner.die_index], trunc(aaa[id].x-26)+GX, trunc(aaa[id].y-27)+GY+52-aaa[id].spawner.diesizey, 256, (Alph shl 24) +$FFFFFF, aaa[id].frame, 2 or $100) else
mainform.PowerGraph.RenderEffectCol(mainform.Images[aaa[id].spawner.die_index], trunc(aaa[id].x-26)+GX, trunc(aaa[id].y-27)+GY+52-aaa[id].spawner.diesizey, 256, (Alph shl 24) +$FFFFFF, aaa[id].frame, 2 or $100 or effectMirror);
if (aaa[id].frame < aaa[id].spawner.dieframes-1) then
if aaa[id].fallt <= 0 then inc(aaa[id].frame);
if aaa[id].fallt > 0 then dec(aaa[id].fallt) else aaa[id].fallt := aaa[id].spawner.dieframerefreshtime;
if aaa[id].cx > 0 then aaa[id].cx := aaa[id].cx-1 else begin
aaa[id].dead := 2;
exit;
end;
{ if MATCH_DDEMOPLAY then begin
if (players[id].frame < players[id].dieframes-1) then
if players[id].nextframe <= 0 then inc(players[id].frame);
if players[id].rewardtime > 0 then if (players[id].frame >= players[id].dieframes-1) then players[id].rewardtime := 0;
end;
if players[id].nextframe > 0 then dec(players[id].nextframe) else players[id].nextframe := players[id].framerefreshtime;
exit;
end;
}
// emulate player physics.
if aaa[id].objname <> 'corpse' then exit;
if aaa[id].dead=2 then exit;
aaa[id].InertiaY := aaa[id].InertiaY + (Gravity*2.8); // --> 10
if (aaa[id].inertiay > -1) and (aaa[id].inertiay < 0) then aaa[id].inertiay := aaa[id].inertiay/1.11; // progressive inertia
if (aaa[id].inertiay > 0) and (aaa[id].inertiay < 5) then aaa[id].inertiay := aaa[id].inertiay*1.1; // progressive inertia
if (aaa[id].inertiax < -0.2) or (aaa[id].Inertiax > 0.2) then begin
try
if (aaa[id].dir > 1) then begin
if (isFonground(aaa[id])) then
aaa[id].InertiaX := aaa[id].InertiaX / 1.14 /// ongroud stop speed.
else
aaa[id].InertiaX := aaa[id].InertiaX / 1.025; // inair stopspeed.
end;
except aaa[id].inertiax := 0; end;
end else aaa[id].inertiax := 0;
if (isFonground(aaa[id])) then aaa[id].InertiaX := aaa[id].InertiaX / 1.03; // corpse stop speed.
aaa[id].x := aaa[id].x + aaa[id].inertiax;
aaa[id].y := aaa[id].y + aaa[id].inertiay;
// CLIPPING
if aaa[id].inertiax < 0 then begin // check clip wallz.
if (bbb[ (round(defx - 10) div 32), round(aaa[id].Y-16) div 16].block = true)
or (bbb[ (round(defx - 10) div 32), round(aaa[id].Y) div 16].block = true)
or (bbb[ (round(defx - 10) div 32), round(aaa[id].Y+16) div 16].block = true) then begin
aaa[id].X := trunc(defx/32)*32+9;
aaa[id].Inertiax := 0;
end;
end;
if aaa[id].inertiax > 0 then begin
if (bbb[ (round(defx + 10) div 32), round(aaa[id].Y-16) div 16].block = true)
or (bbb[ (round(defx + 10) div 32), round(aaa[id].Y) div 16].block = true)
or (bbb[ (round(defx + 10) div 32), round(aaa[id].Y+16) div 16].block = true) then begin
aaa[id].X := trunc(defx/32)*32+22;
aaa[id].Inertiax := 0;
end;
end;
if (BrickFOnHead(aaa[id])) and (isFonground(aaa[id])) then begin
aaa[id].inertiaY := 0;
aaa[id].Y := (round(aaa[id].Y) div 16) * 16 + 8;
end else
if (BrickFOnHead(aaa[id])) and (aaa[id].inertiay < 0) then begin // fly up
aaa[id].inertiaY := 0;
aaa[id].Y := (round(aaa[id].Y) div 16) * 16 + 8;
end else
if (isFonground(aaa[id])) and (aaa[id].inertiay > 0) then begin
aaa[id].inertiay := 0;
aaa[id].Y := (round(aaa[id].Y) div 16) * 16 + 8;
end;
// water move.
if (bbb[ trunc(aaa[id].x) div 32, trunc(aaa[id].y) div 16].image = CONTENT_WATER) or
(bbb[ trunc(aaa[id].x) div 32, trunc(aaa[id].y) div 16].image = CONTENT_LAVA) then begin
if aaa[id].InertiaY< -1 then aaa[id].InertiaY := -1;
if aaa[id].InertiaY> 1 then aaa[id].InertiaY := 1;
if aaa[id].InertiaX< -2 then aaa[id].InertiaX := -2;
if aaa[id].InertiaX> 2 then aaa[id].InertiaX := 2;
end else begin //normal move.
if aaa[id].InertiaY< -5 then aaa[id].InertiaY := -5;
if aaa[id].InertiaY> 5 then aaa[id].InertiaY := 5;
if aaa[id].InertiaX< -5 then aaa[id].InertiaX := -5;
if aaa[id].InertiaX> 5 then aaa[id].InertiaX := 5;
end;
if aaa[id].y > 16*250 then aaa[id].dead := 2; //bugfix.
end;
function playerphysic(id : byte):boolean; // here up and down player physics
var
defx : real;
defy : real;
begin
result := true;
// --!-!-!=!=!= ULTIMATE 3d[Power]'s PHYSIX M0DEL =!=!=!-!-!--
//if (players[id].dead > 1){ and (isonground(players[id]))} then exit;
defx := players[id].x;
defy := players[id].y;
players[id].InertiaY := players[id].InertiaY + (Gravity*2.80); // --> 10
if (players[id].inertiay > -1) and (players[id].inertiay < 0) then players[id].inertiay := players[id].inertiay/1.11; // progressive inertia
if (players[id].inertiay > 0) and (players[id].inertiay < 5) then players[id].inertiay := players[id].inertiay*1.1; // progressive inertia
if (players[id].inertiax < -0.2) or (players[id].Inertiax > 0.2) then begin
try
if (players[id].dir > 1) then begin
if (isonground(players[id])) then
players[id].InertiaX := players[id].InertiaX / 1.14 /// ongroud stop speed.
else
players[id].InertiaX := players[id].InertiaX / 1.025; // inair stopspeed.
end;
except players[id].inertiax := 0; end;
end else players[id].inertiax := 0;
if(players[id].dead > 0 ) and (isonground(players[id])) then players[id].InertiaX := players[id].InertiaX / 1.03; // corpse stop speed.
players[id].x := players[id].x + players[id].inertiax;
players[id].y := players[id].y + players[id].inertiay;
// wall CLIPPING
if players[id].crouch then begin
//VERTICAL CHECNING
if (brickcrouchonhead(players[id])) and (isonground(players[id])) then begin
players[id].inertiaY := 0;
players[id].crouch := true;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
end else
if (brickcrouchonhead(players[id])) and (players[id].inertiay < 0) then begin // fly up
players[id].inertiaY := 0;
players[id].doublejump := 3;
players[id].crouch := true;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
// players[id].y := players[id].Y - round(players[id].InertiaY);
end else
if (isonground(players[id])) and (players[id].inertiay > 0) then begin
players[id].crouch := true;
players[id].inertiay := 0;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
end; // udivitelno ! why this bullshit works?
// HORZ CHECK
if players[id].inertiax < 0 then begin // check clip wallz.
if (bbb[ (round(defx - 10) div 32), round(players[id].Y-8) div 16].block = true)
or (bbb[ (round(defx - 10) div 32), round(players[id].Y) div 16].block = true)
or (bbb[ (round(defx - 10) div 32), round(players[id].Y+16) div 16].block = true) then begin
players[id].X := trunc(defx/32)*32+9;
players[id].Inertiax := 0;
result := false;
end;
end;
if players[id].inertiax > 0 then begin
if (bbb[ (round(defx + 10) div 32), round(players[id].Y-8) div 16].block = true)
or (bbb[ (round(defx + 10) div 32), round(players[id].Y) div 16].block = true)
or (bbb[ (round(defx + 10) div 32), round(players[id].Y+16) div 16].block = true) then begin
players[id].X := trunc(defx/32)*32+22;
players[id].Inertiax := 0;
result := false;
end;
end;
end else begin
if players[id].inertiax < 0 then begin // check clip wallz.
if (bbb[ (round(defx - 10) div 32), round(defy-16) div 16].block = true)
or (bbb[ (round(defx - 10) div 32), round(defy) div 16].block = true)
or (bbb[ (round(defx - 10) div 32), round(defy+16) div 16].block = true)
// or (bbb[ (round(defx - 10) div 32), round(defy+22) div 16].block = true)
then begin
players[id].X := trunc(defx/32)*32+9;
players[id].Inertiax := 0;
result := false;
end;
end;
if players[id].inertiax > 0 then begin
if (bbb[ (round(defx + 10) div 32), round(defy-16) div 16].block = true)
or (bbb[ (round(defx + 10) div 32), round(defy) div 16].block = true)
or (bbb[ (round(defx + 10) div 32), round(defy+16) div 16].block = true)
// or (bbb[ (round(defx + 10) div 32), round(defy+22) div 16].block = true)
then begin
players[id].X := trunc(defx/32)*32+22;
players[id].Inertiax := 0;
result := false;
end;
end;
end;
// end else begin
if (brickonhead(players[id])) and (isonground(players[id])) then begin
players[id].inertiaY := 0;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
end else
if (brickonhead(players[id])) and (players[id].inertiay < 0) then begin // fly up
players[id].inertiaY := 0;
players[id].doublejump := 3;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
// players[id].y := players[id].Y - round(players[id].InertiaY);
end else
if isonground(players[id]) and (players[id].inertiay > 0) then begin
players[id].inertiay := 0;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
end;
{ if (isonground(players[id])) and (players[id].inertiay > 0) then begin
players[id].inertiay := 0;
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
end; // udivitelno ! why this bullshit works?
if (isonground(players[id])) and (players[id].inertiay < 0) then begin
players[id].inertiay := 0;
playsound(snd_hit,0,0);
players[id].Y := (round(players[id].Y) div 16) * 16 + 8;
end; // udivitelno ! why this bullshit works?
}
// end;
// WATER\LAVA MOVEMENT
if IsWaterContent(players[id]) then begin
if players[id].InertiaY< -1 then players[id].InertiaY := -1;
if players[id].InertiaY> 1 then players[id].InertiaY := 1;
if players[id].InertiaX< -2 then players[id].InertiaX := -2;
if players[id].InertiaX> 2 then players[id].InertiaX := 2;
end else begin
if players[id].InertiaY< -5 then players[id].InertiaY := -5;
if players[id].InertiaY> 5 then players[id].InertiaY := 5;
if players[id].InertiaX< -5 then players[id].InertiaX := -5;
if players[id].InertiaX> 5 then players[id].InertiaX := 5;
end;
if players[id].y > 16*250 then players[id].y := 16*250-16;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment