/* -------------------------------------------------------------------------------- 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 gamevar pcard 0 0 // Access cards // Crosshair need to be redone for two players onevent EVENT_DISPLAYCROSSHAIR setvar RETURN -1 endevent // For some reasons, next and previous weapon actions will never pick expander or foot onevent EVENT_NEXTWEAPON getplayer[THISACTOR].curr_weapon pweapon ifvare pweapon 11 { setplayer[THISACTOR].curr_weapon 7 setvar RETURN -1 } else ifvare pweapon 9 { setplayer[THISACTOR].curr_weapon 0 setvar RETURN -1 } else ifvare pweapon 6 { setplayer[THISACTOR].curr_weapon 11 setvar RETURN -1 } endevent onevent EVENT_PREVIOUSWEAPON getplayer[THISACTOR].curr_weapon pweapon ifvare pweapon 11 { setplayer[THISACTOR].curr_weapon 6 setvar RETURN -1 } else ifvare pweapon 1 { setplayer[THISACTOR].curr_weapon 0 setvar RETURN -1 } else ifvare pweapon 7 { setplayer[THISACTOR].curr_weapon 11 setvar RETURN -1 } 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 1024 // 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 // This part was for showing keycards, but I don't know how to check if player has a keycard /* getplayer[THISACTOR].got_access pcard ifvare pcard 1 rotatesprite 150 178 65536 0 ACCESS_ICON 0 0 10 0 0 xdim ydim ifvare pcard 2 rotatesprite 150 185 65536 0 ACCESS_ICON 0 0 10 0 0 xdim ydim ifvare pcard 3 rotatesprite 150 192 65536 0 ACCESS_ICON 0 0 10 0 0 xdim ydim */ 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