DCurrent / openbor

OpenBOR is the ultimate 2D side scrolling engine for beat em' ups, shooters, and more!
http://www.chronocrash.com
BSD 3-Clause "New" or "Revised" License
926 stars 124 forks source link

Compiled engine crash relating to script #210

Closed nsw27 closed 3 years ago

nsw27 commented 3 years ago

I saw a lot of issues closed lately so wanted to compile the current version of engine for PC to do some testing myself. But this version of engine crashes

says Unable to load file 'data/sprites/arrowl'

now i looked in folder and theres these new files i did not create !

arrowl.png 0MB blank file arrowl.gif 0MB blank file arrowl.bmp 0MB blank file arrowl.pcx 0MB blank file

I am guessing engine created these for some reason and thought I would report.

So i then copied and renamed a different file as arrowl.png and ran engine again and now it crashes with

Failed to parse script file: 'data/scripts/updated.c'!

here is what log says

`Loading scripts.............. Identifier expected before 'long'.

In file included from data/scripts/updated.c, line 3: Script error: data/scripts/gettick.c, line 7: Invalid external declaration 'long' (in production 'external_decl')

long get_tick() ^

In file included from data/scripts/updated.c, line 3: Script error: data/scripts/gettick.c, line 9: Invalid external declaration 'ret' (in production 'external_decl')

long ret;
     ^

In file included from data/scripts/updated.c, line 3: Script error: data/scripts/gettick.c, line 12: Invalid external declaration 'if' (in production 'external_decl')

if (lasttime==NULL()){lasttime=0;}
^

`

and here is my updated.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(){ MainLoop(); if(getglobalvar("zoomentity")) { zoom();
} }

void MainLoop(){ if(openborvariant("in_level")) {

    turnWhite();
    storySystem();
}

} `

Hope this info helps troubleshoot etc.

UPDATE: then just returned to older version of engone and removed save and config files and now that crashed due to updated.c so im guessing something was altered and corrupted ? luckily i had a backed up version of my game so here is the updated.c before using the new version of engine (I cant see any changes when glancing at it)

`#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(){ MainLoop(); if(getglobalvar("zoomentity")) { zoom();
} }

void MainLoop(){ if(openborvariant("in_level")) {

    turnWhite();
    storySystem();
}

} `

NOTE I am using unpacked version of game with data folder and empty.pak

when i test with a packed version of game it works ! so there is a issue with the engine corrupting files in data folder ! this is a huge bug and hopefully doesnt corrupt or destroy anyones work ! Hoping I have reported in time to prevent anyone heartache

DCurrent commented 3 years ago

Confirmed, bug is intermittent but definitely there. Couldn't pick a worse time, it will be a few days before I'm free again to deep dive into the code.

In the meantime if anyone is willing to compile previous revisions and find where this started it would go a long way toward helping resolve.

Thanks!

DCurrent commented 3 years ago

And then I see the second comment. Passive aggressive remarks about unrelated and proven non-existent issues are not welcome. Deleted, and if I see it again, you lose access to the repository.

DCurrent commented 3 years ago

Sent a message to @Plombo, in hopes he might know something off the bat before I dive in.

DCurrent commented 3 years ago

Thanks for the find @msmalik681!

msmalik681 commented 3 years ago

@DCurrent no problem i was the one who broke it but now the android build is broken i will see if i can find a alternative method to fix that.

DCurrent commented 3 years ago

@msmalik681, no worries, I've broken plenty of things too. It happens. Let's just make sure we're careful going forward. 👍

msmalik681 commented 3 years ago

@nsw27 can you confirm this is working for you now.

nsw27 commented 3 years ago

@msmalik681 yes seems to not cause any strange issue as before.

msmalik681 commented 3 years ago

Great

nsw27 commented 3 years ago

Actually an old bug has reappeared with this latest version you sent me. it now makes screenshots not work in game anymore

https://github.com/DCurrent/openbor/issues/195