Spider Mastermind
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > does acs have some sort of "null"
 
Author
All times are GMT. The time now is 22:23. Post New Thread    Post A Reply
gggmork
If you can make any sense of this post, congratulations


Posts: 2795
Registered: 06-07


I'm trying to make a fake class in acs I guess. This is the main data for a point. "Instance variables" are spread to multiple arrays (I suspect doing so removes complex nesting, ie. not going points[2][2] but rather zs[2] to refer to the z of the 3rd point, and also "zs" is self describing (a list of z floats) whereas [2] is cryptic and requiring knowing it means "z").:

xs[3] = {5,9,7};
ys[3] = {8,4,2};
zs[3] = {2,8,1};

Index starts on 0, so the 3rd point is 7,2,1:
xs[2]
ys[2]
zs[2]

Anyway, if I want to delete/erase index 1:
{5,null,7};
{8,null,2};
{2,null,1};
I could set them to null or something (i noticed "no" is color coded red in acs so maybe that's it), then basically "if that spot is null, consider it erased/gone".
If I use 0s instead, 0/0/0 is still a valid point location. So if there aren't any nulls, I guess I could add another "instance variable"
alive[3] = {1,1,1}
then just set the alive bit off for an erased one:
{1,0,1}

I intend all the "instance variables" and functions to have the prefix "p_" to stand for point, just to organize everything and make it obvious which function are supposed to go with which "objects" (really just an index to all the "instance variable" arrays like xs/ys/zs), like p_xs, p_newIndex(), p_rotate(pointIndex, angle), bla bla

Last edited by gggmork on 03-08-13 at 14:16

Old Post 03-08-13 14:09 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 11202
Registered: 07-07


NULL is 0.


Boolean keywords like NO or FALSE are also 0.

What you want is NaN (not-a-number). There is no coding for such a value in ACS; since all variables are really integers. (Even decimal values are really integers, thanks to the magic of fixed point.)

So you have two choices: either set some sort of magic number which will mean "not a number" in your code (and you'll have to check for it), preventing from using it legitimately; or use an additional variable to keep track of whether the whatever it is is valid or not.

Old Post 03-08-13 15:04 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2795
Registered: 06-07


Ok, thanks, I'll go with the additional variable.

I like the idea of "erasing" an element of an array by packing it with filler, because all the indexes after that (which function as IDs) don't bump down 1 place like with python lists. Just give precedence to use the filled "holes" as the next new point indexes/ids.

Old Post 03-08-13 15:28 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
actinide2k9
Warming Up


Posts: 11
Registered: 12-10


And there is no way to create a nullable type in acs?
Like in C# using int? nullableInt = null or bool? nullableBool = null
In C++ NULL is actually 0 though... maybe a const int null = 0 ? But I'm not sure you can create a constant in acs...

Old Post 03-08-13 17:35 #
actinide2k9 is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2795
Registered: 06-07


You can make a constant like this in acs:
#define a 134
and you can use a constant in outermost scope (where arrays have to be declared)
int bla[a];
makes a 134 long array.
(you can't use a normal variable in outer scope, other than declare it, and can only do equations etc with them inside scripts)

I'd probably use a constant for total number of point instances possible, like:
#define p_maxPoints 256
then:
p_xs[p_maxPoints];
p_ys[p_maxPoints];
p_zs[p_maxPoints];

Old Post 03-08-13 18:00 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2795
Registered: 06-07


EDIT: here's some stuff I found out:
* spawn an imp, then constantly setactorpitch() to the imp has no affect on the imp (other than having getactorpitch() print what you set it to.. but seems bound by 0.25999, and probably the negative of that)
* Constantly setactorpitch(-0.25) to the player will make him constantly look down (y-shear), and printing getactorpitch() will print "-0.25" even though its supposed to be bound by -0.0888977.
* spawnprojectile("doomimpball, bla bla) then constantly setactorpitch() to that projectile has no affect on the projectile. Same if you spawn() the projectile so it just sits there.
* spawn an imp, then spawn a doomimpball inside the imp hurts the imp even though they're supposed to be immune to doomimpballs (also spawn a projectile outside the imp that runs into the imp also hurts him)
I'm guessing normal projectile attacks don't spawn from the monster center but from in front of the monster outside its bounding box.


may as well ask this too.

I thought of making a thing class with th_bla variables and "methods"/functions to operate on those variables.

Things already seem wrapped up in a class in acs, so it might be kinda pointless to re-wrap them in my own fake "class". At least one reason though is to keep track of TIDs (deleting and getting an unused one as necessary).

Each thing would probably have a pointIndex variable referring to the index of the point in the point class that works as the thing's center.

NEWAYZ I thought of giving each thing an "angle" and "pitch" variable, but then I thought about pitch and y-shearing:
http://zdoom.org/wiki/Y-shearing
and now I suspect that "pitch" is meaningless for anything but a camera? Like you can setActorPitch to an imp, but does that have no effect on anything? You might think that would affect the direction it shoots projectiles, but projectiles are their own things with their own direction, probably not having any basis on the imps pitch. (not sure if setActorPitch would affect the projectile itself).
Plus there is the "Due to the limits of freelook in the software renderer, this value is bounded by -0.0888977 and 0.155548" problem of not being able to pitch directly upward/downward (not sure if you can SET outside those bounds but only the y-shearing is limited, like I think a projectile can shoot straight up).
Maybe I could just give each thing a 2nd orbitting point which could orbit anywhere and function as its overall pitch/angle/direction.

I guess I could find some of this stuff out with some code tests, but then I don't get to type stuff in a forum!

And since you like answering my questions so much, when an imp spawns a fireball right from its center (assuming that is the spot), I'm guessing it doesn't collide with the imp itself because it knows the imp was the "activator/creator" of the fireball and just ignores that tag for collisions or something?

If I want gravity free imps bouncing around the room and NOT colliding into eachother, acs-only solutions are maybe to set the mass or width or something to 0 (and gravity to 0)? noclip seems decorate-only. I can spawnForced but then they'd probably block the player if they spawn on top of him.

Last edited by gggmork on 03-12-13 at 16:47

Old Post 03-12-13 00:12 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
GooberMan
Scripting Nut


Posts: 1170
Registered: 02-01


It's also pretty likely that you won't ever have anything at the complete extents of your maps. You can use the constants 0x7FFFFFFF for positive ranges and 0x80000000 for negative ranges. But pick one and only use that and treat it as your null (although you shouldn't consider it null but INVALID or something like that).

Old Post 03-13-13 10:33 #
GooberMan is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 22:23. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > does acs have some sort of "null"

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.