Solved Bug with shadow trails

Question that is answered or resolved.

dantedevil

Well-known member
During the final test to share the first demo of my mod, i find a new bug.
This only happend when 2 players are playing.
Never happend when play alone.

4RJkunK.png


Sometimes the shadows of super combo shows bad, like in the picture. Other times the shadows only shows with normal colors, not blue like i set.
I start to have problems when change the update.c script to create a animated menu.
CRxTRDude helpme to solve the problem.
But yesterday , I discovered while playing with my daughter, that the problem is still there. I guess with three players also malfunction.

Here the files:

updated.c:
Code:
#include "data/scripts/anititle.c"
#include "data/scripts/story/story_define.h"
#include "data/scripts/story.c"
#include "data/scripts/gettick.c"


void zoom()
{
   void vscreen = openborvariant("vscreen");
   int maxz=openborvariant("PLAYER_MAX_Z")+1000;
   int zoom_value=getglobalvar("zoomvalue");
   int zoom_x=getglobalvar("zoomx");
   int zoom_y=getglobalvar("zoomy");
   void ent=getglobalvar("zoomentity");
   int px=getentityproperty(ent,"x") +  zoom_x - openborvariant("xpos");
   int py=getentityproperty(ent,"z") + zoom_y - openborvariant("ypos") - getentityproperty(ent,"a");
   void zoom_scr = getglobalvar("zoomscreen");
   if(!zoom_scr){
      zoom_scr = allocscreen(openborvariant("hResolution"),openborvariant("vResolution"));
      setglobalvar("zoomscreen",zoom_scr);
   }
   clearscreen(zoom_scr);

   //draw what we need
   drawspriteq(zoom_scr,0,openborconstant("MIN_INT"),maxz,0,0);
   //setup drawMethod
   changedrawmethod(NULL(),"reset",1);
   changedrawmethod(NULL(),"enabled",1);
   changedrawmethod(NULL(),"scalex",zoom_value);
   changedrawmethod(NULL(),"scaley",zoom_value);
   changedrawmethod(NULL(),"centerx",px);
   changedrawmethod(NULL(),"centery",py);
   //Draw the resized customized screen to main screen.
   drawscreen(zoom_scr,px,py, maxz+1);
   changedrawmethod(NULL(),"enabled", 0);
   drawspriteq(vscreen, 0, maxz+1,maxz+1, 0, 0);
   drawspriteq(vscreen, 0, maxz+2,openborconstant("MAX_INT"), 0, 0);
   clearspriteq();
}


void main(){
   if(getglobalvar("zoomentity"))
   {
      zoom();      
   }
      mainLoop();
}

void mainLoop(){
    void scene=openborvariant("current_scene");
    if(openborvariant("in_level"))
    {
        turnWhite();
        storySystem();
    }
    if(openborvariant("in_titlescreen")){
        if (scene!="data/scenes/intro.txt"){
            inTitleLoop(1);
        }
    }
    else {
        inTitleLoop(0);   
    }
}





Here a example the trailer.c of Raiden :
Code:
#include "data/scripts/trailer.h"

