Example #1
0
void P_ArchiveSpecials(void) {
    thinker_t*  th;
    int         i;

    for(th = thinkercap.next; th != &thinkercap; th = th->next) {
        if(th->function.acv == (actionf_v)NULL) {
            for(i = 0; i < MAXCEILINGS; i++) {
                if(activeceilings[i] == (ceiling_t *)th) {
                    break;
                }
            }

            if(i < MAXCEILINGS) {
                saveg_write8(tc_ceiling);
                saveg_write_pad();
                saveg_write_ceiling_t((ceiling_t *)th);
            }

            continue;
        }

        for(i = 0; saveg_specials[i].type != tc_endthinkers; i++) {
            if(th->function.acp1 == (actionf_p1)saveg_specials[i].function.acp1) {
                saveg_write8(saveg_specials[i].type);
                saveg_write_pad();
                saveg_specials[i].writefunc(th);
                saveg_write32(th == macrothinker ? 1 : 0);
                break;
            }
        }
    }

    // add a terminating marker
    saveg_write8(tc_endthinkers);
}
Example #2
0
void P_ArchiveMacros(void) {
    int i;

    saveg_write_pad();

    // [kex] 12/26/11 - keep track of disabled macros
    for(i = 0; i < macros.macrocount; i++) {
        saveg_write8(macros.def[i].data[0].id == 0 ? 1 : 0);
    }

    if(!macro) {
        saveg_write8(0);
        return;
    }

    saveg_write8(1);
    saveg_write16(macroid);
    saveg_write16(macrocounter);
    saveg_write16(nextmacro - macro->data);
    saveg_write_mobjindex(mobjmacro);
    saveg_write16(taglistidx);

    for(i = 0; i < MAXQUEUELIST; i++) {
        saveg_write16(taglist[i]);
    }
}
Example #3
0
//
// P_ArchiveThinkers
//
// [STRIFE] Verified unmodified.
//
void P_ArchiveThinkers (void)
{
    thinker_t*          th;

    // save off the current thinkers
    for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
    {
        if (th->function.acp1 == (actionf_p1)P_MobjThinker)
        {
            saveg_write8(tc_mobj);
            saveg_write_pad();
            saveg_write_mobj_t((mobj_t *) th);

            continue;
        }

        // haleyjd: This may seem mysterious but in the DOOM prebeta, 
        // different types of things used different thinker functions. 
        // Those would have all been handled here and this message is 
        // probably a relic of that old system, not to mention the odd
        // name of this function, and use of an enumeration with only
        // two values in it.

        // I_Error ("P_ArchiveThinkers: Unknown thinker function");
    }

    // add a terminating marker
    saveg_write8(tc_end);
}
Example #4
0
static void saveg_write_mapthing_t(mapthing_t* mt) {
    saveg_write16(mt->x);
    saveg_write16(mt->y);
    saveg_write16(mt->z);
    saveg_write16(mt->angle);
    saveg_write16(mt->type);
    saveg_write16(mt->options);
    saveg_write16(mt->tid);
    saveg_write_pad();
}
Example #5
0
void P_ArchiveMobjs(void) {
    mobj_t*    mobj;

    saveg_setup_mobjwrite();
    saveg_write32(savegmobjnum);

    // save off the current mobjs
    for(mobj = mobjhead.next; mobj != &mobjhead; mobj = mobj->next) {
        // don't save if mobj is expected to be removed
        if(mobj->mobjfunc == P_SafeRemoveMobj) {
            continue;
        }

        saveg_write_pad();
        saveg_write_mobj_t(mobj);
        saveg_write_marker(SAVEGAME_MOBJ);
    }

    saveg_write_pad();
}
Example #6
0
//
// P_ArchivePlayers
//
void P_ArchivePlayers(void) {
    int i;

    for(i = 0; i < MAXPLAYERS; i++) {
        if(!playeringame[i]) {
            continue;
        }

        saveg_write_pad();
        saveg_write_player_t(&players[i]);
    }
}
Example #7
0
//
// P_ArchiveThinkers
//
void P_ArchiveThinkers(void)
{
    // save off the current thinkers
    for (thinker_t *th = thinkers[th_mobj].cnext; th != &thinkers[th_mobj]; th = th->cnext)
    {
        saveg_write8(tc_mobj);
        saveg_write_pad();
        saveg_write_mobj_t((mobj_t *)th);
    }

    // save off the bloodsplats
    for (int i = 0; i < numsectors; i++)
        for (bloodsplat_t *splat = sectors[i].splatlist; splat; splat = splat->snext)
        {
            saveg_write8(tc_bloodsplat);
            saveg_write_pad();
            saveg_write_bloodsplat_t(splat);
        }

    // add a terminating marker
    saveg_write8(tc_end);
}
Example #8
0
//
// P_ArchiveThinkers
//
void P_ArchiveThinkers (void)
{
    thinker_t*		th;

    // save off the current thinkers
    for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
    {
	if (th->function.acp1 == (actionf_p1)P_MobjThinker)
	{
            saveg_write8(tc_mobj);
	    saveg_write_pad();
            saveg_write_mobj_t((mobj_t *) th);

	    continue;
	}
		
	// I_Error ("P_ArchiveThinkers: Unknown thinker function");
    }

    // add a terminating marker
    saveg_write8(tc_end);
}
Example #9
0
//
// Things to handle:
//
// T_MoveCeiling, (ceiling_t: sector_t * swizzle), - active list
// T_VerticalDoor, (vldoor_t: sector_t * swizzle),
// T_MoveFloor, (floormove_t: sector_t * swizzle),
// T_LightFlash, (lightflash_t: sector_t * swizzle),
// T_StrobeFlash, (strobe_t: sector_t *),
// T_Glow, (glow_t: sector_t *),
// T_PlatRaise, (plat_t: sector_t *), - active list
//
void P_ArchiveSpecials (void)
{
    thinker_t*		th;
    int			i;
	
    // save off the current thinkers
    for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
    {
	if (th->function.acv == (actionf_v)NULL)
	{
	    for (i = 0; i < MAXCEILINGS;i++)
		if (activeceilings[i] == (ceiling_t *)th)
		    break;
	    
	    if (i<MAXCEILINGS)
	    {
                saveg_write8(tc_ceiling);
		saveg_write_pad();
                saveg_write_ceiling_t((ceiling_t *) th);
	    }
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_MoveCeiling)
	{
            saveg_write8(tc_ceiling);
	    saveg_write_pad();
            saveg_write_ceiling_t((ceiling_t *) th);
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_VerticalDoor)
	{
            saveg_write8(tc_door);
	    saveg_write_pad();
            saveg_write_vldoor_t((vldoor_t *) th);
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_MoveFloor)
	{
            saveg_write8(tc_floor);
	    saveg_write_pad();
            saveg_write_floormove_t((floormove_t *) th);
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_PlatRaise)
	{
            saveg_write8(tc_plat);
	    saveg_write_pad();
            saveg_write_plat_t((plat_t *) th);
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_LightFlash)
	{
            saveg_write8(tc_flash);
	    saveg_write_pad();
            saveg_write_lightflash_t((lightflash_t *) th);
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_StrobeFlash)
	{
            saveg_write8(tc_strobe);
	    saveg_write_pad();
            saveg_write_strobe_t((strobe_t *) th);
	    continue;
	}
			
	if (th->function.acp1 == (actionf_p1)T_Glow)
	{
            saveg_write8(tc_glow);
	    saveg_write_pad();
            saveg_write_glow_t((glow_t *) th);
	    continue;
	}
    }
	
    // add a terminating marker
    saveg_write8(tc_endspecials);

}
Example #10
0
//
// P_ArchivePlayer
//
void P_ArchivePlayer(void)
{
    saveg_write_pad();
    saveg_write_player_t();
}
Example #11
0
//
// P_ArchiveSpecials
//
void P_ArchiveSpecials(void)
{
    int         i = maxbuttons;
    button_t    *button_ptr = buttonlist;

    // save off the current thinkers
    for (thinker_t *th = thinkers[th_misc].cnext; th != &thinkers[th_misc]; th = th->cnext)
    {
        if (!th->function)
        {
            dboolean    done_one = false;

            for (ceilinglist_t *ceilinglist = activeceilings; ceilinglist; ceilinglist = ceilinglist->next)
                if (ceilinglist->ceiling == (ceiling_t *)th)
                {
                    saveg_write8(tc_ceiling);
                    saveg_write_pad();
                    saveg_write_ceiling_t((ceiling_t *)th);
                    done_one = true;
                    break;
                }

            // [jeff-d] save height of moving platforms
            for (platlist_t *platlist = activeplats; platlist; platlist = platlist->next)
                if (platlist->plat == (plat_t *)th)
                {
                    saveg_write8(tc_plat);
                    saveg_write_pad();
                    saveg_write_plat_t((plat_t *)th);
                    done_one = true;
                    break;
                }

            if (done_one)
                continue;
        }

        if (th->function == T_MoveCeiling)
        {
            saveg_write8(tc_ceiling);
            saveg_write_pad();
            saveg_write_ceiling_t((ceiling_t *)th);
            continue;
        }

        if (th->function == T_VerticalDoor)
        {
            saveg_write8(tc_door);
            saveg_write_pad();
            saveg_write_vldoor_t((vldoor_t *)th);
            continue;
        }

        if (th->function == T_MoveFloor)
        {
            saveg_write8(tc_floor);
            saveg_write_pad();
            saveg_write_floormove_t((floormove_t *)th);
            continue;
        }

        if (th->function == T_PlatRaise)
        {
            saveg_write8(tc_plat);
            saveg_write_pad();
            saveg_write_plat_t((plat_t *)th);
            continue;
        }

        if (th->function == T_LightFlash)
        {
            saveg_write8(tc_flash);
            saveg_write_pad();
            saveg_write_lightflash_t((lightflash_t *)th);
            continue;
        }

        if (th->function == T_StrobeFlash)
        {
            saveg_write8(tc_strobe);
            saveg_write_pad();
            saveg_write_strobe_t((strobe_t *)th);
            continue;
        }

        if (th->function == T_Glow)
        {
            saveg_write8(tc_glow);
            saveg_write_pad();
            saveg_write_glow_t((glow_t *)th);
            continue;
        }

        if (th->function == T_FireFlicker)
        {
            saveg_write8(tc_fireflicker);
            saveg_write_pad();
            saveg_write_fireflicker_t((fireflicker_t *)th);
            continue;
        }

        if (th->function == T_MoveElevator)
        {
            saveg_write8(tc_elevator);
            saveg_write_pad();
            saveg_write_elevator_t((elevator_t *)th);
            continue;
        }

        if (th->function == T_Scroll)
        {
            saveg_write8(tc_scroll);
            saveg_write_pad();
            saveg_write_scroll_t((scroll_t *)th);
            continue;
        }

        if (th->function == T_Pusher)
        {
            saveg_write8(tc_pusher);
            saveg_write_pad();
            saveg_write_pusher_t((pusher_t *)th);
            continue;
        }
    }

    do
    {
        if (button_ptr->btimer)
        {
            saveg_write8(tc_button);
            saveg_write_pad();
            saveg_write_button_t(button_ptr);
        }

        button_ptr++;
    } while (--i);

    // add a terminating marker
    saveg_write8(tc_endspecials);
}
Example #12
0
//
// P_ArchiveWorld
//
void P_ArchiveWorld(void) {
    int         i;
    int         j;
    sector_t    *sec;
    line_t      *li;
    side_t      *si;
    light_t     *light;

    // do sectors
    for(i = 0, sec = sectors; i < numsectors; i++, sec++) {
        saveg_write16(F2INT(sec->floorheight));
        saveg_write16(F2INT(sec->ceilingheight));
        saveg_write16(sec->floorpic);
        saveg_write16(sec->ceilingpic);
        saveg_write16(sec->special);
        saveg_write16(sec->tag);
        saveg_write16(sec->flags);
        saveg_write16(sec->lightlevel);
        saveg_write32(sec->xoffset);
        saveg_write32(sec->yoffset);
        saveg_write_mobjindex(sec->soundtarget);

        for(j = 0; j < 5; j++) {
            saveg_write16(sec->colors[j]);
        }
    }


    // do lines
    for(i = 0, li = lines; i < numlines; i++, li++) {
        saveg_write16((li->flags >> 16));
        saveg_write16((li->flags & 0xFFFF));
        saveg_write16(li->special);
        saveg_write16(li->tag);

        for(j = 0; j < 2; j++) {
            if(li->sidenum[j] == NO_SIDE_INDEX) {
                continue;
            }

            si = &sides[li->sidenum[j]];

            saveg_write16(F2INT(si->textureoffset));
            saveg_write16(F2INT(si->rowoffset));
            saveg_write16(si->toptexture);
            saveg_write16(si->bottomtexture);
            saveg_write16(si->midtexture);
        }
    }

    // do lights
    for(i = 0, light = lights; i < numlights; i++, light++) {
        saveg_write8(light->base_r);
        saveg_write8(light->base_g);
        saveg_write8(light->base_b);
        saveg_write8(light->active_r);
        saveg_write8(light->active_g);
        saveg_write8(light->active_b);
        saveg_write8(light->r);
        saveg_write8(light->g);
        saveg_write8(light->b);
        saveg_write_pad();
        saveg_write16(light->tag);
    }
}
Example #13
0
static void saveg_write_marker(int marker) {
    saveg_write_pad();
    saveg_write32(marker);
}
Example #14
0
static void saveg_write_header(char *description) {
    int i;
    int size;
    char date[32];
    byte* tbn;

    for(i = 0; description[i] != '\0'; i++) {
        saveg_write8(description[i]);
    }

    for(; i < SAVESTRINGSIZE; i++) {
        saveg_write8(0);
    }

    sprintf(date, "%s", saveg_gettime());
    size = dstrlen(date);

    for(i = 0; i < size; i++) {
        saveg_write8(date[i]);
    }

    for(; i < 32; i++) {
        saveg_write8(0);
    }

    size = M_CacheThumbNail(&tbn);

    saveg_write32(size);

    for(i = 0; i < size; i++) {
        saveg_write8(tbn[i]);
    }

    Z_Free(tbn);

    for(i = 0; i < 16; i++) {
        saveg_write8(passwordData[i]);
    }

    saveg_write8(gameskill);
    saveg_write8(gamemap);
    saveg_write8(nextmap);
    saveg_write_pad();
    saveg_write16(globalint);

    //
    // [kex] 12/26/11 - write total stat info
    //
    saveg_write_pad();
    saveg_write32(totalkills);
    saveg_write32(totalitems);
    saveg_write32(totalsecret);

    for(i = 0; i < MAXPLAYERS; i++) {
        saveg_write8(playeringame[i]);
    }

    saveg_write8((leveltime >> 16) & 0xff);
    saveg_write8((leveltime >> 8) & 0xff);
    saveg_write8(leveltime & 0xff);
    saveg_write_pad();
}