Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Misc arrays are truncated to integers

4 replies · 1,124 views · Started 12 February 2010

This script:

ffc script Test
{
void run()
{
eweapon wpn=Screen->CreateEWeapon(131);
wpn->Misc[0]=3.2;
while(wpn->isValid())
{
Trace(wpn->Misc[0]);
wpn->Misc[0]-=0.16;
Waitframe();
}
}
}

Prints this:

3.0000
2.0000
1.0000
0.0000
0.0000
0.0000
0.0000
...

It appears to be the same for every pointer type's Misc[].

Well there's your problem:

User posted image

They're stored as longs, but get treated as floats, but get integer maths.
I can't see how they actually even worked before.. Did they ever work? 😕

Alright, I fixed all of the games misc counters, however I only tested the eweapon->misc ones. If someone gets an itch to do so that would be fantastic.

9.2000
31
31
9.0400
31
31
8.8800
31
31
8.7200
31
31
8.5600
8.4000

..And for some reason something keeps outputting 31 for me and I have know Idea what it is.. I think I put a define for _DEBUG somewhere in the code and I can't find it. XD

Well, they're not integers anymore, but...

ffc script Test2
{
void run()
{
this->Misc[0]+=255;
Trace(this->Misc[0]);
}
}

allegro.log wrote:-26980.3776

Whoops. My bad! ..(I knew I left out something...) EDIT: Yeah, I forgot to change one line. Sorry. It's fixed.


9.2000
9.0400
19.2000
19.0400
29.2000
29.0400
39.2000
39.0400
49.2000
49.0400
59.2000
59.0400
31
31
31
31
31
31
31
31


ffc script miscD
{
void run()
{
{
eweapon wpn=Screen->CreateEWeapon(131);
wpn->Misc[0]=9.2;
Trace(wpn->Misc[0]);
wpn->Misc[0]-=0.16;
Trace(wpn->Misc[0]);
}
{
lweapon wpn=Screen->CreateLWeapon(31);
wpn->Misc[0]=19.2;
Trace(wpn->Misc[0]);
wpn->Misc[0]-=0.16;
Trace(wpn->Misc[0]);
}
{
this->Misc[0]=29.2;
Trace(this->Misc[0]);
this->Misc[0]-=0.16;
Trace(this->Misc[0]);
}
{
Link->Misc[0]=39.2;
Trace(Link->Misc[0]);
Link->Misc[0]-=0.16;
Trace(Link->Misc[0]);
}
{
item wpn=Screen->CreateItem(1);
wpn->Misc[0]=49.2;
Trace(wpn->Misc[0]);
wpn->Misc[0]-=0.16;
Trace(wpn->Misc[0]);
}
{
npc wpn=Screen->CreateNPC(32);
wpn->Misc[0]=59.2;
Trace(wpn->Misc[0]);
wpn->Misc[0]-=0.16;
Trace(wpn->Misc[0]);
}

}
}

Again, If anyone solves the mystery of the mysterious 31 logging please let me know!