void main()
{
    int i, j, k;
    void spr;
    int facing, cd;
    float a, z, x;
   
    void ent = getlocalvar("self");
    int anim = getentityproperty(ent, "animationid");
    void map;
    int elapsed_time = openborvariant("elapsed_time");

    if(anim == openborconstant("ANI_FREESPECIAL5")){ map = getentityproperty(ent, "colourtable", 0);}
    if(anim == openborconstant("ANI_FOLLOW8")){ map = getentityproperty(ent, "colourtable", 0);}
    if(anim == openborconstant("ANI_FOLLOW9")){ map = getentityproperty(ent, "colourtable", 0);}
    if(anim == openborconstant("ANI_FREESPECIAL14")){ map = getentityproperty(ent, "colourtable", 0);}
    setglobalvar("blahblah.map", map);


    if(elapsed_time%trailerd==0)
    {
        if((anim == openborconstant("ANI_FREESPECIAL5")) || (anim == openborconstant("ANI_FOLLOW8")) || (anim == openborconstant("ANI_FOLLOW9")) || (anim == openborconstant("ANI_FREESPECIAL14")))
        {
        spr = getentityproperty(ent, "sprite");
        x = getentityproperty(ent, "x");
        z = getentityproperty(ent, "z");
        a = getentityproperty(ent, "a");
        facing = !getentityproperty(ent, "direction");
        for(k=1; k<=trailermax; k++) //find an empty trailer slot
        {
            if(getglobalvar("trailer"+k+".s")==NULL())
            {
                setglobalvar("trailer"+k+".s", spr);
                setglobalvar("trailer"+k+".x", x);
                setglobalvar("trailer"+k+".z", z);
                setglobalvar("trailer"+k+".a", a);
                setglobalvar("trailer"+k+".f", facing);
                setglobalvar("trailer"+k+".c", trailerc*trailerd);
                break;
            }
        }
    }
    }
}

Here trailer.h:

Code:
int trailermax = 50; //total trailers the engine can handle
int trailerc = 5; // totally 5 trailer images for each character
int trailerd = 15; // delay to spawn next trailer, so trailer lasts for trailermax*trailerd


In every Level i must set:

updatescript data/scripts/traileru.c

Here the script:
Code:
#include "data/scripts/trailer.h"

void main()
{
    int i, j, k;
    void spr;
    int facing, cd;
    float a, z, x;
    float sx = 256;
    float sy = 256;
void map = getglobalvar("blahblah.map");
    for(i=1; i<=trailermax; i++)
    {
        spr = getglobalvar("trailer"+i+".s");
        if(spr)
        {
            cd = getglobalvar("trailer"+i+".c");
            if(!cd)
            {
                setglobalvar("trailer"+i+".c", NULL());
                setglobalvar("trailer"+i+".s", NULL());
                setglobalvar("trailer"+i+".x", NULL());
                setglobalvar("trailer"+i+".z", NULL());
                setglobalvar("trailer"+i+".a", NULL());
                setglobalvar("trailer"+i+".sx", NULL());
                setglobalvar("trailer"+i+".sy", NULL());
            }
            else
            {
                if(openborvariant("game_paused")==0)
                {
                    setglobalvar("trailer"+i+".c", cd-1);
                }
                x = getglobalvar("trailer"+i+".x");
                z = getglobalvar("trailer"+i+".z");
                a = getglobalvar("trailer"+i+".a");
                if ( getglobalvar("trailer"+i+".sx") != NULL()) { sx = getglobalvar("trailer"+i+".sx"); }
                if ( getglobalvar("trailer"+i+".sy") != NULL()) { sy = getglobalvar("trailer"+i+".sy"); }
                facing = getglobalvar("trailer"+i+".f");
                                //,entity ,flag ,scalex ,scaley ,flipx ,flipy ,shiftx ,alpha ,colourmap ,fillcolour ,rotate ,rotateflip ,transparencybg
                                //setdrawmethod(NULL(),1, 256,256,facing,0,0,6,0,0,0,0,0,getglobalvar("trailer"+i+".colormap"));
                                setdrawmethod(NULL(),1, sx, sy,facing,0,0,6,0,0,0,0,0,map);
                                //drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos"), z-i, 0);

                //setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, 6, 0);
                //drawsprite(sprite, int x, int y, int z, int sortid)
                drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos")-3, z-i, 0);
                                //setdrawmethod(NULL(),0, 256, 256,0,    0,0,0,0,0,0,0,0,NULL());
            }
        }
    }
}
 
Last edited:
Solution
dantedevil said:
OK, thanks.

Last question of this:
Code:
#import "data/scripts/shadowtrail.c"

void main() {
  void player = getlocalvar("self");

  check_shadow_trail(player);



    if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") < 7 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") >= 7 ) {
        set_shad_trail_flag(player,0);
    }   

    else if ( getentityproperty(player, "defaultmodel") ==...
Back
Top Bottom