您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 著名游戏异教徒源代码
  所属分类: C
  开发工具:
  文件大小: 393kb
  下载次数: 0
  上传时间: 2009-05-12
  提 供 者: xiao*****
 详细说明: // P_doors.c #include "DoomDef.h" #include "P_local.h" #include "soundst.h" //================================================================== //================================================================== // // VERT ICAL DOORS // //================================================================== //================================================================== //================================================================== // // T_VerticalDoor // //================================================================== void T_VerticalDoor(vldoor_t *door) { result_e res; switch(door->direction) { case 0: // WAITING if(!--door->topcountdown) switch(door->type) { case normal: door->direction = -1; // time to go back down S_StartSound((mobj_t *) &door->sector->soundorg, sfx_doropn); break; case close30ThenOpen: door->direction = 1; S_StartSound((mobj_t *) &door->sector->soundorg, sfx_doropn); break; default: break; } break; case 2: // INITIAL WAIT if(!--door->topcountdown) { switch(door->type) { case raiseIn5Mins: door->direction = 1; door->type = normal; S_StartSound((mobj_t *) &door->sector->soundorg, sfx_doropn); break; default: break; } } break; case -1: // DOWN res = T_MovePlane(door->sector, door->speed, door->sector->floorheight, false, 1, door->direction); if(res == pastdest) { switch(door->type) { case normal: case close: door->sector->specialdata = NULL; P_RemoveThinker(&door->thinker); // unlink and free S_StartSound((mobj_t *) &door->sector->soundorg, sfx_dorcls); break; case close30ThenOpen: door->direction = 0; door->topcountdown = 35*30; break; default: break; } } else if(res == crushed) { switch(door->type) { case close: // DON'T GO BACK UP! break; default: door->direction = 1; S_StartSound((mobj_t *) &door->sector->soundorg,sfx_doropn); break; } } break; case 1: // UP res = T_MovePlane(door->sector, door->speed, door->topheight, false, 1, door->direction); if(res == pastdest) { switch(door->type) { case normal: door->direction = 0; // wait at top door->topcountdown = door->topwait; break; case close30ThenOpen: case open: door->sector->specialdata = NULL; P_RemoveThinker (&door->thinker); // unlink and free S_StopSound((mobj_t *)&door->sector->soundorg); break; default: break; } } break; } } //---------------------------------------------------------------------------- // // EV_DoDoor // // Move a door up/down // //---------------------------------------------------------------------------- int EV_DoDoor(line_t *line, vldoor_e type, fixed_t speed) { int secnum; int retcode; sector_t *sec; vldoor_t *door; secnum = -1; retcode = 0; while((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) { sec = §ors[secnum]; if(sec->specialdata) { continue; } // Add new door thinker retcode = 1; door = Z_Malloc(sizeof(*door), PU_LEVSPEC, 0); P_AddThinker(&door->thinker); sec->specialdata = door; door->thinker.function = T_VerticalDoor; door->sector = sec; switch(type) { case close: door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; door->direction = -1; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); break; case close30ThenOpen: door->topheight = sec->ceilingheight; door->direction = -1; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); break; case normal: case open: door->direction = 1; door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; if(door->topheight != sec->ceilingheight) { S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); } break; default: break; } door->type = type; door->speed = speed; door->topwait = VDOORWAIT; } return(retcode); } //================================================================== // // EV_VerticalDoor : open a door manually, no tag value // //================================================================== void EV_VerticalDoor(line_t *line, mobj_t *thing) { player_t *player; int secnum; sector_t *sec; vldoor_t *door; int side; side = 0; // only front sides can be used // // Check for locks // player = thing->player; switch(line->special) { case 26: // Blue Lock case 32: if(!player) { return; } if(!player->keys[key_blue]) { P_SetMessage(player, TXT_NEEDBLUEKEY, false); S_StartSound(NULL, sfx_plroof); return; } break; case 27: // Yellow Lock case 34: if(!player) { return; } if(!player->keys[key_yellow]) { P_SetMessage(player, TXT_NEEDYELLOWKEY, false); S_StartSound(NULL, sfx_plroof); return; } break; case 28: // Green Lock case 33: if(!player) { return; } if(!player->keys[key_green]) { P_SetMessage(player, TXT_NEEDGREENKEY, false); S_StartSound(NULL, sfx_plroof); return; } break; } // if the sector has an active thinker, use it sec = sides[line->sidenum[side^1]].sector; secnum = sec-sectors; if(sec->specialdata) { door = sec->specialdata; switch(line->special) { case 1: // ONLY FOR "RAISE" DOORS, NOT "OPEN"s case 26: case 27: case 28: if(door->direction == -1) { door->direction = 1; // go back up } else { if(!thing->player) { // Monsters don't close doors return; } door->direction = -1; // start going down immediately } return; } } // for proper sound switch(line->special) { case 1: // NORMAL DOOR SOUND case 31: S_StartSound((mobj_t *)&sec->soundorg, sfx_doropn); //S_StartSound((mobj_t *)&sec->soundorg, sfx_dormov); break; default: // LOCKED DOOR SOUND S_StartSound((mobj_t *)&sec->soundorg, sfx_doropn); //S_StartSound((mobj_t *)&sec->soundorg, sfx_dormov); break; } // // new door thinker // door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0); P_AddThinker(&door->thinker); sec->specialdata = door; door->thinker.function = T_VerticalDoor; door->sector = sec; door->direction = 1; switch(line->special) { case 1: case 26: case 27: case 28: door->type = normal; break; case 31: case 32: case 33: case 34: door->type = open; line->special = 0; break; } door->speed = VDOORSPEED; door->topwait = VDOORWAIT; // // find the top and bottom of the movement range // door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; } //================================================================== // // Spawn a door that closes after 30 seconds // //================================================================== void P_SpawnDoorCloseIn30(sector_t *sec) { vldoor_t *door; door = Z_Malloc(sizeof(*door), PU_LEVSPEC, 0); P_AddThinker(&door->thinker); sec->specialdata = door; sec->special = 0; door->thinker.function = T_VerticalDoor; door->sector = sec; door->direction = 0; door->type = normal; door->speed = VDOORSPEED; door->topcountdown = 30*35; } //================================================================== // // Spawn a door that opens after 5 minutes // //================================================================== void P_SpawnDoorRaiseIn5Mins(sector_t *sec, int secnum) { vldoor_t *door; door = Z_Malloc(sizeof(*door), PU_LEVSPEC, 0); P_AddThinker(&door->thinker); sec->specialdata = door; sec->special = 0; door->thinker.function = T_VerticalDoor; door->sector = sec; door->direction = 2; door->type = raiseIn5Mins; door->speed = VDOORSPEED; door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; door->topwait = VDOORWAIT; door->topcountdown = 5*60*35; } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 游戏
 输入关键字,在本站1000多万海量源码库中尽情搜索: