|
1 registered members (1 invisible),
1,558
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
mem error using custom shadow
#442881
07/05/14 10:46
07/05/14 10:46
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Howdy, Today after I made and added a custom shadow (/that I made in paint shop pro, .png) for enemies, I got a memory error twice so far when testing. Removing the custom shadow lines seem to fix the error. The last ~3-4 weeks (or more) with testing/playing I got no memory error so I think the shadow or the code for it is the cause. Code (inspired by the manual):
ENTITY* ent_shadow_enemy = { type = "Shadow_Enemy.png"; }
...
...
function set_resolutionandshadows()
{
shadow_stencil = 2;
...
}
...
action enemy()
{
...
set(my,FLAG3 | SHADOW);
my.shadow = ent_shadow_enemy; //this line is the cause
...
Link to the shadow file: http://www.gamefront.com/files/24334113/Shadow_EnemyError.zip Maybe important (I doubt it though), I also had a second view open with the NOSHADOW flag set. From the manual; "A function such as ptr_remove, ent_remove, or sys_free was called with an invalid or already-freed pointer; or an allocated memory area was overwritten by a damaged file or script bug.". Probably a bad damaged file than? Tyty
|
|
|
Re: mem error using custom shadow
[Re: Reconnoiter]
#442905
07/05/14 18:10
07/05/14 18:10
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
try this instead:
action shadow_act(){
VECTOR temp;
var distance_to_ground = 25;//set this yourself
set(my,PASSABLE);
my.tilt = -90;//or 90
while(you){wait(1);
vec_set(my.x, vector(you.x,you.y,you.z-distance_to_ground));
}
ent_remove(me);
}
action enemy_act(){
//begining of action
...
ent_create("sShadow_Enemy.png",my.x,shadow_act);
...
//before the while loop
}
This just creates the shadow under the enemy, and follows it until the enemy is removed.
Last edited by DLively; 07/05/14 18:16.
|
|
|
Re: mem error using custom shadow
[Re: Reconnoiter]
#442947
07/06/14 18:04
07/06/14 18:04
|
Joined: Jul 2007
Posts: 620 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 620
Turkey, Izmir
|
PNG images behave like 32 bit TGA images with alpha channel (even if the channel was not explicitly created in the pain program). They are not recommended because they are loaded not by the engine, but by the DirectX library, and are not guaranteed to be automatically restored when the video device gets lost. This means that they can lose their content f.i. when a fullscreen application is minimized. i don't think this is related with your problem but yes tga better than png.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|