3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: ShadeCEVO simple grass (OVERLAY) ?
[Re: rayp]
#472476
04/29/18 23:18
04/29/18 23:18
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
OP
X
|
OP
X
Joined: Jul 2008
Posts: 2,107
Germany
|
I faced a really strange thing. When adding entity Arrays to a shadeC Project, ull be hunted by strange randomly appearing bugs. Its hard to explain, but already confirmed by 3run ( my example i uploaded ). I made this example. Its basicly the std. example from shadeC with around 50 new lines. In this example the c_move call makes the script Crash ( but only if its commented out WTF ). This is just one example of bug with Array in shadeC. Without Arrays all works fine. And if you take the Array stuff out of shadec Project it also works. https://www.file-upload.net/download-13105427/arrayBUGshadeC.rar.html
#define MAX_ENEMY 9999
#define MAX_ENEMY2 9999
var ENEMIES_TOTAL = 0;
var ENEMIES_TOTAL2 = 0;
ENTITY* enemy_list [MAX_ENEMY];
ENTITY* enemy_list2 [MAX_ENEMY2];
action actEnemy(){
// ----------------------------------------------------------------------------------------------------------
if (ENEMIES_TOTAL >= MAX_ENEMY) { ptr_remove(my); return; }
enemy_list [ENEMIES_TOTAL] = my;
ENEMIES_TOTAL++;
}
action actEnemy2(){
// ----------------------------------------------------------------------------------------------------------
if (ENEMIES_TOTAL2 >= MAX_ENEMY2) { ptr_remove(my); return; }
enemy_list2 [ENEMIES_TOTAL2] = my;
ENEMIES_TOTAL2++;
}
void updateNPC_both(){
ENTITY* tempEnt; // instead of my/me were using tempEnt
ENTITY* tempEnt2; // instead of my/me were using tempEnt
int i = 0; // the "itemindex" in the for cycle
// ----------------------------------------------------------------------------------------------------------
while (1){ // handle all enemys as long as...
// -------------------------------------------------------------------------------------------------------
for (i = 0; i < ENEMIES_TOTAL; i++){ // cycle through all enemys in array now
// ----------------------------------------------------------------------------------------------------
// --- [ fill pointers ] ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------
tempEnt = enemy_list[i];
tempEnt2 = enemy_list2[i];
if (tempEnt == NULL) continue;
if (tempEnt2 == NULL) continue;
if (tempEnt2.skill1 == 0) beep; // baam
}
wait (1);
}
}
main.c:
updateNPC_both();
ent_create ("modela.mdl", vector (0,0,0), actEnemy);
ent_create ("modela.mdl", vector (0,0,0), actEnemy2);
This tiny contruct will Crash when u continue adding stuff, hard to explain. edit: I know the using of two arrays like i did in this example is shitty...anyway it should work.
Last edited by rayp; 04/30/18 00:16.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: ShadeCEVO simple grass (OVERLAY) ?
[Re: rayp]
#472479
04/30/18 08:56
04/30/18 08:56
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
try using dynamic memory allocation Edit: or try increasing the nexus. to my knowledge the engine doesn't tell you s*** when it's full
Last edited by Kartoffel; 04/30/18 08:58.
POTATO-MAN saves the day! - Random
|
|
|
Re: ShadeCEVO simple grass (OVERLAY) ?
[Re: alibaba]
#480365
06/02/20 17:46
06/02/20 17:46
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hey 3run, I think I got it working before iirc. I can look for it this weekend. Hey, it would be great if you could check it out. I tried to give it a try, but found out, that even in defines there is no SHADOW for pointlights...
//pointlight
#define SC_LIGHT_P 0
#define SC_LIGHT_P_SPEC 1
#define SC_LIGHT_P_SPEC_PROJ 2
#define SC_LIGHT_P_PROJ 3
//spotlight
#define SC_LIGHT_S 10
#define SC_LIGHT_S_SPEC 11
#define SC_LIGHT_S_SPEC_SHADOW 12
#define SC_LIGHT_S_SHADOW 13
int sc_lpp_getLightType(unsigned int inBitflag)
{
int bitMask = 0;
//pointlights
bitMask = (SC_LIGHT_POINT);
if( inBitflag == bitMask) return SC_LIGHT_P;
bitMask = (SC_LIGHT_POINT | SC_LIGHT_SPECULAR);
if( inBitflag == bitMask) return SC_LIGHT_P_SPEC;
bitMask = (SC_LIGHT_POINT | SC_LIGHT_PROJECTION);
if( inBitflag == bitMask) return SC_LIGHT_P_PROJ;
bitMask = SC_LIGHT_POINT | SC_LIGHT_SPECULAR | SC_LIGHT_PROJECTION;
if( (inBitflag & bitMask) == bitMask) return SC_LIGHT_P_SPEC_PROJ;
//spotlights
bitMask = (SC_LIGHT_SPOT);
if( inBitflag == bitMask || inBitflag == (bitMask | SC_LIGHT_PROJECTION) ) return SC_LIGHT_S;
bitMask = (SC_LIGHT_SPOT | SC_LIGHT_SPECULAR);
if( inBitflag == bitMask || inBitflag == (bitMask | SC_LIGHT_PROJECTION) ) return SC_LIGHT_S_SPEC;
bitMask = (SC_LIGHT_SPOT | SC_LIGHT_SHADOW);
if( inBitflag == bitMask || inBitflag == (bitMask | SC_LIGHT_PROJECTION) ) return SC_LIGHT_S_SHADOW;
bitMask = (SC_LIGHT_SPOT | SC_LIGHT_SPECULAR | SC_LIGHT_SHADOW);
if( inBitflag == bitMask || inBitflag == (bitMask | SC_LIGHT_PROJECTION) ) return SC_LIGHT_S_SPEC_SHADOW;
return SC_LIGHT_P;
}
|
|
|
|