Problem with fpg

Started by blabla, April 24, 2011, 06:07:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blabla

Hello !
I've a problem with my game.
I load a fpg , no problem.But when i unload it and after that  i load another fpg , it doesn't work !
The fpg doesn't load at all ! And strangely , it works perfectly on Fenix.
To finish , the last version of BennuGD doesn't work on my computer (r244) but the r243 works.
Here's my code (My code on this post is not complete) :


PROGRAM Morshuthemmm;

import "mod_blendop"
import "mod_cd"
import "mod_debug"
import "mod_dir"
import "mod_draw"
import "mod_effects"
import "mod_file"
import "mod_flic"
import "mod_grproc"
import "mod_joy"
import "mod_key"
import "mod_m7"
import "mod_map"
import "mod_math"
import "mod_mem"
import "mod_mouse"
import "mod_path"
import "mod_proc"
import "mod_rand"
import "mod_regex"
import "mod_say"
import "mod_screen"
import "mod_scroll"
import "mod_sort"
import "mod_sound"
import "mod_string"
import "mod_sys"
import "mod_text"
import "mod_time"
import "mod_timers"
import "mod_video"
import "mod_wm"

GLOBAL
wait=0;
song_mmm;
mmm;
fondx=320;
morgr=1;
playerx = 320;
playery = 400;
cote=0;
walk=0;
waitB=0;
wait2=0;
int file_id;
expl=0;
bombx;
bomby;
gr;
cotedef=0;
wait3=0;
lifeyou=6;
lifeenn=1;
lifeenn2=1;
lifeenn3=1;
x2;
x3;
y2;
y3;
gwonamx=-160;
gwonamy=380;
history=0;
wav1;
wav2;
wav3;
wav4;
wav5;
wav6;
wav7;
wav8;
wav9;
wav10;
wav11;
wav12;
wav13;
wait4;
position;
coteenn=0;
invin=0;
invinT=0;
invin2=0;
invinT2=0;
invin3=0;
invinT3=0;
exx;
exy;
ale;
map=0;
necpc=0;
bas = 0;
INSX = -320;
INSY = -320;
langue = 0;
dod=0;
BEGIN

        set_mode(640,480,16);
Set_fps(30,0);
file_id = load_fpg("DATA/title.fpg");
mmm = load_song("DATA/presentation.xm");
        play_song(mmm,0);
put_screen(0,4);


LOOP
        if(key(_esc))
                exit(0,0);
        end
        if(key(_space))
clear_screen();
fade_off();
language();
        end

wait += 1;

if (wait > 250)
clear_screen();
fade_off();
language();
end


FRAME;
END
END

PROCESS FOND(x,y)

begin
graph = 1;
z=5;


    loop
    x=fondx;
frame;
end
end

PROCESS GMORSHU(x,y)

begin
graph = 2;
x = 320;
y = 240;
z=4;

    loop

if (waitB > 2)
graph +=1;
waitB = 0;
end
waitB +=1;
if (graph > 3)
graph = 2;
end

frame;
end
end

PROCESS INS(x,y)

begin
graph = 5;
x = INSX;
y = INSY;
z=2;

    loop

if(key(_control))
x = 320;
    y = 240;
        else
x = -320;
y = -320;
end

frame;
end
end

PROCESS language();

BEGIN
let_me_alone();
pause_song();
fade_on();
stop_wav(ALL_SOUND);
langue = 0;


LOOP
delete_text(ALL_TEXT);
write(0,320,100,4,"Choose your language");
write(0,320,110,4,"Choissisez votre langue");

write(0,320,200,4,"Gauche - Français");
write(0,320,220,4,"Right - English");

if (key(_left))
langue = 0;
fade_off();
titlescreen();
end

if (key(_right))
langue = 1;
fade_off();
titlescreen();
end

frame;
end
end


PROCESS titlescreen();

LOCAL
choice=0;

BEGIN
fade_on();
INSX = -320;
INSY = -320;
fondx = 320;
wait=0;
waitB=0;
map=0;
x=250;
y=420;
Set_fps(30,0);
unload_wav(mmm);
unload_fpg(file_id);
file_id = load_fpg("DATA/title.fpg");
delete_text(ALL_TEXT);
let_me_alone();
FOND(320,240);
GMORSHU(320,240);
INS(320,240);
song_mmm = load_song("DATA/title.xm");
play_song(song_mmm,0);

LOOP

        delete_text(ALL_TEXT);

if (wait < 12)
    wait+=1;
end

write(0,x,y,4,"->");

if (langue == 0)
        write(0,320,420,4,"Nouvelle partie");
IF (file_exists("Savefile.sav"))
write(0,320,440,4,"Charger une partie");
end
write(0,100,450,0,"Controle pour les instructions");
end
if (langue == 1)
        write(0,320,420,4,"New game");
IF (file_exists("Savefile.sav"))
write(0,320,440,4,"Load a save");
end
write(0,100,450,0,"Control for instructions");
end

if (file_exists("Savefile.sav") == false)
choice = 0;
end

