diff --git a/polymer/eduke32/samples/splitscr.con b/polymer/eduke32/samples/splitscr.con index 57a2f5628..5a9743110 100644 --- a/polymer/eduke32/samples/splitscr.con +++ b/polymer/eduke32/samples/splitscr.con @@ -40,6 +40,7 @@ gamevar pid 1 0 // This hold player 2 id gamevar pnum 0 0 // This is set to player 2 sprite number // Temp variables +gamevar tmp 0 0 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 @@ -269,37 +270,55 @@ define ORIENT 1032 // 26 define P1X 4 define P2X 164 +gamevar arg_player_id 0 0 + +state show_player_view + getplayer[arg_player_id].posx px + getplayer[arg_player_id].posy py + getplayer[arg_player_id].posz pz + getplayer[arg_player_id].ang pang + getplayer[arg_player_id].horiz phoriz + getplayer[arg_player_id].horizoff phorizoff + addvarvar phoriz phorizoff + + // simulate corresponding part in G_DrawRooms (almost) + ifvarvare player[arg_player_id].spritebridge 0 + { + setvarvar tmp player[arg_player_id].truecz + addvar tmp 1024 + ifvarvarl pz tmp + setvarvar pz tmp + else + { + setvarvar tmp player[arg_player_id].truefz + subvar tmp 1024 + ifvarvarg pz tmp + setvarvar pz tmp + } + } + + getplayer[arg_player_id].cursectnum psect + + ifvarg psect -1 + { + ifvare arg_player_id 0 + showviewunbiased px py pz pang phoriz psect 0 0 160 199 + else + showviewunbiased px py pz pang phoriz psect 160 0 319 199 + } +ends + 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 THE PLAYER VIEWS! + setvar arg_player_id 0 + state show_player_view + setvar arg_player_id 1 + state show_player_view // Draw crosshairs if they are enabled getuserdef[THISACTOR].crosshair pcrosshair diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 27b24b0b3..a698a7e4e 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3574,6 +3574,9 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) ud.camerahoriz = 100+sprite[p->newowner].shade; else if (p->spritebridge == 0) { + // NOTE: when shrunk, p->pos.z can be below the floor. This puts the + // camera into the sector again then. + if (ud.camera.z < (p->truecz + (4<<8))) ud.camera.z = cz + (4<<8); else if (ud.camera.z > (p->truefz - (4<<8))) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index ab3b4350e..569ef6295 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -5022,7 +5022,6 @@ void P_ProcessInput(int32_t snum) } } } - else { p->falling_counter = 0; @@ -5308,6 +5307,8 @@ HORIZONLY: P_CheckTouchDamage(p, j); } + // This makes the player view lower when shrunk. NOTE that it can get the + // view below the sector floor (and does, when on the ground). if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) p->pos.z += 32<<8;