shadowboxer2007
03-16-2007, 09:09 AM
If i whated to be mean I would release zeldaclassic source code! prof you ask
if(get_bit(zinit.misc,idM_CONTPERCENT))
{
set_gamedata_life(game, ((get_gamedata_maxlife(game)*zinit.cont_heart/100)/HP_PER_HEART)*HP_PER_HEART);
}
else
{
set_gamedata_life(game, zinit.cont_heart*HP_PER_HEART);
}
}
set_gamedata_hasplayed(game, 1);
if(get_bit(quest_rules,qr_CONTFULL))
set_gamedata_life(game, get_gamedata_maxlife(game));
/*
else
game->life=3*HP_PER_HEART;
*/
//int type = (DMaps[currdmap].type&dmfTYPE);
//subscreen_object *css=default_subscreen_top[zinit.subscreen][!(type == dmOVERW || type == dmBSOVERW)];
load_Sitems();
selectBwpn(0,0);
selectAwpn(0);
reset_subscr_items();
Link.setDontDraw(false);
show_subscreen_dmap_dots=true;
show_subscreen_items=true;
show_subscreen_numbers=true;
show_subscreen_life=true;
// for(int i=0; i<128; i++)
// key[i]=0;
Playing=true;
lighting(2,Link.getDir());
map_bkgsfx();
openscreen();
show_subscreen_numbers=true;
show_subscreen_life=true;
dointro();
loadguys();
if(isdungeon() && currdmap>0)
{
Link.stepforward(get_bit(quest_rules,qr_LTTPWALK)? 11:12, false);
}
if(!Quit)
play_DmapMusic();
return 0;
}
int cont_game()
{
// introclk=intropos=msgclk=msgpos=dmapmsgclk=0;
didpit=false;
Link.unfreeze();
Link.reset_hookshot();
linkedmsgclk=0;
blockmoving=0;
add_asparkle=0;
add_bsparkle=0;
add_df1asparkle=false;
add_df1bsparkle=false;
add_nl1asparkle=false;
add_nl1bsparkle=false;
add_nl2asparkle=false;
add_nl2bsparkle=false;
/*
if(DMaps[currdmap].cont >= 0x80)
{
homescr = currscr = DMaps[0].cont;
currdmap = warpscr = worldscr=0;
currmap = DMaps[0].map;
dlevel = DMaps[0].level;
}
*/
currdmap = lastentrance_dmap;
homescr = currscr = lastentrance;
currmap = DMaps[currdmap].map;
dlevel = DMaps[currdmap].level;
for(int i=0; i<6; i++)
{
visited[i]=-1;
}
if(dlevel==0)
{
game->lvlitems[9]&=~liBOSS;
}
ALLOFF();
whistleclk=-1;
currcset=DMaps[currdmap].color;
darkroom=false;
loadscr(0,currscr,up);
putscr(scrollbuf,0,0,&tmpscr[0]);
loadfullpal();
ringcolor();
loadlvlpal(DMaps[currdmap].color);
Link.init();
if(get_bit(zinit.misc,idM_CONTPERCENT))
{
set_gamedata_life(game, ((get_gamedata_maxlife(game)*zinit.cont_heart/100)/HP_PER_HEART)*HP_PER_HEART);
}
else
{
set_gamedata_life(game, zinit.cont_heart*HP_PER_HEART);
}
if(get_bit(quest_rules,qr_CONTFULL))
set_gamedata_life(game, get_gamedata_maxlife(game));
/*
else
game->life=3*HP_PER_HEART;
*/
// for(int i=0; i<128; i++)
// key[i]=0;
Playing=true;
lighting(2,Link.getDir());
map_bkgsfx();
openscreen();
show_subscreen_numbers=true;
show_subscreen_life=true;
loadguys();
if(!Quit)
{
play_DmapMusic();
if(isdungeon())
Link.stepforward(get_bit(quest_rules,qr_LTTPWALK)? 11:12, false);
newscr_clk=frame;
activated_timed_warp=false;
}
return 0;
}
void restart_level()
{
blackscr(16,true);
if(dlevel)
{
currdmap = lastentrance_dmap;
homescr = currscr = lastentrance;
}
else
{
if ((DMaps[currdmap].type&dmfTYPE)==dmOVERW)
{
homescr = currscr = DMaps[currdmap].cont;
}
else
{
homescr = currscr = DMaps[currdmap].cont + DMaps[currdmap].xoff;
}
}
currmap = DMaps[currdmap].map;
dlevel = DMaps[currdmap].level;
for(int i=0; i<6; i++)
visited[i]=-1;
ALLOFF();
whistleclk=-1;
darkroom=false;
loadscr(0,currscr,up);
putscr(scrollbuf,0,0,&tmpscr[0]);
loadfullpal();
ringcolor();
loadlvlpal(DMaps[currdmap].color);
Link.init();
lighting(2,Link.getDir());
map_bkgsfx();
openscreen();
show_subscreen_numbers=true;
show_subscreen_life=true;
loadguys();
if(!Quit)
{
play_DmapMusic();
if(isdungeon())
Link.stepforward(get_bit(quest_rules,qr_LTTPWALK)? 11:12, false);
newscr_clk=frame;
activated_timed_warp=false;
}
}
void putintro()
{
if (!stricmp(" ", DMaps[currdmap].intro))
{
introclk=intropos=72;
return;
}
if(intropos>=72)
return;
if(((introclk++)%6<5)&&((!cAbtn()&&!cBbtn())||(!get_bit(quest_rules,qr_ALLOWFASTMSG)) ))
return;
dmapmsgclk=51;
if(intropos == 0)
{
while(DMaps[currdmap].intro[intropos]==' ')
++intropos;
}
sfx(WAV_MSG);
//using the clip value to indicate the bitmap is "dirty"
//rather than add yet another global variable
set_clip_state(msgdisplaybuf, 0);
textprintf_ex(msgdisplaybuf,zfont,((intropos%24)<<3)+32,((intropos/24)<<3)+40,CSET(0)+1,-1,
"%c",DMaps[currdmap].intro[intropos]);
++intropos;
if(DMaps[currdmap].intro[intropos]==' ' && DMaps[currdmap].intro[intropos+1]==' ')
while(DMaps[currdmap].intro[intropos]==' ')
++intropos;
if(intropos>=72)
{
// Link.unfreeze();
dmapmsgclk=50;
}
}
//static char *dirstr[4] = {"Up","Down","Left","Right"};
//static char *dirstr[32] = {"U","D","L","R"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "};
//use detail_int[x] for global detail info
void show_details()
{
if(details)
{
textprintf_ex(framebuf,font,-3,-5,WHITE,BLACK,"%-4d",whistleclk);
textprintf_ex(framebuf,font,0,8,WHITE,BLACK,"dlvl:%-2d dngn:%d", dlevel, isdungeon());
textprintf_ex(framebuf,font,0,176,WHITE,BLACK,"%ld %s",get_gamedata_time(game),time_str_long(get_gamedat a_time(game)));
/*
for(int i=0; i<guys.Count(); i++)
{
// textprintf_ex(framebuf,font,200,(i<<3)+16,WHITE,BLACK,"%3d %3d %3d %3d",((enemy*)guys.spr(i))->id,((enemy*)guys.spr(i))->timer,((enemy*)guys.spr(i))->clk,((enemy*)guys.spr(i))->clk2);
textprintf_ex(framebuf,font,100,(i<<3)+16,WHITE,BLACK,"%3d %3d %3d %2d %2d",(int)((enemy*)guys.spr(i))->x, (int)((enemy*)guys.spr(i))->y, ((enemy*)guys.spr(i))->misc, ((enemy*)guys.spr(i))->clk, ((enemy*)guys.spr(i))->clk2);//, dirstr[((enemy*)guys.spr(i))->dir], dirstr[((enemy*)guys.spr(i))->clk3]);
}
*/
for(int i=0; i<Ewpns.Count(); i++)
{
sprite *s=Ewpns.spr(i);
textprintf_ex(framebuf,font,100,(i<<3)+16,WHITE,BLACK,"%3d>%3d %3d>%3d %3d<%3d %3d<%3d ",
int(Link.getX()+0+16), int(s->x+s->hxofs), int(Link.getY()+0+16), int(s->y+s->hyofs),
int(Link.getX()+0), int(s->x+s->hxofs+s->hxsz), int(Link.getY()+0), int(s->y+s->hyofs+s->hysz));
}
// textprintf_ex(framebuf,font,200,16,WHITE,BLACK,"yofs=%3d",detail_int[0]);
}
}
void do_magic_casting()
{
static int tempx, tempy;
static byte linktilebuf[256];
int ltile=0; int lflip=0;
switch (magictype)
{
case mgc_none:
magiccastclk=0;
break;
case mgc_dinsfire:
{
int flamemax=32;
if (magiccastclk==0)
{
Lwpns.add(new weapon(LinkX(),LinkY(),wPhantom,pDINSFIREROCKET,0, up));
weapon *w1 = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w1->step=4;
// Link.tile=(BSZ)?32:29;
linktile(&Link.tile, &Link.flip, ls_landhold2, Link.getDir(), zinit.linkanimationstyle);
casty=Link.getY();
}
if (magiccastclk==64)
{
Lwpns.add(new weapon((fix)LinkX(),(fix)(-32),wPhantom,pDINSFIREROCKETRETURN,0,down));
weapon *w1 = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w1->step=4;
// Link.tile=29;
linktile(&Link.tile, &Link.flip, ls_landhold2, Link.getDir(), zinit.linkanimationstyle);
castnext=false;
}
if (castnext)
{
// Link.tile=4;
linktile(&Link.tile, &Link.flip, ls_cast, Link.getDir(), zinit.linkanimationstyle);
for (int flamecounter=((-1)*(flamemax/2))+1; flamecounter<((flamemax/2)+1); flamecounter++)
{
Lwpns.add(new weapon((fix)LinkX(),(fix)LinkY(),wFire,3,8*DAMAGE_ MULTIPLIER,0));
weapon *w = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w->step=2;
w->angular=true;
w->angle=(flamecounter*PI/(flamemax/2));
}
castnext=false;
magiccastclk=128;
}
/*
*/
if ((magiccastclk++)==226)
{
magictype=mgc_none;
}
}
break;
case mgc_faroreswind:
{
if (magiccastclk==0)
{
linktile(<ile, &lflip, ls_stab, down, zinit.linkanimationstyle);
unpack_tile(ltile, lflip, true);
memcpy(linktilebuf, unpackbuf, 256);
tempx=Link.getX();
tempy=Link.getY();
linktile(&Link.tile, &Link.flip, ls_pound, down, zinit.linkanimationstyle);
}
if (magiccastclk>=0&&magiccastclk<64)
{
Link.setX(tempx+((rand()%3)-1));
Link.setY(tempy+((rand()%3)-1));
}
if (magiccastclk==64)
{
Link.setX(tempx);
Link.setY(tempy);
linktile(&Link.tile, &Link.flip, ls_stab, down, zinit.linkanimationstyle);
}
if (magiccastclk==96)
{
Link.setDontDraw(true);
for (int i=0; i<16; ++i)
{
for (int j=0; j<16; ++j)
{
if(linktilebuf[i*16+j])
{
particles.add(new pFaroresWindDust(Link.getX()+j, Link.getY()+i, 5, 6, linktilebuf[i*16+j], rand()%96));
int k=particles.Count()-1;
particle *p = (particle*)(particles.spr(k));
p->angular=true;
p->angle=rand();
p->step=(((double)j)/8);
p->yofs=Link.getYOfs();
}
}
}
}
if ((magiccastclk++)==226)
{
//attackclk=0;
restart_level();
//xofs=0;
//action=none;
magictype=mgc_none;
Link.setDontDraw(false);
}
}
break;
case mgc_nayruslove:
{
if (magiccastclk==0)
{
Lwpns.add(new weapon(LinkX(),LinkY(),wPhantom,pNAYRUSLOVEROCKET1 ,0,left));
weapon *w1 = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w1->step=4;
Lwpns.add(new weapon(LinkX(),LinkY(),wPhantom,pNAYRUSLOVEROCKET2 ,0,right));
w1 = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w1->step=4;
// Link.tile=(BSZ)?32:29;
linktile(&Link.tile, &Link.flip, ls_cast, Link.getDir(), zinit.linkanimationstyle);
castx=Link.getX();
}
if (magiccastclk==64)
{
int d=max(LinkX(),256-LinkX())+32;
Lwpns.add(new weapon((fix)(LinkX()-d),(fix)LinkY(),wPhantom,pNAYRUSLOVEROCKETRETURN1, 0,right));
weapon *w1 = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w1->step=4;
Lwpns.add(new weapon((fix)(LinkX()+d),(fix)LinkY(),wPhantom,pNAY RUSLOVEROCKETRETURN2,0,left));
w1 = (weapon*)(Lwpns.spr(Lwpns.Count()-1));
w1->step=4;
// Link.tile=29;
linktile(&Link.tile, &Link.flip, ls_cast, Link.getDir(), zinit.linkanimationstyle);
castnext=false;
}
if (castnext)
{
// Link.tile=4;
linktile(&Link.tile, &Link.flip, ls_landhold2, Link.getDir(), zinit.linkanimationstyle);
Link.setNayrusLoveShieldClk(512);
castnext=false;
magiccastclk=128;
}
/*
*/
if ((magiccastclk++)==160)
{
magictype=mgc_none;
}
}
break;
default:
magiccastclk=0;
break;
}
}
void update_hookshot()
{
int hs_x, hs_y, hs_dx, hs_dy;
bool check_hs=false;
int dist_bx, dist_by, hs_w;
chainlinks.animate();
// char tempbuf[80];
// char tempbuf2[80];
//find out where the head is and make it
//easy to reference
if (Lwpns.idFirst(wHookshot)>-1)
{
check_hs=true;
}
if (check_hs)
{
hs_x=Lwpns.spr(Lwpns.idFirst(wHookshot))->x;
hs_y=Lwpns.spr(Lwpns.idFirst(wHookshot))->y;
hs_dx=hs_x-hs_startx;
hs_dy=hs_y-hs_starty;
//extending
if (((weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)))->misc==0)
{
if (chainlinks.Count()<zinit.hookshot_links) //extending chain
{
if (abs(hs_dx)>=hs_xdist+8)
{
hs_xdist=abs(hs_x-hs_startx);
chainlinks.add(new weapon((fix)hs_x, (fix)hs_y, wHSChain, 0,0,Link.getDir()));
}
else if (abs(hs_dy)>=hs_ydist+8)
{
hs_ydist=abs(hs_y-hs_starty);
chainlinks.add(new weapon((fix)hs_x, (fix)hs_y, wHSChain, 0,0,Link.getDir()));
}
} //stretching chain
else
{
dist_bx=(abs(hs_dx)-(8*chainlinks.Count()))/(chainlinks.Count()+1);
dist_by=(abs(hs_dy)-(8*chainlinks.Count()))/(chainlinks.Count()+1);
hs_w=8;
if (hs_dx<0)
{
dist_bx=0-dist_bx;
hs_w=-8;
}
if (hs_dy<0)
{
dist_by=0-dist_by;
hs_w=-8;
}
for (int counter=0; counter<chainlinks.Count(); counter++)
{
if (Link.getDir()>down) //chain is moving horizontally
{
chainlinks.spr(counter)->x=hs_startx+hs_w+dist_bx+(counter*(hs_w+dist_bx));
}
else
{
chainlinks.spr(counter)->y=hs_starty+hs_w+dist_by+(counter*(hs_w+dist_by));
}
}
}
} //retracting
else if (((weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)))->misc==1)
{
dist_bx=(abs(hs_dx)-(8*chainlinks.Count()))/(chainlinks.Count()+1);
dist_by=(abs(hs_dy)-(8*chainlinks.Count()))/(chainlinks.Count()+1);
hs_w=8;
if (hs_dx<0)
{
dist_bx=0-dist_bx;
hs_w=-8;
}
if (hs_dy<0)
{
dist_by=0-dist_by;
hs_w=-8;
}
if (Link.getDir()>down) //chain is moving horizontally
{
if (abs(hs_dx)-(8*chainlinks.Count())>0) //chain is stretched
{
for (int counter=0; counter<chainlinks.Count(); counter++)
{
chainlinks.spr(counter)->x=hs_startx+hs_w+dist_bx+(counter*(hs_w+dist_bx));
}
}
else
{
if (abs(hs_x-hs_startx)<=hs_xdist-8)
{
hs_xdist=abs(hs_x-hs_startx);
if (pull_link==false)
{
chainlinks.del(chainlinks.idLast(wHSChain));
}
else
{
chainlinks.del(chainlinks.idFirst(wHSChain));
}
}
}
} //chain is moving vertically
else
{
if (abs(hs_dy)-(8*chainlinks.Count())>0) //chain is stretched
{
for (int counter=0; counter<chainlinks.Count(); counter++)
{
chainlinks.spr(counter)->y=hs_starty+hs_w+dist_by+(counter*(hs_w+dist_by));
}
}
else
{
if (abs(hs_y-hs_starty)<=hs_ydist-8)
{
hs_ydist=abs(hs_y-hs_starty);
if (pull_link==false)
{
chainlinks.del(chainlinks.idLast(wHSChain));
}
else
{
chainlinks.del(chainlinks.idFirst(wHSChain));
}
}
}
}
}
}
}
void game_loop()
{
// walkflagx=0; walkflagy=0;
if(fadeclk>=0)
{
if(fadeclk==0 && currscr<128)
blockpath=false;
--fadeclk;
}
animate_combos();
mblock2.animate(0);
items.animate();
items.check_conveyor();
guys.animate();
roaming_item();
dragging_item();
Ewpns.animate();
checklink=true;
for(int i=0; i<(gofast?8:1); i++)
{
if(Link.animate(0))
{
if(!Quit)
Quit=qGAMEOVER;
return;
}
checklink=false;
}
do_magic_casting();
Lwpns.animate();
decorations.animate();
particles.animate();
update_hookshot();
if (conveyclk<=0)
{
conveyclk=3;
}
--conveyclk;
check_collisions();
dryuplake();
cycle_palette();
nosecretsounds=tmpscr->flags3&fNOSECRETSOUND;
draw_screen(tmpscr, 0, 0);
// v This is in draw_screen now
// putsubscr(framebuf,0,0);
if (linkedmsgclk==1)
{
//4 is for iwMore
if (wpnsbuf[iwMore].tile!=0)
{
putweapon(framebuf,zinit.msg_more_x, zinit.msg_more_y+56, wPhantom, 4, up, lens_hint_weapon[wPhantom][0], lens_hint_weapon[wPhantom][1]);
}
}
putintro();
if (dmapmsgclk>0)
{
Link.Freeze();
if (dmapmsgclk<=50)
{
--dmapmsgclk;
}
}
if (dmapmsgclk==1)
{
// if (!tmpscr[currscr>=128?1:0].str)
if (!msgstr)
{
//these are to cancel out any keys that Link may
//be pressing so he doesn't attack at the end of
//a message if he was scrolling through it quickly.
rAbtn();
rBbtn();
Link.unfreeze();
}
dmapmsgclk=0;
clear_bitmap(msgdisplaybuf);
set_clip_state(msgdisplaybuf, 1);
// clear_bitmap(pricesdisplaybuf);
}
if (!dmapmsgclk)
{
putmsg();
}
domoney();
domagic();
/*
if (tmpscr->layermap[2]!=0 || tmpscr->layermap[3]!=0 ||
tmpscr->layermap[4]!=0 || tmpscr->layermap[5]!=0 ||
overheadcombos(tmpscr))
{
masked_blit(msgdisplaybuf,framebuf,0,0,0,56,256,17 6);
masked_blit(pricesdisplaybuf,framebuf,0,0,0,56,256 ,176);
}
*/
if(lensclk)
{
draw_lens_over();
--lensclk;
}
// putpixel(framebuf, walkflagx, walkflagy+56, vc(int(rand()%16)));
}
/**************************/
/********** Main **********/
/**************************/
char cfg_error[] =
"\"ag.cfg\" not found. Please run \"agsetup.exe\"";
int main(int argc, char* argv[])
{
switch (IS_BETA)
{
case -1:
Z_title("Zelda Classic %s Alpha (Build %d)",VerStr(ZELDA_VERSION), VERSION_BUILD);break;
case 1:
Z_title("Zelda Classic %s Beta (Build %d)",VerStr(ZELDA_VERSION), VERSION_BUILD);break;
case 0:
Z_title("Zelda Classic %s (Build %d)",VerStr(ZELDA_VERSION), VERSION_BUILD);
}
// Z_title("Zelda Classic %s",VerStr(ZELDA_VERSION));
// check for the ag.cfg file and 1st.qst
Z_message("Checking Files... ");
int helpsize = file_size("zquest.txt");
if(helpsize==0)
{
Z_error("zquest.txt not found");
}
if(file_size("1st.qst")==0)
{
Z_error("\"1st.qst\" not found.");
}
if(file_size("2nd.qst")==0)
{
Z_error("\"2nd.qst\" not found.");
}
if(file_size("3rd.qst")==0)
{
Z_error("\"3rd.qst\" not found.");
}
Z_message("OK\n");
// allocate quest data buffers
memrequested+=4096;
Z_message("Allocating quest path buffers (%s)...", byte_conversion2(4096,memrequested,-1,-1));
qstdir = (char*)malloc(2048);
qstpath = (char*)malloc(2048);
if(!qstdir||!qstpath)
{
Z_error("Error");
}
qstdir[0] = 0;
qstpath[0] = 0;
Z_message("OK\n");
get_qst_buffers();
// initialize Allegro
Z_message("Initializing Allegro... ");
allegro_init();
three_finger_flag=false;
//atexit(&dumb_exit);
//dumb_register_stdfiles();
set_config_file("ag.cfg");
if(install_timer() < 0)
Z_error(allegro_error);
if(install_keyboard() < 0)
Z_error(allegro_error);
if(install_mouse() < 0)
Z_error(allegro_error);
if(install_joystick(JOY_TYPE_AUTODETECT) < 0)
Z_error(allegro_error);
LOCK_VARIABLE(logic_counter);
LOCK_FUNCTION(update_logic_counter);
install_int_ex(update_logic_counter, BPS_TO_TIMER(60));
Z_init_timers();
Z_message("OK\n");
// allocate bitmap buffers
Z_message("Allocating bitmap buffers... ");
if(used_switch(argc,argv,"-16bit"))
{
set_color_depth(16);
}
else
{
set_color_depth(8);
}
framebuf = create_bitmap_ex(8,256,224);
scrollbuf = create_bitmap_ex(8,512,406);
screen2 = create_bitmap_ex(8,320,240);
tmp_scr = create_bitmap_ex(8,320,240);
tmp_bmp = create_bitmap_ex(8,32,32);
fps_undo = create_bitmap_ex(8,64,16);
msgdisplaybuf = create_bitmap_ex(8,256, 176);
pricesdisplaybuf = create_bitmap_ex(8,256, 176);
if(!framebuf || !scrollbuf || !tmp_bmp || !fps_undo || !tmp_scr
|| !screen2 || !msgdisplaybuf || !pricesdisplaybuf)
Z_error("Error");
clear_bitmap(scrollbuf);
clear_bitmap(framebuf);
clear_bitmap(msgdisplaybuf);
set_clip_state(msgdisplaybuf, 1);
clear_bitmap(pricesdisplaybuf);
set_clip_state(pricesdisplaybuf, 1);
Z_message("OK\n");
// load game configurations
load_game_configs();
zcmusic_init();
// int mode = VidMode; // from config file
int tempmode=GFX_AUTODETECT;
int res_arg = used_switch(argc,argv,"-res");
if(used_switch(argc,argv,"-v0")) Vsync=false;
if(used_switch(argc,argv,"-v1")) Vsync=true;
/*
if(used_switch(argc,argv,"-16bit")) {
colordepth=16;
} else {
colordepth=8;
}
set_color_depth(colordepth);
*/
resolve_password(zeldapwd);
debug_enabled = used_switch(argc,argv,"-d") && !strcmp(get_config_string("zeldadx","debug",""),zeldapwd);
set_debug(debug_enabled);
bool fast_start = debug_enabled || used_switch(argc,argv,"-fast");
// load the data file
resolve_password(datapwd);
packfile_password(datapwd);
Z_message("Loading data files:\n");
set_color_conversion(COLORCONV_NONE);
sprintf(zeldadat_sig,"Zelda.Dat %s Build %d",VerStr(ZELDADAT_VERSION), ZELDADAT_BUILD);
sprintf(sfxdat_sig,"SFX.Dat %s Build %d",VerStr(SFXDAT_VERSION), SFXDAT_BUILD);
sprintf(fontsdat_sig,"Fonts.Dat %s Build %d",VerStr(FONTSDAT_VERSION), FONTSDAT_BUILD);
Z_message("Zelda.Dat...");
if((data=load_datafile("zelda.dat"))==NULL)
{
Z_error("failed");
}
if(strncmp((char*)data[0].dat,zeldadat_sig,23))
{
Z_error("\nIncompatible version of zelda.dat.\nPlease upgrade to %s Build %d",VerStr(ZELDADAT_VERSION), ZELDADAT_BUILD);
}
Z_message("OK\n");
Z_message("Fonts.Dat...");
if((fontsdata=load_datafile("fonts.dat"))==NULL)
{
Z_error("failed");
}
if(strncmp((char*)fontsdata[0].dat,fontsdat_sig,23))
{
Z_error("\nIncompatible version of fonts.dat.\nPlease upgrade to %s Build %d",VerStr(FONTSDAT_VERSION), FONTSDAT_BUILD);
}
Z_message("OK\n");
packfile_password(NULL);
Z_message("SFX.Dat...");
if((sfxdata=load_datafile("sfx.dat"))==NULL)
{
Z_error("failed");
}
if(strncmp((char*)sfxdata[0].dat,sfxdat_sig,21))
{
Z_error("\nIncompatible version of sfx.dat.\nPlease upgrade to %s Build %d",VerStr(SFXDAT_VERSION), SFXDAT_BUILD);
}
Z_message("OK\n");
mididata = (DATAFILE*)data[ZC_MIDI].dat;
set_uformat(U_ASCII);
deffont = font;
font = (FONT*)fontsdata[FONT_GUI_PROP].dat;
pfont = (FONT*)fontsdata[FONT_8xPROP_THIN].dat;
lfont = (FONT*)fontsdata[FONT_LARGEPROP].dat;
lfont_l = (FONT*)fontsdata[FONT_LARGEPROP_L].dat;
zfont = (FONT*)fontsdata[FONT_NES].dat;
z3font = (FONT*)fontsdata[FONT_Z3].dat;
z3smallfont = (FONT*)fontsdata[FONT_Z3SMALL].dat;
mfont = (FONT*)fontsdata[FONT_MATRIX].dat;
ztfont = (FONT*)fontsdata[FONT_ZTIME].dat;
sfont = (FONT*)fontsdata[FONT_6x6].dat;
spfont = (FONT*)fontsdata[FONT_6xPROP].dat;
ssfont1 = (FONT*)fontsdata[FONT_SUBSCREEN1].dat;
ssfont2 = (FONT*)fontsdata[FONT_SUBSCREEN2].dat;
ssfont3 = (FONT*)fontsdata[FONT_SUBSCREEN3].dat;
ssfont4 = (FONT*)fontsdata[FONT_SUBSCREEN4].dat;
// text_mode(0);
// load saved games
Z_message("Loading saved games... ");
if(load_savedgames()!=0)
{
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.