if(key(_down) and wait > 5 and choice == 0 and file_exists("Savefile.sav") and key(_control) == false)
    y = 440;
choice = 1;
wait = 0;
        end
if(key(_up) and wait > 5 and choice == 1 and key(_control) == false)
    y = 420;
choice = 0;
wait = 0;
        end

if(key(_space) and wait > 10 and choice == 0 and key(_control) == false)
clear_screen();
unload_wav(song_mmm);
        let_me_alone();
fade_off();
introduction();
        end

if(key(_space) and wait > 10 and choice == 1 and key(_control) == false)
IF (file_exists("Savefile.sav"))
Load("Savefile.sav",map);
END

if (map == 0)
clear_screen();
unload_wav(song_mmm);
        let_me_alone();
fade_off();
introduction();
end

if (map == 1)
clear_screen();
fade_off();
unload_song(mmm);
unload_fpg(file_id);
file_id = load_fpg("DATA/sprite2.fpg");
lifeyou = 6;
fondx = 320;
history = 1;
game98();
end

if (map > 1 and map < 4)
unload_fpg(file_id);
file_id = load_fpg("DATA/lvl2.fpg");
mmm = load_song("DATA/Zelda.s3m");
lifeyou = 6;
fondx = 320;
map = 2;
history = 1;
fade_off();
lvl2();
end

        end

        if(key(_esc))
                exit(0,0);
        end

FRAME;

END
END



PROCESS video(x,y)

begin

graph = 1;
x = 320;
y = 220;
z=5;

    loop
        delete_text(ALL_TEXT);

graph +=1;

if (langue == 0)

if (graph > 54 and graph < 75)
write(0,320,400,4,"Votre majeste.");
end

if (graph > 75 and graph < 123)
write(0,320,400,4,"Morshu et ses fideles se sont");
write(0,320,420,4,"empares de l'ile de koridai.");
end

if (graph > 120 and graph < 150)
write(0,320,400,4,"Que pouvons-nous faire ?");
end

if (graph > 147 and graph < 207)
write(0,320,400,4,"Il est ecrit :");
write(0,320,420,4,"Seul le roi peut vaincre Morshu.");
end

if (graph > 207 and graph < 234)
write(0,320,400,4,"Morshu , tu vas mourrir !");
end

if (graph > 234 and graph < 255)
write(0,320,400,4,"Et sourrire autrement !");
end

if (graph > 258 and graph < 282)
write(0,320,400,4,"Allez ! Emmenez le roi !");
end

if (graph > 282 and graph < 300)
write(0,320,400,4,"Bien , mon seigneur !");
end

end


if (langue == 1)

if (graph > 54 and graph < 75)
write(0,320,400,4,"Your majesty.");
end

if (graph > 75 and graph < 123)
write(0,320,400,4,"Morshu and his minions have seized");
write(0,320,420,4,"the Island of Koridai.");
end

if (graph > 120 and graph < 150)
write(0,320,400,4,"How can we help ?");
end

if (graph > 147 and graph < 207)
write(0,320,400,4,"It is written :");
write(0,320,420,4,"Only the King can defeat Morshu.");
end

if (graph > 207 and graph < 234)
write(0,320,400,4,"Morshu , you will die !");
end

if (graph > 234 and graph < 255)
write(0,320,400,4,"And smile differently !");
end

if (graph > 258 and graph < 282)
write(0,320,400,4,"Take me the King !");
end

if (graph > 282 and graph < 300)
write(0,320,400,4,"Yes , my lord !");
end

end



if (graph > 342)
fade_off();
game();
end

        if(key(_space) and graph > 8)
fade_off();
game();
        end

frame;
end
end



PROCESS introduction();

BEGIN
fade_on();
        delete_text(ALL_TEXT);
Set_fps(15,0);
        let_me_alone();
unload_fpg(file_id);
file_id = load_fpg("DATA/Film.fpg");
mmm = load_song("DATA/son.xm");
        play_song(mmm,0);
        video(320,220);
LOOP


        if(key(_esc))
                exit(0,0);
        end



FRAME;
END
END

handsource-dyko

I see that you mix uppercase and lower case characters in filenames and directorynames. That's a potential hazzard, and possibly the reason the fpg doesn't load. Are you running bennu/fenix under linux or windows?  That may be the root of the problem. On linux and unix style systems, bennu is case sensitive with filenames.

Try renaming the file and directory names to lowercase and change this in the sourcecode as well. Also, and that's likely the real cause of the problem, is that you try to load several different fpg files to the same identifier. Bennu will get confused, and probably assign the last loaded file to file_id. Just give each file you load it's own unique identifier (you can use array's to put them under one name).

l1nk3rn3l

open fpg with fpg editor .. and save it again...

this all !!!

blabla

Sorry but i've tried everything and always the same problem and I'm on Windows.
I've check with Windows Task Manager and the fpg load but my code doesn't want to show the image.
Maybe an idea ?

l1nk3rn3l

pass your code.. and fpg.. please...


can beee...

file= fpg_load ...
graph= ###