So I've made a hack to make models that occupy more than one sector not disappear when the player is not looking at the sector the actual sprite is placed in....
First I used the hitscan code that is on the wiki:
gamevar MY_X 0 1
gamevar MY_Y 0 1
gamevar MY_Z 0 1
gamevar MY_SECTOR 0 1
gamevar MY_ANGLE 0 1
gamevar MY_ZDIST 0 1
gamevar MY_COS 0 1
gamevar MY_SIN 0 1
gamevar HITSECTOR 0 1
gamevar HITWALL 0 1
gamevar HITSPRITE 0 1
gamevar HITX 0 1
gamevar HITY 0 1
gamevar HITZ 0 1
state checkhitscan
getplayer[THISACTOR].posx MY_X
getplayer[THISACTOR].posy MY_Y
getplayer[THISACTOR].posz MY_Z
getplayer[THISACTOR].cursectnum MY_SECTOR
getplayer[THISACTOR].ang MY_ANGLE
getplayer[THISACTOR].horiz MY_ZDIST
subvar MY_ZDIST 100
mulvar MY_ZDIST -2048
cos MY_COS MY_ANGLE
sin MY_SIN MY_ANGLE
hitscan MY_X MY_Y MY_Z MY_SECTOR MY_COS MY_SIN MY_ZDIST HITSECTOR HITWALL HITSPRITE HITX HITY HITZ CLIPMASK1
ends
State checkhitscan is called constantly from within the APLAYER actor. Then I create an actor for the models:
spritenoshade 4577
eventloadactor 4577
getactor[THISACTOR].cstat TEMP5
ifvarand TEMP5 16
{
getactor[THISACTOR].sectnum TEMP
getsector[TEMP].floorpal TEMP7
setactor[THISACTOR].pal TEMP7
getactor[THISACTOR].shade ACTORFLOORSHADE
getactor[THISACTOR].x TEMP2
getactor[THISACTOR].y TEMP3
getactor[THISACTOR].z TEMP4
}
else
{
getactor[THISACTOR].sectnum TEMP
getsector[TEMP].floorshade ACTORFLOORSHADE
setactor[THISACTOR].shade ACTORFLOORSHADE
getsector[TEMP].floorpal TEMP7
setactor[THISACTOR].pal TEMP7
getactor[THISACTOR].x TEMP2
getactor[THISACTOR].y TEMP3
getactor[THISACTOR].z TEMP4
}
enda
useractor notenemy 4577 // Stone column
ldist TEMP6 THISACTOR player[THISACTOR].i
ifvarl TEMP6 24000
{
ifvarn HITSECTOR -1
ifvarn sector[HITSECTOR].lotag 2
changespritesect THISACTOR HITSECTOR
setactor[THISACTOR].shade ACTORFLOORSHADE
setactor[THISACTOR].pal TEMP7
setactor[THISACTOR].x TEMP2
setactor[THISACTOR].y TEMP3
setactor[THISACTOR].z TEMP4
}
enda
So the sprite's sectnum is always the sector the player is looking at, and thus it won't disappear. I have to save and restore x,y,z, pal and shade or weird things will happen.
Let me know what you think - this hack may not be optimal but I've noticed no slowdowns or undesirable effects so far....
EDIT: There is indeed slowdown with a large number of actors running this code. So I have to limit the distance, and I think I will make the "fix" toggleable with some gamevar, so it can be turned off if flickering/disappearing models don't bother you.