📄 premap.c
字号:
{
connecthead = 0;
connectpoint2[0] = -1;
}
}
void resetpspritevars(char g)
{
short i, j, nexti,circ;
long firstx,firsty;
spritetype *s;
char aimmode[MAXPLAYERS];
STATUSBARTYPE tsbar[MAXPLAYERS];
EGS(ps[0].cursectnum,ps[0].posx,ps[0].posy,ps[0].posz,
APLAYER,0,0,0,ps[0].ang,0,0,0,10);
if(ud.recstat != 2) for(i=0;i<MAXPLAYERS;i++)
{
aimmode[i] = ps[i].aim_mode;
if(ud.multimode > 1 && ud.coop == 1 && ud.last_level >= 0)
{
for(j=0;j<MAX_WEAPONS;j++)
{
tsbar[i].ammo_amount[j] = ps[i].ammo_amount[j];
tsbar[i].gotweapon[j] = ps[i].gotweapon[j];
}
tsbar[i].shield_amount = ps[i].shield_amount;
tsbar[i].curr_weapon = ps[i].curr_weapon;
tsbar[i].inven_icon = ps[i].inven_icon;
tsbar[i].firstaid_amount = ps[i].firstaid_amount;
tsbar[i].steroids_amount = ps[i].steroids_amount;
tsbar[i].holoduke_amount = ps[i].holoduke_amount;
tsbar[i].jetpack_amount = ps[i].jetpack_amount;
tsbar[i].heat_amount = ps[i].heat_amount;
tsbar[i].scuba_amount = ps[i].scuba_amount;
tsbar[i].boot_amount = ps[i].boot_amount;
}
}
resetplayerstats(0);
for(i=1;i<MAXPLAYERS;i++)
memcpy(&ps[i],&ps[0],sizeof(ps[0]));
if(ud.recstat != 2) for(i=0;i<MAXPLAYERS;i++)
{
ps[i].aim_mode = aimmode[i];
if(ud.multimode > 1 && ud.coop == 1 && ud.last_level >= 0)
{
for(j=0;j<MAX_WEAPONS;j++)
{
ps[i].ammo_amount[j] = tsbar[i].ammo_amount[j];
ps[i].gotweapon[j] = tsbar[i].gotweapon[j];
}
ps[i].shield_amount = tsbar[i].shield_amount;
ps[i].curr_weapon = tsbar[i].curr_weapon;
ps[i].inven_icon = tsbar[i].inven_icon;
ps[i].firstaid_amount = tsbar[i].firstaid_amount;
ps[i].steroids_amount= tsbar[i].steroids_amount;
ps[i].holoduke_amount = tsbar[i].holoduke_amount;
ps[i].jetpack_amount = tsbar[i].jetpack_amount;
ps[i].heat_amount = tsbar[i].heat_amount;
ps[i].scuba_amount= tsbar[i].scuba_amount;
ps[i].boot_amount = tsbar[i].boot_amount;
}
}
numplayersprites = 0;
circ = 2048/ud.multimode;
which_palookup = 9;
j = connecthead;
i = headspritestat[10];
while(i >= 0)
{
nexti = nextspritestat[i];
s = &sprite[i];
if( numplayersprites == MAXPLAYERS)
gameexit("\nToo many player sprites (max 16.)");
if(numplayersprites == 0)
{
firstx = ps[0].posx;
firsty = ps[0].posy;
}
po[numplayersprites].ox = s->x;
po[numplayersprites].oy = s->y;
po[numplayersprites].oz = s->z;
po[numplayersprites].oa = s->ang;
po[numplayersprites].os = s->sectnum;
numplayersprites++;
if(j >= 0)
{
s->owner = i;
s->shade = 0;
s->xrepeat = 42;
s->yrepeat = 36;
s->cstat = 1+256;
s->xoffset = 0;
s->clipdist = 64;
if( (g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0)
{
ps[j].last_extra = max_player_health;
s->extra = max_player_health;
}
else s->extra = ps[j].last_extra;
s->yvel = j;
if(s->pal == 0)
{
s->pal = ps[j].palookup = which_palookup;
which_palookup++;
if( which_palookup >= 17 ) which_palookup = 9;
}
else ps[j].palookup = s->pal;
ps[j].i = i;
ps[j].frag_ps = j;
hittype[i].owner = i;
hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z;
ps[j].oang = ps[j].ang = s->ang;
updatesector(s->x,s->y,&ps[j].cursectnum);
j = connectpoint2[j];
}
else deletesprite(i);
i = nexti;
}
}
void clearfrags(void)
{
short i;
for(i = 0;i<MAXPLAYERS;i++)
ps[i].frag = ps[i].fraggedself = 0;
clearbufbyte(&frags[0][0],(MAXPLAYERS*MAXPLAYERS)<<1,0L);
}
void resettimevars(void)
{
vel = svel = angvel = horiz = 0;
totalclock = 0L;
cloudtotalclock = 0L;
ototalclock = 0L;
lockclock = 0L;
ready2send = 1;
}
void genspriteremaps(void)
{
long j,fp;
signed char look_pos;
char *lookfn = "lookup.dat";
char numl;
fp = kopen4load(lookfn,0);
if(fp != -1)
kread(fp,(char *)&numl,1);
else
gameexit("\nERROR: File 'LOOKUP.DAT' not found.");
for(j=0;j < numl;j++)
{
kread(fp,(signed char *)&look_pos,1);
kread(fp,tempbuf,256);
makepalookup((long)look_pos,tempbuf,0,0,0,1);
}
kread(fp,&waterpal[0],768);
kread(fp,&slimepal[0],768);
kread(fp,&titlepal[0],768);
kread(fp,&drealms[0],768);
kread(fp,&endingpal[0],768);
palette[765] = palette[766] = palette[767] = 0;
slimepal[765] = slimepal[766] = slimepal[767] = 0;
waterpal[765] = waterpal[766] = waterpal[767] = 0;
kclose(fp);
}
void waitforeverybody()
{
long i;
if (numplayers < 2) return;
packbuf[0] = 250;
for(i=connecthead;i>=0;i=connectpoint2[i])
if (i != myconnectindex)
sendpacket(i,packbuf,1);
playerreadyflag[myconnectindex]++;
do
{
getpackets();
for(i=connecthead;i>=0;i=connectpoint2[i])
if (playerreadyflag[i] < playerreadyflag[myconnectindex]) break;
} while (i >= 0);
}
void dofrontscreens(void)
{
long tincs,i,j;
if(ud.recstat != 2)
{
ps[myconnectindex].palette = palette;
for(j=0;j<63;j+=7) palto(0,0,0,j);
i = ud.screen_size;
ud.screen_size = 0;
vscrn();
clearview(0L);
rotatesprite(320<<15,200<<15,65536L,0,LOADSCREEN,0,0,2+8+64,0,0,xdim-1,ydim-1);
if( boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 )
{
menutext(160,90,0,0,"ENTERING USER MAP");
gametextpal(160,90+10,boardfilename,14,2);
}
else
{
menutext(160,90,0,0,"ENTERING");
menutext(160,90+16+8,0,0,level_names[(ud.volume_number*11) + ud.level_number]);
}
nextpage();
for(j=63;j>0;j-=7) palto(0,0,0,j);
KB_FlushKeyboardQueue();
ud.screen_size = i;
}
else
{
clearview(0L);
ps[myconnectindex].palette = palette;
palto(0,0,0,0);
rotatesprite(320<<15,200<<15,65536L,0,LOADSCREEN,0,0,2+8+64,0,0,xdim-1,ydim-1);
menutext(160,105,0,0,"LOADING...");
nextpage();
}
}
void clearfifo(void)
{
syncvaltail = 0L;
syncvaltottail = 0L;
syncstat = 0;
bufferjitter = 1;
mymaxlag = otherminlag = 0;
movefifoplc = movefifosendplc = fakemovefifoplc = 0;
avgfvel = avgsvel = avgavel = avghorz = avgbits = 0;
otherminlag = mymaxlag = 0;
clearbufbyte(myminlag,MAXPLAYERS<<2,0L);
clearbufbyte(&loc,sizeof(input),0L);
clearbufbyte(&sync[0],sizeof(sync),0L);
clearbufbyte(inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L);
clearbuf(movefifoend,MAXPLAYERS,0L);
clearbuf(syncvalhead,MAXPLAYERS,0L);
clearbuf(myminlag,MAXPLAYERS,0L);
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01);
}
void resetmys(void)
{
myx = omyx = ps[myconnectindex].posx;
myy = omyy = ps[myconnectindex].posy;
myz = omyz = ps[myconnectindex].posz;
myxvel = myyvel = myzvel = 0;
myang = omyang = ps[myconnectindex].ang;
myhoriz = omyhoriz = ps[myconnectindex].horiz;
myhorizoff = omyhorizoff = ps[myconnectindex].horizoff;
mycursectnum = ps[myconnectindex].cursectnum;
myjumpingcounter = ps[myconnectindex].jumping_counter;
myjumpingtoggle = ps[myconnectindex].jumping_toggle;
myonground = ps[myconnectindex].on_ground;
myhardlanding = ps[myconnectindex].hard_landing;
myreturntocenter = ps[myconnectindex].return_to_center;
}
void enterlevel(char g)
{
short i,j;
long l;
char levname[256];
if( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat;
ud.respawn_monsters = ud.m_respawn_monsters;
ud.respawn_items = ud.m_respawn_items;
ud.respawn_inventory = ud.m_respawn_inventory;
ud.monsters_off = ud.m_monsters_off;
ud.coop = ud.m_coop;
ud.marker = ud.m_marker;
ud.ffire = ud.m_ffire;
if( (g&MODE_DEMO) == 0 && ud.recstat == 2)
ud.recstat = 0;
FX_StopAllSounds();
clearsoundlocks();
FX_SetReverb(0);
i = ud.screen_size;
ud.screen_size = 0;
dofrontscreens();
vscrn();
ud.screen_size = i;
#ifndef VOLUMEONE
if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
{
if ( loadboard( boardfilename,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1 )
{
sprintf(tempbuf,"Map %s not found!",boardfilename);
gameexit(tempbuf);
}
}
else if ( loadboard( level_file_names[ (ud.volume_number*11)+ud.level_number],&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1)
{
sprintf(tempbuf,"Map %s not found!",level_file_names[(ud.volume_number*11)+ud.level_number]);
gameexit(tempbuf);
}
#else
l = strlen(level_file_names[ (ud.volume_number*11)+ud.level_number]);
copybufbyte( level_file_names[ (ud.volume_number*11)+ud.level_number],&levname[0],l);
levname[l] = 255;
levname[l+1] = 0;
if ( loadboard( levname,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1)
{
sprintf(tempbuf,"Map %s not found!",level_file_names[(ud.volume_number*11)+ud.level_number]);
gameexit(tempbuf);
}
#endif
clearbufbyte(gotpic,sizeof(gotpic),0L);
prelevel(g);
allignwarpelevators();
resetpspritevars(g);
cachedebug = 0;
automapping = 0;
if(ud.recstat != 2) MUSIC_StopSong();
cacheit();
if(ud.recstat != 2)
{
music_select = (ud.volume_number*11) + ud.level_number;
playmusic(&music_fn[0][music_select][0]);
}
if( (g&MODE_GAME) || (g&MODE_EOL) )
ps[myconnectindex].gm = MODE_GAME;
else if(g&MODE_RESTART)
{
if(ud.recstat == 2)
ps[myconnectindex].gm = MODE_DEMO;
else ps[myconnectindex].gm = MODE_GAME;
}
if( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART )
opendemowrite();
#ifdef VOLUMEONE
if(ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]);
#endif
for(i=connecthead;i>=0;i=connectpoint2[i])
switch(sector[sprite[ps[i].i].sectnum].floorpicnum)
{
case HURTRAIL:
case FLOORSLIME:
case FLOORPLASMA:
resetweapons(i);
resetinventory(i);
ps[i].gotweapon[PISTOL_WEAPON] = 0;
ps[i].ammo_amount[PISTOL_WEAPON] = 0;
ps[i].curr_weapon = KNEE_WEAPON;
ps[i].kickback_pic = 0;
break;
}
//PREMAP.C - replace near the my's at the end of the file
resetmys();
ps[myconnectindex].palette = palette;
palto(0,0,0,0);
setpal(&ps[myconnectindex]);
flushperms();
everyothertime = 0;
global_random = 0;
ud.last_level = ud.level_number+1;
clearfifo();
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
restorepalette = 1;
flushpackets();
waitforeverybody();
palto(0,0,0,0);
vscrn();
clearview(0L);
drawbackground();
displayrooms(myconnectindex,65536);
clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
ps[myconnectindex].over_shoulder_on = 0;
clearfrags();
resettimevars(); // Here we go
}
/*
Duke Nukem V
Layout:
Settings:
Suburbs
Duke inflitrating neighborhoods inf. by aliens
Death Valley:
Sorta like a western. Bull-skulls halb buried in the sand
Military compound: Aliens take over nuke-missle silo, duke
must destroy.
Abondend Aircraft field
Vegas:
Blast anything bright! Alien lights camoflauged.
Alien Drug factory. The Blue Liquid
Mountainal Cave:
Interior cave battles.
Jungle:
Trees, canopee, animals, a mysterious hole in the earth
Penetencury:
Good use of spotlights:
Inventory:
Wood,
Metal,
Torch,
Rope,
Plastique,
Cloth,
Wiring,
Glue,
Cigars,
Food,
Duck Tape,
Nails,
Piping,
Petrol,
Uranium,
Gold,
Prism,
Power Cell,
Hand spikes (Limited usage, they become dull)
Oxygent (Oxygen mixed with stimulant)
Player Skills:
R-Left,R-Right,Foward,Back
Strafe, Jump, Double Flip Jump for distance
Help, Escape
Fire/Use
Use Menu
Programming:
Images: Polys
Actors:
Multi-Object sections for change (head,arms,legs,torsoe,all change)
Facial expressions. Pal lookup per poly?
struct imagetype
{
int *itable; // AngX,AngY,AngZ,Xoff,Yoff,Zoff;
int *idata;
struct imagetype *prev, *next;
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -