mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 17:32:13 +00:00
8d3db58950
git-svn-id: https://svn.eduke32.com/eduke32@2915 1a8010ca-5511-0410-912e-c29ae57300e0
336 lines
8.2 KiB
Text
336 lines
8.2 KiB
Text
/*
|
|
--------------------------------------------------------------------------------
|
|
Duke Nukem 3D SplitScreen mod
|
|
Beta 1
|
|
By Bloodclaw
|
|
|
|
Modified from original for use with EDuke32 SVN.
|
|
Usage: eduke32 splitscr.con -q2
|
|
--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
include GAME.CON
|
|
|
|
// Those are inventory parts
|
|
definequote 160 ON
|
|
definequote 161 OFF
|
|
definequote 162 %
|
|
definequote 163 AUTO
|
|
|
|
// Key name definitions
|
|
definegamefuncname 11 P2_Move_Forward
|
|
definegamefuncname 12 P2_Move_Backward
|
|
definegamefuncname 13 P2_Turn_Left
|
|
definegamefuncname 14 P2_Turn_Right
|
|
definegamefuncname 17 P2_Aim_Up
|
|
definegamefuncname 18 P2_Aim_Down
|
|
definegamefuncname 19 P2_Fire
|
|
definegamefuncname 20 P2_Open
|
|
definegamefuncname 21 P2_Jump
|
|
definegamefuncname 22 P2_Crouch
|
|
definegamefuncname 23 P2_Inventory
|
|
definegamefuncname 24 P2_Inventory_Left
|
|
definegamefuncname 25 P2_Inventory_Right
|
|
definegamefuncname 26 P2_Quick_Kick
|
|
definegamefuncname 27 P2_Previous_Weapon
|
|
definegamefuncname 28 P2_Next_Weapon
|
|
|
|
|
|
gamevar pid 1 0 // This hold player 2 id
|
|
gamevar pnum 0 0 // This is set to player 2 sprite number
|
|
|
|
// Temp variables
|
|
gamevar px 0 0 // Player (both 1 and 2) X coordinate
|
|
gamevar py 0 0 // Player Y coordinate
|
|
gamevar pz 0 0 // Player Z coordinate
|
|
gamevar psect 0 0 // Player sector number
|
|
gamevar pang 0 0 // Player angle
|
|
gamevar phoriz 0 0 // Player vertical angle
|
|
gamevar phorizoff 0 0 // Something similar
|
|
gamevar pangcos 0 0 // Cosinus of player angle (used for player 2 movements)
|
|
gamevar pangsin 0 0 // Sinus of player angle
|
|
gamevar pinput 0 0 // Set to input, used in the PROCESSINPUT event
|
|
|
|
gamevar pcrosshair 0 0 // Do you like crosshairs? Game options will tell.
|
|
gamevar pweapon 0 0 // Player weapon
|
|
gamevar pfta 0 0 // Both used for quotes
|
|
gamevar pftq 0 0
|
|
gamevar pcolor 0 0 // Used to display quotes with player color
|
|
|
|
gamevar p1heat 0 0 // Common night vision googles
|
|
gamevar p2heat 0 0
|
|
|
|
|
|
// Crosshair need to be redone for two players
|
|
onevent EVENT_DISPLAYCROSSHAIR
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
|
|
define KNEE_WEAPON 0
|
|
define PISTOL_WEAPON 1
|
|
define SHOTGUN_WEAPON 2
|
|
define CHAINGUN_WEAPON 3
|
|
define RPG_WEAPON 4
|
|
define HANDBOMB_WEAPON 5
|
|
define SHRINKER_WEAPON 6
|
|
define DEVISTATOR_WEAPON 7
|
|
define TRIPBOMB_WEAPON 8
|
|
define FREEZE_WEAPON 9
|
|
define HANDREMOTE_WEAPON 10
|
|
define GROW_WEAPON 11
|
|
|
|
// Next and previous weapon actions will never pick the expander.
|
|
onevent EVENT_NEXTWEAPON
|
|
getplayer[THISACTOR].curr_weapon pweapon
|
|
ifvare pweapon GROW_WEAPON
|
|
setvar RETURN DEVISTATOR_WEAPON
|
|
else ifvare pweapon SHRINKER_WEAPON
|
|
setvar RETURN SHRINKER_WEAPON // select expander
|
|
endevent
|
|
|
|
onevent EVENT_PREVIOUSWEAPON
|
|
getplayer[THISACTOR].curr_weapon pweapon
|
|
ifvare pweapon DEVISTATOR_WEAPON
|
|
{
|
|
// Select expander. We can't return GROW_WEAPON, because it means
|
|
// 'next weapon' here.
|
|
// Ugly, because the shrinker is displayed for a split second.
|
|
setplayer[THISACTOR].curr_weapon SHRINKER_WEAPON
|
|
setvar RETURN SHRINKER_WEAPON
|
|
}
|
|
else ifvare pweapon GROW_WEAPON
|
|
setvar RETURN SHRINKER_WEAPON
|
|
endevent
|
|
|
|
// Disable all the following keys, need room for player 2
|
|
onevent EVENT_LOOKUP // Move Forward
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_LOOKDOWN // Move Backward
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_LOOKLEFT // Turn Left
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_LOOKRIGHT // Turn Right
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_AIMUP // Aim Up
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_AIMDOWN // Aim Down
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY1 // Fire
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY2 // Open
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY3 // Jump
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY4 // Crouch
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY5 // Inventory
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY6 // Inventory Left
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY7 // Inventory Right
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY8 // Quick Kick
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY9 // Previous Weapon
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
onevent EVENT_WEAPKEY10 // Next Weapon
|
|
setvar RETURN -1
|
|
endevent
|
|
|
|
|
|
// Controls for player 2
|
|
onevent EVENT_PROCESSINPUT // I had to use this event in case player 1 die
|
|
getinput[THISACTOR].bits pinput
|
|
|
|
ifvarand pinput 8
|
|
{
|
|
setinput[pid].bits 8
|
|
ifvarl phoriz 199 addvar phoriz 14
|
|
setplayer[pid].horiz phoriz // For some reasons, only setting the bits won't work
|
|
}
|
|
ifvarand pinput 16
|
|
{
|
|
setinput[pid].bits 16
|
|
ifvarg phoriz 1 subvar phoriz 14
|
|
setplayer[pid].horiz phoriz
|
|
}
|
|
ifvarand pinput 64
|
|
{
|
|
setinput[pid].avel -20
|
|
}
|
|
ifvarand pinput 128
|
|
{
|
|
setinput[pid].avel 20
|
|
}
|
|
ifvarand pinput 8192 // This block and the following one are for moving forward and backward, with X and Y speeds set with help of sinus and cosinus
|
|
{
|
|
setvar RETURN -1
|
|
getplayer[pid].i pnum
|
|
getactor[pnum].ang pang
|
|
cos pangcos pang
|
|
mulvar pangcos 10
|
|
divvar pangcos 64
|
|
sin pangsin pang
|
|
mulvar pangsin 10
|
|
divvar pangsin 64
|
|
setinput[pid].fvel pangcos
|
|
setinput[pid].svel pangsin
|
|
}
|
|
ifvarand pinput 16384
|
|
{
|
|
setvar RETURN -1
|
|
getplayer[pid].i pnum
|
|
getactor[pnum].ang pang
|
|
cos pangcos pang
|
|
mulvar pangcos -10
|
|
divvar pangcos 64
|
|
sin pangsin pang
|
|
mulvar pangsin -10
|
|
divvar pangsin 64
|
|
setinput[pid].fvel pangcos
|
|
setinput[pid].svel pangsin
|
|
}
|
|
// Following code come from Eduke32 wiki
|
|
shiftvarr pinput 8
|
|
andvar pinput 0xF
|
|
switch pinput
|
|
case 1:
|
|
setinput[pid].bits 4
|
|
break
|
|
case 2:
|
|
setinput[pid].bits 536870912
|
|
break
|
|
case 3:
|
|
setinput[pid].bits 1
|
|
break
|
|
case 4:
|
|
setinput[pid].bits 2
|
|
break
|
|
case 5:
|
|
setinput[pid].bits 1073741824
|
|
break
|
|
case 6:
|
|
setinput[pid].bits 1048576
|
|
break
|
|
case 7:
|
|
setinput[pid].bits 134217728
|
|
break
|
|
case 8:
|
|
setinput[pid].bits 4194304
|
|
break
|
|
case 9:
|
|
setinput[pid].bits 2816
|
|
break
|
|
case 10:
|
|
setinput[pid].bits 3072
|
|
break
|
|
endswitch
|
|
endevent
|
|
|
|
|
|
// NOTE: status bar is displayed for both players (EDuke32 splitscreen hack)
|
|
|
|
|
|
// orientation bits for the crosshairs
|
|
define ORIENT 1032 // 26
|
|
|
|
// gametext args
|
|
define P1X 4
|
|
define P2X 164
|
|
|
|
onevent EVENT_DISPLAYROOMS
|
|
setvar RETURN 1 // don't draw them
|
|
|
|
// an EDuke32 hack now:
|
|
// setplayer[THISACTOR].rotscrnang 0 // (almost) Prevent the screen rotation when player 1 die
|
|
|
|
// Took this code from the wiki
|
|
// It show player 1 view
|
|
getplayer[THISACTOR].posx px
|
|
getplayer[THISACTOR].posy py
|
|
getplayer[THISACTOR].posz pz
|
|
getplayer[THISACTOR].ang pang
|
|
getplayer[THISACTOR].horiz phoriz
|
|
getplayer[THISACTOR].horizoff phorizoff
|
|
addvarvar phoriz phorizoff
|
|
updatesector px py psect
|
|
ifvarg psect -1
|
|
showviewunbiased px py pz pang phoriz psect 0 0 160 199
|
|
// -------------------------------------
|
|
// Player 2 view
|
|
getplayer[pid].posx px
|
|
getplayer[pid].posy py
|
|
getplayer[pid].posz pz
|
|
getplayer[pid].ang pang
|
|
getplayer[pid].horiz phoriz
|
|
getplayer[pid].horizoff phorizoff
|
|
addvarvar phoriz phorizoff
|
|
updatesector px py psect
|
|
ifvarg psect -1
|
|
showviewunbiased px py pz pang phoriz psect 160 0 319 199
|
|
// -------------------------------------
|
|
|
|
// Draw crosshairs if they are enabled
|
|
getuserdef[THISACTOR].crosshair pcrosshair
|
|
ifvare pcrosshair 1
|
|
{
|
|
rotatesprite 80 100 32768 0 CROSSHAIR 0 0 ORIENT 0 0 xdim ydim
|
|
rotatesprite 240 100 32768 0 CROSSHAIR 0 0 ORIENT 0 0 xdim ydim
|
|
}
|
|
|
|
|
|
// NOTE: weapons are drawn for both players now (EDuke32 hack)
|
|
|
|
|
|
// Common night vision googles
|
|
getplayer[THISACTOR].heat_on p1heat
|
|
getplayer[pid].heat_on p2heat
|
|
ifvarn p1heat 1
|
|
ifvarn p2heat 1
|
|
setgamepalette 0
|
|
else
|
|
setgamepalette 2
|
|
|
|
getactor[THISACTOR].pal pcolor
|
|
getplayer[THISACTOR].ftq pftq
|
|
getplayer[THISACTOR].fta pfta
|
|
ifvarn pfta 0
|
|
gametext STARTALPHANUM P1X 2 pftq 0 pcolor 26 0 0 xdim ydim
|
|
|
|
getactor[pnum].pal pcolor
|
|
getplayer[pid].ftq pftq
|
|
getplayer[pid].fta pfta
|
|
ifvarn pfta 0
|
|
gametext STARTALPHANUM P2X 2 pftq 0 pcolor 26 0 0 xdim ydim
|
|
endevent
|