コード例 #1
0
ファイル: m_cheat.c プロジェクト: MP2E/kexplus
static void M_CheatMyPos(player_t * player, char dat[4])
{
	_dprintf("ang = %d; x,y = (%d, %d)",
		 (int)(players[consoleplayer].mo->angle * (float)180 / ANG180),
		 F2INT(players[consoleplayer].mo->x),
		 F2INT(players[consoleplayer].mo->y));
}
コード例 #2
0
ファイル: p_pspr.c プロジェクト: alexey-lysiuk/doom64ex-osx
d_inline static fixed_t P_LaserPointOnSide(fixed_t x, fixed_t y, node_t* node)
{
    fixed_t	dx;
    fixed_t	dy;
    fixed_t	left;
    fixed_t	right;
    
    dx = (x - node->x);
    dy = (y - node->y);
    
    left =  F2INT(node->dy) * F2INT(dx);
    right = F2INT(dy) * F2INT(node->dx);
    
    return left - right;
}
コード例 #3
0
ファイル: p_saveg.c プロジェクト: directhex/doom64
//
// 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);
    }
}
コード例 #4
0
ファイル: p_pspr.c プロジェクト: alexey-lysiuk/doom64ex-osx
static void P_LaserCrossBSP(int bspnum, laser_t* laser)
{
    node_t* node;
    int ds1;
    int ds2;
    int s1;
    int s2;
    int dist;
    int frac;
    mobj_t* marker;
    laser_t* childlaser = NULL;
    fixed_t x;
    fixed_t y;
    fixed_t z;

    while(!(bspnum & NF_SUBSECTOR))
    {
        node = &nodes[bspnum];

        // traverse nodes
        ds1 = P_LaserPointOnSide(laser->x1, laser->y1, node);
        ds2 = P_LaserPointOnSide(laser->x2, laser->y2, node);

        s1 = (ds1 < 0);
        s2 = (ds2 < 0);

        // did the two laser points cross the node?
        if(s1 == s2)
        {
            bspnum = node->children[s1];
            continue;
        }

        // allocate a new child laser
        childlaser = (laser_t*)Z_Calloc(sizeof(laser_t), PU_LEVSPEC, NULL);
        childlaser->x1 = laser->x1;
        childlaser->y1 = laser->y1;
        childlaser->z1 = laser->z1;
        childlaser->x2 = laser->x2;
        childlaser->y2 = laser->y2;
        childlaser->z2 = laser->z2;
        childlaser->slopex = laser->slopex;
        childlaser->slopey = laser->slopey;
        childlaser->slopez = laser->slopez;
        childlaser->distmax = laser->distmax;
        childlaser->next = laser->next;
        childlaser->angle = laser->angle;

        // get the intercepting point of the laser and node
        frac = FixedDiv(ds1, ds1 - ds2);

        x = (F2INT(laser->x2 - laser->x1) * frac) + laser->x1;
        y = (F2INT(laser->y2 - laser->y1) * frac) + laser->y1;
        z = (F2INT(laser->z2 - laser->z1) * frac) + laser->z1;

        // update endpoint of current laser to intercept point
        laser->x2 = x;
        laser->y2 = y;
        laser->z2 = z;

        // childlaser begins at intercept point
        childlaser->x1 = x;
        childlaser->y1 = y;
        childlaser->z1 = z;

        // update distmax
        dist = F2INT(laser->distmax * frac);

        childlaser->distmax = laser->distmax - dist;
        laser->distmax = dist;

        // point to child laser
        laser->next = childlaser;

        // traverse child nodes
        P_LaserCrossBSP(node->children[s1], laser);

        laser = childlaser;
        bspnum = node->children[s2];
    }

    // subsector was hit, spawn a marker between the two laser points
    x = (laser->x1 + laser->x2) >> 1;
    y = (laser->y1 + laser->y2) >> 1;
    z = (laser->z1 + laser->z2) >> 1;
    
    marker = P_SpawnMobj(x, y, z, MT_LASERMARKER);

    // have marker point to which laser it belongs to
    marker->extradata = (laser_t*)laser;
    laser->marker = marker;
}