本文整理汇总了C++中P_AddThinker函数的典型用法代码示例。如果您正苦于以下问题:C++ P_AddThinker函数的具体用法?C++ P_AddThinker怎么用?C++ P_AddThinker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了P_AddThinker函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Z_Malloc
void
EV_SlidingDoor
( line_t* line,
mobj_t* thing )
{
sector_t* sec;
slidedoor_t* door;
// DOOM II ONLY...
if (gamemode != commercial)
return;
// Make sure door isn't already being animated
sec = line->frontsector;
door = NULL;
if (sec->specialdata)
{
if (!thing->player)
return;
door = sec->specialdata;
if (door->type == sdt_openAndClose)
{
if (door->status == sd_waiting)
door->status = sd_closing;
}
else
return;
}
// Init sliding door vars
if (!door)
{
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
door->type = sdt_openAndClose;
door->status = sd_opening;
door->whichDoorIndex = P_FindSlidingDoorType(line);
if (door->whichDoorIndex < 0)
I_Error("EV_SlidingDoor: Can't use texture for sliding door!");
door->frontsector = sec;
door->backsector = line->backsector;
door->thinker.function = T_SlidingDoor;
door->timer = SWAITTICS;
door->frame = 0;
door->line = line;
}
}
示例2: P_SpawnGlowingLight
void P_SpawnGlowingLight(sector_t * sector)
{
glow_t *g;
g = Z_Malloc(sizeof(*g), PU_LEVSPEC, 0);
P_AddThinker(&g->thinker);
g->sector = sector;
g->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
g->maxlight = sector->lightlevel;
g->thinker.function = T_Glow;
g->direction = -1;
sector->special = 0;
}
示例3: P_StartACS
boolean P_StartACS(int number, int map, byte * args, mobj_t * activator,
line_t * line, int side)
{
int i;
acs_t *script;
int infoIndex;
aste_t *statePtr;
NewScript = NULL;
if (map && map != gamemap)
{ // Add to the script store
return AddToACSStore(map, number, args);
}
infoIndex = GetACSIndex(number);
if (infoIndex == -1)
{ // Script not found
//I_Error("P_StartACS: Unknown script number %d", number);
snprintf(ErrorMsg, sizeof(ErrorMsg),
"P_STARTACS ERROR: UNKNOWN SCRIPT %d", number);
P_SetMessage(&players[consoleplayer], ErrorMsg, true);
}
statePtr = &ACSInfo[infoIndex].state;
if (*statePtr == ASTE_SUSPENDED)
{ // Resume a suspended script
*statePtr = ASTE_RUNNING;
return true;
}
if (*statePtr != ASTE_INACTIVE)
{ // Script is already executing
return false;
}
script = Z_Malloc(sizeof(acs_t), PU_LEVSPEC, 0);
memset(script, 0, sizeof(acs_t));
script->number = number;
script->infoIndex = infoIndex;
script->activator = activator;
script->line = line;
script->side = side;
script->ip = ACSInfo[infoIndex].address;
script->thinker.function = T_InterpretACS;
for (i = 0; i < ACSInfo[infoIndex].argCount; i++)
{
script->vars[i] = args[i];
}
*statePtr = ASTE_RUNNING;
P_AddThinker(&script->thinker);
NewScript = script;
return true;
}
示例4: P_UnArchiveThinkers
void P_UnArchiveThinkers(void)
{
byte tclass;
thinker_t *currentthinker, *next;
mobj_t *mobj;
//
// remove all the current thinkers
//
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
next = currentthinker->next;
if (currentthinker->function == P_MobjThinker)
P_RemoveMobj((mobj_t *) currentthinker);
else
Z_Free(currentthinker);
currentthinker = next;
}
P_InitThinkers();
// read in saved thinkers
while (1)
{
tclass = SV_ReadByte();
switch (tclass)
{
case tc_end:
return; // end of list
case tc_mobj:
mobj = Z_Malloc(sizeof(*mobj), PU_LEVEL, NULL);
saveg_read_mobj_t(mobj);
mobj->target = NULL;
P_SetThingPosition(mobj);
mobj->info = &mobjinfo[mobj->type];
mobj->floorz = mobj->subsector->sector->floorheight;
mobj->ceilingz = mobj->subsector->sector->ceilingheight;
mobj->thinker.function = P_MobjThinker;
P_AddThinker(&mobj->thinker);
break;
default:
I_Error("Unknown tclass %i in savegame", tclass);
}
}
}
示例5: P_SpawnDoorCloseIn30
//==================================================================
//
// 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;
}
示例6: P_SpawnStrobeAltFlash
void P_SpawnStrobeAltFlash(sector_t* sector, int speed) { // 0x80015C44
strobe_t* flash;
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker(&flash->thinker);
flash->sector = sector;
flash->darktime = speed;
flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
flash->special = sector->special;
flash->maxlight = 127;
flash->brighttime = 1;
flash->count = 1;
}
示例7: P_SpawnStrobeFlash
void P_SpawnStrobeFlash(sector_t* sector, int speed) {
strobe_t* flash;
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker(&flash->thinker);
flash->sector = sector;
flash->darktime = speed;
flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
flash->special = sector->special;
flash->maxlight = 16;
flash->brighttime = 3;
flash->count = (P_Random(pr_lights) & 7) + 1;
}
示例8: P_CombineLightSpecials
void P_CombineLightSpecials(sector_t *sector) {
actionf_p1 func;
thinker_t *thinker;
combine_t *combine;
switch(sector->special) {
case 1:
func = T_LightFlash;
break;
case 2:
case 3:
case 202:
case 203:
case 204:
case 205:
case 206:
case 208:
func = T_StrobeFlash;
break;
case 8:
case 9:
case 11:
func = T_Glow;
break;
case 17:
func = T_FireFlicker;
break;
default:
return;
}
for(thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next) {
if((actionf_p1)func != (actionf_p1)thinker->function.acp1) {
continue;
}
combine = Z_Malloc(sizeof(*combine), PU_LEVSPEC, 0);
P_AddThinker(&combine->thinker);
combine->sector = sector;
combine->special = sector->special;
combine->combiner = thinker;
combine->func = func;
combine->thinker.function.acp1 = (actionf_p1)T_Combine;
return;
}
}
示例9: P_SpawnGlowingLight
//
// P_SpawnGlowingLight()
//
// Spawns a glowing light (smooth oscillation from min to max) thinker
//
// Passed the sector that spawned the thinker
// Returns nothing
//
void P_SpawnGlowingLight(sector_t* sector)
{
glow_t* g;
g = Z_Malloc( sizeof(*g), PU_LEVSPEC, 0);
P_AddThinker(&g->thinker);
g->sector = sector;
g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
g->maxlight = sector->lightlevel;
g->thinker.function.acp1 = (actionf_p1) T_Glow;
g->direction = -1;
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
}
示例10: StartOpenACS
static void StartOpenACS(int number, int infoIndex, int *address)
{
acs_t *script;
script = Z_Malloc(sizeof(acs_t), PU_LEVSPEC, 0);
memset(script, 0, sizeof(acs_t));
script->number = number;
// World objects are allotted 1 second for initialization
script->delayCount = 35;
script->infoIndex = infoIndex;
script->ip = address;
script->thinker.function = T_InterpretACS;
P_AddThinker(&script->thinker);
}
示例11: P_SpawnLightFlash
//==================================================================
//
// P_SpawnLightFlash
//
// After the map has been loaded, scan each sector for specials that spawn thinkers
//
//==================================================================
void P_SpawnLightFlash(sector_t * sector)
{
lightflash_t *flash;
sector->special = 0; // nothing special about it during gameplay
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker(&flash->thinker);
flash->thinker.function = T_LightFlash;
flash->sector = sector;
flash->maxlight = sector->lightlevel;
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
flash->maxtime = 64;
flash->mintime = 7;
flash->count = (P_Random() & flash->maxtime) + 1;
}
示例12: P_SpawnFireFlicker
//
// P_SpawnFireFlicker
//
void P_SpawnFireFlicker(sector_t *sector)
{
fireflicker_t *flick = Z_Malloc(sizeof(*flick), PU_LEVSPEC, 0);
// Note that we are resetting sector attributes.
// Nothing special about it during gameplay.
sector->special = 0;
memset(flick, 0, sizeof(*flick));
P_AddThinker(&flick->thinker);
flick->thinker.function = T_FireFlicker;
flick->sector = sector;
flick->maxlight = sector->lightlevel;
flick->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel) + 16;
flick->count = 4;
}
示例13: P_SpawnFireFlicker
//
// P_SpawnFireFlicker
//
// [STRIFE]
// haleyjd 2011023: Changes to minimum light level and initial duration
//
void P_SpawnFireFlicker (sector_t* sector)
{
fireflicker_t* flick;
// Note that we are resetting sector attributes.
// Nothing special about it during gameplay.
sector->special = 0;
flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);
P_AddThinker (&flick->thinker);
flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
flick->sector = sector;
flick->maxlight = sector->lightlevel;
flick->minlight = sector->lightlevel - 32; // [STRIFE] changed from min surrounding+16
flick->count = 2; // [STRIFE]: Initial count 4 -> 2
}
示例14: P_SpawnDoorRaiseIn5Mins
//==================================================================
//
// 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;
}
示例15: P_SpawnFireFlicker
//
// P_SpawnFireFlicker()
//
// Spawns a fire flicker lighting thinker
//
// Passed the sector that spawned the thinker
// Returns nothing
//
void P_SpawnFireFlicker (sector_t* sector)
{
fireflicker_t* flick;
// Note that we are resetting sector attributes.
// Nothing special about it during gameplay.
sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);
P_AddThinker (&flick->thinker);
flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
flick->sector = sector;
flick->maxlight = sector->lightlevel;
flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
flick->count = 4;
}