Several ACS functions for reusable and more flexible code
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
In this case you dont need that parameter mode, because the X and Y coordinates would come in when there are multiple sectors with the same tag. But id also like to be able to use the function WITHOUT X or Y coordinates (just 0) for flat floors/ceilings when only one sector (or multiple all with the same height) has the given tag. I dont really see myself pinpointing a sectors coordinates on the map and hardcode those coordinates for every time I use this function just for a flat sector.
- MartinHowe
- Posts: 2097
- Joined: Mon Aug 11, 2003 1:50 pm
- Preferred Pronouns: He/Him
- Location: East Suffolk (UK)
Heh heh, I was thinking this myself after battling with "you-know-what" TNG for a few weeks --
Would it not be possible to have, say, something like CreateStringTable() and DeleteStringTable() - the former would return an INT that would be a pointer to the table. Then any function that needed to "return" a string could be given the string table pointer and return an index; e.g., mytex=GetFloorTexture(mystringtableid). Or even the "standard" C things (strcmp, strcpy, etc).
Or instead, each scope instance (global, each hub, each map, each script, each function) could have a "string table id" field that is set to 0 on start and not changed unless the programmer uses "GetStringTableId()" or similar.
When the scope instance ends, code added by ACC (not the programmer) automatically destructs any such storage (using free()). The string indexes themselves are created dynamically and stored in a master array (again, not visible to the programmer) so that ACS can check if a pointer is still valid. Could be a bit slow, but remember this check would be done by the game (i.e., in C not ACS) and would be faster than the (interpreted pcode of) ACS.
This is just food for thought written quickly, so there will be holes in it, but you get the general idea; just thought it had to be said.
OK, let's play Devil's Advocate here as regards textures or other strings.cccp_leha wrote:Is it possible to program dynamic strings into ACS / how difficult would it be to do so? I think I asked before and I forgot.
Would it not be possible to have, say, something like CreateStringTable() and DeleteStringTable() - the former would return an INT that would be a pointer to the table. Then any function that needed to "return" a string could be given the string table pointer and return an index; e.g., mytex=GetFloorTexture(mystringtableid). Or even the "standard" C things (strcmp, strcpy, etc).
Or instead, each scope instance (global, each hub, each map, each script, each function) could have a "string table id" field that is set to 0 on start and not changed unless the programmer uses "GetStringTableId()" or similar.
When the scope instance ends, code added by ACC (not the programmer) automatically destructs any such storage (using free()). The string indexes themselves are created dynamically and stored in a master array (again, not visible to the programmer) so that ACS can check if a pointer is still valid. Could be a bit slow, but remember this check would be done by the game (i.e., in C not ACS) and would be faster than the (interpreted pcode of) ACS.
This is just food for thought written quickly, so there will be holes in it, but you get the general idea; just thought it had to be said.
-
LogicDeLuxe
- Posts: 198
- Joined: Mon Apr 26, 2004 11:32 am
So, what can we expect to be implemented in .64?
Also, GetViewPointX(), GetViewPointY(), GetViewPointZ() and GetViewAngle() might be useful, which would return the exact coordinates of the current viewpoint. This must not be identical to the marine, but also can be an active camera. Also the bobbing would be taken into account.
Those functions might be usefull for some visual effects. Even they are not that important if we will have portals supported, they might come in handy for some other effects.
Also it might be great if one could set the scale and size of actors at runtime. For instance, growing monsters could be done with it.
Also, GetViewPointX(), GetViewPointY(), GetViewPointZ() and GetViewAngle() might be useful, which would return the exact coordinates of the current viewpoint. This must not be identical to the marine, but also can be an active camera. Also the bobbing would be taken into account.
Those functions might be usefull for some visual effects. Even they are not that important if we will have portals supported, they might come in handy for some other effects.
Also it might be great if one could set the scale and size of actors at runtime. For instance, growing monsters could be done with it.
-
LogicDeLuxe
- Posts: 198
- Joined: Mon Apr 26, 2004 11:32 am
Not thought of something particular yet. You could move things and sectors accordingly. Or maybe have a monster which only wakes up when you (or a camera) turn your back to it. There's plenty you could do with those, just like with those suggested in the posts before.Chilvence wrote:What effects are those then? Not saying that they wouldnt be useful, I'm just curious what you'd do with them.
- Bio Hazard
- Posts: 4019
- Joined: Fri Aug 15, 2003 8:15 pm
- Location: ferret ~/C/ZDL $
- Contact:
-
LogicDeLuxe
- Posts: 198
- Joined: Mon Apr 26, 2004 11:32 am
Though, I'd say, the general GetActorAngel (as suggested before) would be more important. That shouldn't be hard to implement and is really useful in many situations.blender81 wrote:I agree with LogicDeLuxe, I would also like a function that returns the player's current view angle. With this function, one could hack together a nice radar or crude on-screen automap, or perhaps a compass aiming toward the next objective.
-
LogicDeLuxe
- Posts: 198
- Joined: Mon Apr 26, 2004 11:32 am
I have another suggestion for better subtitle support:
int ActorOnScreenX(TID)
int ActorOnScreenY(TID)
which would return the coordinates of the position an actor is curently visible on screen. The format should be identical to the centered format which you use in HudMessage, so it can be used for subtitle positioning of (spoken) text from actors.
Of course, for cases you can't be sure if the actor actually is on screen, we also need
int IsActorOnScreen(TID)
int ActorOnScreenX(TID)
int ActorOnScreenY(TID)
which would return the coordinates of the position an actor is curently visible on screen. The format should be identical to the centered format which you use in HudMessage, so it can be used for subtitle positioning of (spoken) text from actors.
Of course, for cases you can't be sure if the actor actually is on screen, we also need
int IsActorOnScreen(TID)
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
LogicDeLuxe wrote:I have another suggestion for better subtitle support:
int ActorOnScreenX(TID)
int ActorOnScreenY(TID)
which would return the coordinates of the position an actor is curently visible on screen. The format should be identical to the centered format which you use in HudMessage, so it can be used for subtitle positioning of (spoken) text from actors.
Of course, for cases you can't be sure if the actor actually is on screen, we also need
int IsActorOnScreen(TID)
This sounds simpler than it really is. There is no way to determine with 100% certainty whether an actor is visible or not. In software mode you can check whether parts of it are being rendered but for ZDoomGL such a calculation is useless.
-
LogicDeLuxe
- Posts: 198
- Joined: Mon Apr 26, 2004 11:32 am
As I thought of this functions as a subtitle helper, it doesn't really matter if the actor is actually visible or not. This merely should make it possible to have the subtitle line on screen at the same position the sound comes from (or were it would come from it it were dubbed in case it isn't). I know, there would be cases where actors are rendered, but coverd from objects in front of it, though, the engine has calculated the coordinates at least, which is sufficient in this matter.Graf Zahl wrote:This sounds simpler than it really is. There is no way to determine with 100% certainty whether an actor is visible or not. In software mode you can check whether parts of it are being rendered but for ZDoomGL such a calculation is useless.