Skip to content

Add "drawonlyforplayer" and "dontdrawforviewmobj"

Zwip-Zwap Zapony requested to merge Zwip-Zwap_Zapony/SRB2:drawonlyforpx into next

Mobjs now have a drawonlyforplayer field. If set to a player_t, hides the mobj for everyone except this player and their spectators.
Mobjs also have a dontdrawforviewmobj field. If set to a mobj_t, hides the mobj if dontdrawforviewmobj is the current camera (first-person player or awayviewmobj).
These fields can stack, and they work online as well as in splitscreen. They're exposed to Lua, and also utilised by the vanilla game.

Lock-on arrows, Tailsbot's flight indicator, CTF flag-carrier signs, and Tag "IT" signs now handle splitscreen (and no longer show up for you when you spectate someone else), shields can no longer show up in first-person (fixes #924 (closed), fixes #997 (closed)), co-op finish flags no longer disappear for all players when you're in first-person (fixes #1009 (closed)), Metal Sonic's jet bubbles when underwater and jet trail in Boost Mode are now hidden in first-person (is this change desirable?).

MT_OVERLAY objects copy their target's dontdrawforviewmobj field, but not drawonlyforplayer. Lua can override this with e.g. PostThinkFrame hooks, of course.

[This Lua script] adds a drawonlyforplayer # console command. Replace # with 1 to make all current objects only render for player 1, 2 for player 2, or 0 for both players.
It also adds a dontdrawforviewmobj # console command. Replace # with 1 to make all current objects be hidden for player 1 while in first-person, 2 for player 2, 0 for neither, or "self" for when awayviewcam is in use.
It also adds a splitrings console variable, enabled by default, which makes Rings work per-player by cloning them and making each set only render for and be collected by a specific player. This is only a proof of concept.

-

TL;DR:
- Added drawonlyforplayer and dontdrawforviewmobj to control object visibility per-player, even in splitscreen
- Fixed many inconsistencies with objects being visible/invisible when they shouldn't be for certain players, especially in splitscreen
- Fixed some shields being visible in first-person when using 3D models
- Fixed Metal Sonic's jet fume being visible in first-person when moving backwards with Speed Shoes
- Metal Sonic's Boost Mode trail and underwater bubbles are no longer visible in first-person

Edited by Zwip-Zwap Zapony

Merge request reports