📄 p_acs.c
字号:
static int CmdDecWorldVar(void){ WorldVars[*PCodePtr++]--; return SCRIPT_CONTINUE;}static int CmdGoto(void){ PCodePtr = (int *)(ActionCodeBase+*PCodePtr); return SCRIPT_CONTINUE;}static int CmdIfGoto(void){ if(Pop()) { PCodePtr = (int *)(ActionCodeBase+*PCodePtr); } else { PCodePtr++; } return SCRIPT_CONTINUE;}static int CmdDrop(void){ Drop(); return SCRIPT_CONTINUE;}static int CmdDelay(void){ ACScript->delayCount = Pop(); return SCRIPT_STOP;}static int CmdDelayDirect(void){ ACScript->delayCount = *PCodePtr++; return SCRIPT_STOP;}static int CmdRandom(void){ int low; int high; high = Pop(); low = Pop(); Push(low+(P_Random()%(high-low+1))); return SCRIPT_CONTINUE;}static int CmdRandomDirect(void){ int low; int high; low = *PCodePtr++; high = *PCodePtr++; Push(low+(P_Random()%(high-low+1))); return SCRIPT_CONTINUE;}static int CmdThingCount(void){ int tid; tid = Pop(); ThingCount(Pop(), tid); return SCRIPT_CONTINUE;}static int CmdThingCountDirect(void){ int type; type = *PCodePtr++; ThingCount(type, *PCodePtr++); return SCRIPT_CONTINUE;}static void ThingCount(int type, int tid){ int count; int searcher; mobj_t *mobj; mobjtype_t moType; thinker_t *think; if(!(type+tid)) { // Nothing to count return; } moType = TranslateThingType[type]; count = 0; searcher = -1; if(tid) { // Count TID things while((mobj = P_FindMobjFromTID(tid, &searcher)) != NULL) { if(type == 0) { // Just count TIDs count++; } else if(moType == mobj->type) { if(mobj->flags&MF_COUNTKILL && mobj->health <= 0) { // Don't count dead monsters continue; } count++; } } } else { // Count only types for(think = thinkercap.next; think != &thinkercap; think = think->next) { if(think->function != P_MobjThinker) { // Not a mobj thinker continue; } mobj = (mobj_t *)think; if(mobj->type != moType) { // Doesn't match continue; } if(mobj->flags&MF_COUNTKILL && mobj->health <= 0) { // Don't count dead monsters continue; } count++; } } Push(count);}static int CmdTagWait(void){ ACSInfo[ACScript->infoIndex].waitValue = Pop(); ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORTAG; return SCRIPT_STOP;}static int CmdTagWaitDirect(void){ ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++; ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORTAG; return SCRIPT_STOP;}static int CmdPolyWait(void){ ACSInfo[ACScript->infoIndex].waitValue = Pop(); ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORPOLY; return SCRIPT_STOP;}static int CmdPolyWaitDirect(void){ ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++; ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORPOLY; return SCRIPT_STOP;}static int CmdChangeFloor(void){ int tag; int flat; int sectorIndex; flat = R_FlatNumForName(ACStrings[Pop()]); tag = Pop(); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { sectors[sectorIndex].floorpic = flat; } return SCRIPT_CONTINUE;}static int CmdChangeFloorDirect(void){ int tag; int flat; int sectorIndex; tag = *PCodePtr++; flat = R_FlatNumForName(ACStrings[*PCodePtr++]); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { sectors[sectorIndex].floorpic = flat; } return SCRIPT_CONTINUE;}static int CmdChangeCeiling(void){ int tag; int flat; int sectorIndex; flat = R_FlatNumForName(ACStrings[Pop()]); tag = Pop(); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { sectors[sectorIndex].ceilingpic = flat; } return SCRIPT_CONTINUE;}static int CmdChangeCeilingDirect(void){ int tag; int flat; int sectorIndex; tag = *PCodePtr++; flat = R_FlatNumForName(ACStrings[*PCodePtr++]); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { sectors[sectorIndex].ceilingpic = flat; } return SCRIPT_CONTINUE;}static int CmdRestart(void){ PCodePtr = ACSInfo[ACScript->infoIndex].address; return SCRIPT_CONTINUE;}static int CmdAndLogical(void){ Push(Pop() && Pop()); return SCRIPT_CONTINUE;}static int CmdOrLogical(void){ Push(Pop() || Pop()); return SCRIPT_CONTINUE;}static int CmdAndBitwise(void){ Push(Pop()&Pop()); return SCRIPT_CONTINUE;}static int CmdOrBitwise(void){ Push(Pop()|Pop()); return SCRIPT_CONTINUE;}static int CmdEorBitwise(void){ Push(Pop()^Pop()); return SCRIPT_CONTINUE;}static int CmdNegateLogical(void){ Push(!Pop()); return SCRIPT_CONTINUE;}static int CmdLShift(void){ int operand2; operand2 = Pop(); Push(Pop()<<operand2); return SCRIPT_CONTINUE;}static int CmdRShift(void){ int operand2; operand2 = Pop(); Push(Pop()>>operand2); return SCRIPT_CONTINUE;}static int CmdUnaryMinus(void){ Push(-Pop()); return SCRIPT_CONTINUE;}static int CmdIfNotGoto(void){ if(Pop()) { PCodePtr++; } else { PCodePtr = (int *)(ActionCodeBase+*PCodePtr); } return SCRIPT_CONTINUE;}static int CmdLineSide(void){ Push(ACScript->side); return SCRIPT_CONTINUE;}static int CmdScriptWait(void){ ACSInfo[ACScript->infoIndex].waitValue = Pop(); ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORSCRIPT; return SCRIPT_STOP;}static int CmdScriptWaitDirect(void){ ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++; ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORSCRIPT; return SCRIPT_STOP;}static int CmdClearLineSpecial(void){ if(ACScript->line) { ACScript->line->special = 0; } return SCRIPT_CONTINUE;}static int CmdCaseGoto(void){ if(Top() == *PCodePtr++) { PCodePtr = (int *)(ActionCodeBase+*PCodePtr); Drop(); } else { PCodePtr++; } return SCRIPT_CONTINUE;}static int CmdBeginPrint(void){ *PrintBuffer = 0; return SCRIPT_CONTINUE;}static int CmdEndPrint(void){ player_t *player; if(ACScript->activator && ACScript->activator->player) { player = ACScript->activator->player; } else { player = &players[consoleplayer]; } P_SetMessage(player, PrintBuffer, true); return SCRIPT_CONTINUE;}static int CmdEndPrintBold(void){ int i; for(i = 0; i < MAXPLAYERS; i++) { if(playeringame[i]) { P_SetYellowMessage(&players[i], PrintBuffer, true); } } return SCRIPT_CONTINUE;}static int CmdPrintString(void){ strcat(PrintBuffer, ACStrings[Pop()]); return SCRIPT_CONTINUE;}static int CmdPrintNumber(void){ char tempStr[16]; sprintf(tempStr, "%d", Pop()); strcat(PrintBuffer, tempStr); return SCRIPT_CONTINUE;}static int CmdPrintCharacter(void){ char *bufferEnd; bufferEnd = PrintBuffer+strlen(PrintBuffer); *bufferEnd++ = Pop(); *bufferEnd = 0; return SCRIPT_CONTINUE;}static int CmdPlayerCount(void){ int i; int count; count = 0; for(i = 0; i < MAXPLAYERS; i++) { count += playeringame[i]; } Push(count); return SCRIPT_CONTINUE;}static int CmdGameType(void){ int gametype; if(netgame == false) { gametype = GAME_SINGLE_PLAYER; } else if(deathmatch) { gametype = GAME_NET_DEATHMATCH; } else { gametype = GAME_NET_COOPERATIVE; } Push(gametype); return SCRIPT_CONTINUE;}static int CmdGameSkill(void){ Push(gameskill); return SCRIPT_CONTINUE;}static int CmdTimer(void){ Push(leveltime); return SCRIPT_CONTINUE;}static int CmdSectorSound(void){ int volume; mobj_t *mobj; mobj = NULL; if(ACScript->line) { mobj = (mobj_t *)&ACScript->line->frontsector->soundorg; } volume = Pop(); S_StartSoundAtVolume(mobj, S_GetSoundID(ACStrings[Pop()]), volume); return SCRIPT_CONTINUE;}static int CmdThingSound(void){ int tid; int sound; int volume; mobj_t *mobj; int searcher; volume = Pop(); sound = S_GetSoundID(ACStrings[Pop()]); tid = Pop(); searcher = -1; while((mobj = P_FindMobjFromTID(tid, &searcher)) != NULL) { S_StartSoundAtVolume(mobj, sound, volume); } return SCRIPT_CONTINUE;}static int CmdAmbientSound(void){ int volume; volume = Pop(); S_StartSoundAtVolume(NULL, S_GetSoundID(ACStrings[Pop()]), volume); return SCRIPT_CONTINUE;}static int CmdSoundSequence(void){ mobj_t *mobj; mobj = NULL; if(ACScript->line) { mobj = (mobj_t *)&ACScript->line->frontsector->soundorg; } SN_StartSequenceName(mobj, ACStrings[Pop()]); return SCRIPT_CONTINUE;}static int CmdSetLineTexture(void){ line_t *line; int lineTag; int side; int position; int texture; int searcher; texture = R_TextureNumForName(ACStrings[Pop()]); position = Pop(); side = Pop(); lineTag = Pop(); searcher = -1; while((line = P_FindLine(lineTag, &searcher)) != NULL) { if(position == TEXTURE_MIDDLE) { sides[line->sidenum[side]].midtexture = texture; } else if(position == TEXTURE_BOTTOM) { sides[line->sidenum[side]].bottomtexture = texture; } else { // TEXTURE_TOP sides[line->sidenum[side]].toptexture = texture; } } return SCRIPT_CONTINUE;}static int CmdSetLineBlocking(void){ line_t *line; int lineTag; boolean blocking; int searcher; blocking = Pop() ? ML_BLOCKING : 0; lineTag = Pop(); searcher = -1; while((line = P_FindLine(lineTag, &searcher)) != NULL) { line->flags = (line->flags&~ML_BLOCKING)|blocking; } return SCRIPT_CONTINUE;}static int CmdSetLineSpecial(void){ line_t *line; int lineTag; int special, arg1, arg2, arg3, arg4, arg5; int searcher; arg5 = Pop(); arg4 = Pop(); arg3 = Pop(); arg2 = Pop(); arg1 = Pop(); special = Pop(); lineTag = Pop(); searcher = -1; while((line = P_FindLine(lineTag, &searcher)) != NULL) { line->special = special; line->arg1 = arg1; line->arg2 = arg2; line->arg3 = arg3; line->arg4 = arg4; line->arg5 = arg5; } return SCRIPT_CONTINUE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -