2 registered members (TipmyPip, AndrewAMD),
14,540
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
particle effects cause "Invalid arguments in ..."
#143432
07/26/07 04:19
07/26/07 04:19
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
I converted an A6.6 "game" over to A7/Lite-C, and have one last thing to fix...well, besides that ent_create/physics thing. So, anyway, here is my problem: I cannot get particle effects to work. My app throws an "Invalid arguments in someEvent" error messagebox on any "effect(...);" line that I throw at it. I've got several tried and true effects and none of them work. As a matter of fact, I cut and past the lite-C code excerpt from the manual and it still crashes on the "effect(...);" line. When I try to walk through the debugger, all I get is the same error messagebox on that line. Following is the code. Any ideas? Do I need to add the obligatory "wait(1);" somewhere or something? Thanks for the help. Code:
... BMAP* spark_map = "spark.tga"; VECTOR temp; ...
void main() { ... }
void someAction() { ... my.event=someEvent; ... }
void someEvent() { ... vec_scale(normal,10); // from the manual effect(effect_explo,10,my.x,normal); // CRASH!!!! ... }
/// the following funcs are from the manual. /// the only change is the BMAP utilized in effect_explo function vec_randomize (var* vec, var range) { vec[0] = random(1) - 0.5; vec[1] = random(1) - 0.5; vec[2] = random(1) - 0.5; vec_normalize(vec,random(range)); }
// helper function: fades out a particle function part_alphafade(PARTICLE *p) { p.alpha -= 2*time_step; if (p.alpha <= 0) p.lifespan = 0; }
// particle function: generates a fading explosion into vel direction function effect_explo(PARTICLE *p) { vec_randomize(temp,10); vec_add (p.vel_x, temp); p.alpha = 25 + random(25); p.bmap = spark_map; p.flags |= (BRIGHT | MOVE); p.event = part_alphafade; // change to a shorter, faster function }
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
Re: particle effects cause "Invalid arguments in .
[Re: Poison]
#143434
07/26/07 07:54
07/26/07 07:54
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
function effect_explo(PARTICLE *p);
^ |
have you done a function prototype before someEvent? if you haven't, the compiler doesn't know what effect_explo is.
julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: particle effects cause "Invalid arguments in .
[Re: JibbSmart]
#143435
07/26/07 14:17
07/26/07 14:17
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
I dont have access to my code at this time, so I can't try these suggestions yet, but...
Poison: I will try you suggestion when I get a chance.
Julz: Come to think of it, I have a prototype, but I may not have included the "POINTER* p" in the arguments in the prototype. Wouldn't this throw a compiler error? I know it does if the prototype is missing, but what if the arguments are different? Well, anyway, I know I'm not throwing any compiler errors before the game runs.
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
Re: particle effects cause "Invalid arguments in .
[Re: dreadFusemonkey]
#143436
07/26/07 22:49
07/26/07 22:49
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
because function overloading is supported, the compiler would probably think it's a prototype to a function of the same name, but different parameters. it only comes across the error at runtime when it comes across the effect call. i think  good luck, julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: particle effects cause "Invalid arguments in .
[Re: JibbSmart]
#143437
07/26/07 23:59
07/26/07 23:59
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
Quote:
because function overloading is supported, the compiler would probably think it's a prototype to a function of the same name, but different parameters. it only comes across the error at runtime when it comes across the effect call.
That makes sense. And, silly me, I did forget the POINTER* p in the prototypes. But that was not the only problem. After I added "max_particles = 50000;" to main, everything worked. Now all I have to do is tweak my once beautiful blood and dust particles for A7.
Another hurdle overcome.
thanks.
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
|