Add "drawonlyforplayer" and "dontdrawforviewmobj"
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
Merge request reports
Activity
mentioned in merge request !1989 (closed)
added Bug label
added Feature label
changed milestone to %2.2.12
added SRB2Kart port label
mentioned in merge request !1891 (closed)
I think this is a strange thing to port, as the person who coded this feature.
This is the old Kart implementation which is incredibly clunky, and I do not think it is a good idea anymore. Ring Racers handles it by replacing the DONTDRAW flag system entirely, which you can't really do in a patch.
SRB2's splitscreen usage is extremely minimal compared to Kart. These flags were implemented to make Hyudoro work in a game explicitly designed for couch-play (down to us making HUD redesigns for every screen combination). In SRB2, splitscreen is kind of just there, and there's no game mechanics designed around visibility. I don't really think it's a good idea to solve extremely minor issues by introducing an incredibly antiquated and convoluted method.
What would probably be both more useful overall and less bloated would be adding two extra mobj_t variables:
- A pointer to an mobj_t. If this pointer is the current camera (either 1st person player, or awayviewcam) then draw it invisible.
- A pointer to a player_t. If this pointer is non-NULL, then make it only draw on this player's screen.
These would cover everything vanilla would need this for without introducing insane bloat.
Currently, this merge request aims for familiarity with SRB2Kart's system. If I want to aim for familiarity with Dr. Robotnik's Ring Racers' system instead, are those pointers what Ring Racers (currently) uses, what are they called, and where are they placed in the
mobj_t
struct?[...] These would cover everything vanilla would need this for [...]
Technically, vanilla SRB2 also has a "hide a mobj from a specific player, in both first- and third-person" case for CTF flag/Tag "IT" indicators, which that system doesn't allow. (In practice, that can be accomplished by "not spawning it for the local player online" and "only showing it for the opposite player in splitscreen", but it would require spawning three copies of the mobj if SRB2 gets 4-player splitscreen someday.)
I said in my post RR replaces DONTDRAW entirely. Its system isn't portable without breaking every mod imaginable. I was making suggestions for possible alternative systems that wouldn't break anything. You could just add a third pointer for that last scenario, y'know; maybe slightly redundant but not as bad as taking up a varying number of eflags imo.
added 73 commits
-
020d1526...6f74123c - 72 commits from branch
STJr:next
- 4dc96e1c - Add "drawonlyforplayer" and "dontdrawforviewmobj"
-
020d1526...6f74123c - 72 commits from branch
removed SRB2Kart port label
added Lua label
added Refactoring label
added 173 commits
-
4dc96e1c...1a209146 - 172 commits from branch
STJr:next
- 0e2682d5 - Add "drawonlyforplayer" and "dontdrawforviewmobj"
-
4dc96e1c...1a209146 - 172 commits from branch
mentioned in commit 7c26fbf0
mentioned in merge request !2125 (merged)
mentioned in issue #1216