📄 p_floor.c
字号:
sec = floor->sector; // search forward while (sec->nextsec!=-1 && sectors[sec->nextsec].stairlock!=-2) sec = §ors[sec->nextsec]; if (sec->nextsec==-1) // if all thinkers ahead are done too { while (sec->prevsec!=-1) // clear all locks { sec->stairlock = 0; sec = §ors[sec->prevsec]; } sec->stairlock = 0; } } } if ((floor->type == buildStair && gamemode == heretic) || gamemode != heretic) S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_pstop); }}// SoM: 3/6/2000: Lots'o'copied code here.. Elevators.//// T_MoveElevator()//// Move an elevator to it's destination (up or down)// Called once per tick for each moving floor.//// Passed an elevator_t structure that contains all pertinent info about the// move. See P_SPEC.H for fields.// No return.//// SoM: 3/6/2000: The function moves the plane differently based on direction, so if it's // traveling really fast, the floor and ceiling won't hit each other and stop the lift.void T_MoveElevator(elevator_t* elevator){ result_e res = 0; if (elevator->direction<0) // moving down { res = T_MovePlane //jff 4/7/98 reverse order of ceiling/floor ( elevator->sector, elevator->speed, elevator->ceilingdestheight, 0, 1, // move floor elevator->direction ); if (res==ok || res==pastdest) // jff 4/7/98 don't move ceil if blocked T_MovePlane ( elevator->sector, elevator->speed, elevator->floordestheight, 0, 0, // move ceiling elevator->direction ); } else // up { res = T_MovePlane //jff 4/7/98 reverse order of ceiling/floor ( elevator->sector, elevator->speed, elevator->floordestheight, 0, 0, // move ceiling elevator->direction ); if (res==ok || res==pastdest) // jff 4/7/98 don't move floor if blocked T_MovePlane ( elevator->sector, elevator->speed, elevator->ceilingdestheight, 0, 1, // move floor elevator->direction ); } // make floor move sound if (!(leveltime % (8*NEWTICRATERATIO))) S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_stnmov); if (res == pastdest) // if destination height acheived { elevator->sector->floordata = NULL; //jff 2/22/98 elevator->sector->ceilingdata = NULL; //jff 2/22/98 P_RemoveThinker(&elevator->thinker); // remove elevator from actives // make floor stop sound S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_pstop); }}//// HANDLE FLOOR TYPES//intEV_DoFloor( line_t* line, floor_e floortype ){ int secnum; int rtn; int i; sector_t* sec; floormove_t* floor; secnum = -1; rtn = 0; while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = §ors[secnum]; // SoM: 3/6/2000: Boom has multiple thinkers per sector. // Don't start a second thinker on the same floor if (P_SectorActive(floor_special,sec)) //jff 2/23/98 continue; // new floor thinker rtn = 1; floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0); P_AddThinker (&floor->thinker); sec->floordata = floor; //SoM: 2/5/2000 floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor; floor->type = floortype; floor->crush = false; switch(floortype) { case lowerFloor: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = P_FindHighestFloorSurrounding(sec); break; //jff 02/03/30 support lowering floor by 24 absolute case lowerFloor24: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = floor->sector->floorheight + 24 * FRACUNIT; break; //jff 02/03/30 support lowering floor by 32 absolute (fast) case lowerFloor32Turbo: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED*4; floor->floordestheight = floor->sector->floorheight + 32 * FRACUNIT; break; case lowerFloorToLowest: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = P_FindLowestFloorSurrounding(sec); break; //jff 02/03/30 support lowering floor to next lowest floor case lowerFloorToNearest: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = P_FindNextLowestFloor(sec,floor->sector->floorheight); break; case turboLower: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED * 4; floor->floordestheight = P_FindHighestFloorSurrounding(sec); if (floor->floordestheight != sec->floorheight || gamemode == heretic ) floor->floordestheight += 8*FRACUNIT; break; case raiseFloorCrush: floor->crush = true; case raiseFloor: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = P_FindLowestCeilingSurrounding(sec); if (floor->floordestheight > sec->ceilingheight) floor->floordestheight = sec->ceilingheight; floor->floordestheight -= (8*FRACUNIT)* (floortype == raiseFloorCrush); break; case raiseFloorTurbo: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED*4; floor->floordestheight = P_FindNextHighestFloor(sec,sec->floorheight); break; case raiseFloorToNearest: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = P_FindNextHighestFloor(sec,sec->floorheight); break; case raiseFloor24: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = floor->sector->floorheight + 24 * FRACUNIT; break; // SoM: 3/6/2000: support straight raise by 32 (fast) case raiseFloor32Turbo: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED*4; floor->floordestheight = floor->sector->floorheight + 32 * FRACUNIT; break; case raiseFloor512: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = floor->sector->floorheight + 512 * FRACUNIT; break; case raiseFloor24AndChange: floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = floor->sector->floorheight + 24 * FRACUNIT; sec->floorpic = line->frontsector->floorpic; sec->special = line->frontsector->special; sec->oldspecial = line->frontsector->oldspecial; break; case raiseToTexture: { int minsize = MAXINT; side_t* side; if (boomsupport) minsize = 32000<<FRACBITS; //SoM: 3/6/2000: ??? floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; for (i = 0; i < sec->linecount; i++) { if (twoSided (secnum, i) ) { side = getSide(secnum,i,0); // jff 8/14/98 don't scan texture 0, its not real if (side->bottomtexture > 0 || (!boomsupport && !side->bottomtexture)) if (textureheight[side->bottomtexture] < minsize) minsize = textureheight[side->bottomtexture]; side = getSide(secnum,i,1); // jff 8/14/98 don't scan texture 0, its not real if (side->bottomtexture > 0 || (!boomsupport && !side->bottomtexture)) if (textureheight[side->bottomtexture] < minsize) minsize = textureheight[side->bottomtexture]; } } if (!boomsupport) floor->floordestheight = floor->sector->floorheight + minsize; else { floor->floordestheight = (floor->sector->floorheight>>FRACBITS) + (minsize>>FRACBITS); if (floor->floordestheight>32000) floor->floordestheight = 32000; //jff 3/13/98 do not floor->floordestheight<<=FRACBITS; // allow height overflow } break; } //SoM: 3/6/2000: Boom changed allot of stuff I guess, and this was one of 'em case lowerAndChange: floor->direction = -1; floor->sector = sec; floor->speed = FLOORSPEED; floor->floordestheight = P_FindLowestFloorSurrounding(sec); floor->texture = sec->floorpic; // jff 1/24/98 make sure floor->newspecial gets initialized // in case no surrounding sector is at floordestheight // --> should not affect compatibility <-- floor->newspecial = sec->special; //jff 3/14/98 transfer both old and new special floor->oldspecial = sec->oldspecial; //jff 5/23/98 use model subroutine to unify fixes and handling // BP: heretic have change something here sec = P_FindModelFloorSector(floor->floordestheight,sec-sectors); if (sec) { floor->texture = sec->floorpic; floor->newspecial = sec->special; //jff 3/14/98 transfer both old and new special floor->oldspecial = sec->oldspecial; } break; default: break; } } return rtn;}// SoM: 3/6/2000: Function for chaning just the floor texture and type.//// EV_DoChange()//// Handle pure change types. These change floor texture and sector type// by trigger or numeric model without moving the floor.//// The linedef causing the change and the type of change is passed// Returns true if any sector changes////int EV_DoChange( line_t* line, change_e changetype ){ int secnum; int rtn; sector_t* sec; sector_t* secm; secnum = -1; rtn = 0; // change all sectors with the same tag as the linedef while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -