bool ParseConversation() { const PClass *type = NULL; int dlgid = -1; unsigned int startpos = StrifeDialogues.Size(); while (!sc.CheckToken('}')) { bool block = false; FName key = ParseKey(true, &block); if (!block) { switch(key) { case NAME_Actor: type = CheckActorType(key); if (namespace_bits == St) { dlgid = CheckInt(key); } break; case NAME_Id: if (namespace_bits == Zd) { dlgid = CheckInt(key); } break; } } else { switch(key) { case NAME_Page: if (!ParsePage()) return false; break; default: sc.UnGet(); Skip(); } } } if (type == NULL && dlgid == 0) { sc.ScriptMessage("No valid actor type defined in conversation."); return false; } SetConversation(dlgid, type, startpos); for(;startpos < StrifeDialogues.Size(); startpos++) { StrifeDialogues[startpos]->SpeakerType = type; } return true; }
double wxTransformMatrix::Get_scaleX() { double scale_factor; double rot_angle = CheckInt(atan2(m_matrix[1][0],m_matrix[0][0])*180/pi); if ( !wxIsSameDouble(rot_angle, 90) && !wxIsSameDouble(rot_angle, -90) ) scale_factor = m_matrix[0][0]/cos((rot_angle/180)*pi); else scale_factor = m_matrix[0][0]/sin((rot_angle/180)*pi); // er kan nl. niet door 0 gedeeld worden ! scale_factor = CheckInt(scale_factor); if (scale_factor < 0) scale_factor = -scale_factor; return scale_factor; }
bool ParseIfItem(FStrifeDialogueNode *node) { FStrifeDialogueItemCheck check; check.Item = NULL; check.Amount = -1; while (!sc.CheckToken('}')) { FName key = ParseKey(); switch(key) { case NAME_Item: check.Item = CheckActorType(key); break; case NAME_Count: // Not yet implemented in the engine. Todo later check.Amount = CheckInt(key); break; } } node->ItemCheck.Push(check); return true; }
double wxTransformMatrix::GetRotation() { double temp1 = GetValue(0,0); // for angle calculation double temp2 = GetValue(0,1); // // Rotation double rot_angle = atan2(temp2,temp1)*180/pi; rot_angle = CheckInt(rot_angle); return rot_angle; }
PClassActor *CheckActorType(const char *key) { if (namespace_bits == St) { return GetStrifeType(CheckInt(key)); } else if (namespace_bits == Zd) { PClassActor *cls = PClass::FindActor(CheckString(key)); if (cls == NULL) { sc.ScriptMessage("Unknown actor class '%s'", key); return NULL; } return cls; } return NULL; }
const PClass *CheckActorType(const char *key) { if (namespace_bits == St) { return GetStrifeType(CheckInt(key)); } else if (namespace_bits == Zd) { const PClass *cls = PClass::FindClass(CheckString(key)); if (cls == NULL) { sc.ScriptMessage("Unknown actor class '%s'", key); return NULL; } if (!cls->IsDescendantOf(RUNTIME_CLASS(AActor))) { sc.ScriptMessage("'%s' is not an actor type", key); return NULL; } return cls; } return NULL; }
int inp (int & k) { // �������� ������ �������� ������ � ������� ifstream my_inp ("CON"); long int t; my_inp >> t; switch (my_inp.rdstate()) // ������ ��������� ���������� { case ios::goodbit: // � ��������� ��� � �������! case ios::eofbit: // �������� ���������� ���������� if(CheckInt(t)) return 1; k=t; return 0; case ios::failbit: // ���� ������ ����� �������� case ios::badbit : cout << "\n!!!!! ������ ����� �������� !!!!!"; cout << "\n ���������� ��� ��� ....." << endl; return 1; }; cout << "\n �� ������������ ������ ��� �����..." << endl; return 1; }
bool ParseCost(FStrifeDialogueReply *response) { FStrifeDialogueItemCheck check; check.Item = NULL; check.Amount = -1; while (!sc.CheckToken('}')) { FName key = ParseKey(); switch(key) { case NAME_Item: check.Item = CheckActorType(key); break; case NAME_Amount: check.Amount = CheckInt(key); break; } } response->ItemCheck.Push(check); return true; }
void ParseSector(sector_t *sec, int index) { int lightcolor = -1; int fadecolor = -1; int desaturation = -1; int fplaneflags = 0, cplaneflags = 0; double fp[4] = { 0 }, cp[4] = { 0 }; FString tagstring; memset(sec, 0, sizeof(*sec)); sec->lightlevel = 160; sec->SetXScale(sector_t::floor, 1.); // [RH] floor and ceiling scaling sec->SetYScale(sector_t::floor, 1.); sec->SetXScale(sector_t::ceiling, 1.); sec->SetYScale(sector_t::ceiling, 1.); sec->SetAlpha(sector_t::floor, 1.); sec->SetAlpha(sector_t::ceiling, 1.); sec->thinglist = NULL; sec->touching_thinglist = NULL; // phares 3/14/98 sec->render_thinglist = NULL; sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1; sec->nextsec = -1; //jff 2/26/98 add fields to support locking out sec->prevsec = -1; // stair retriggering until build completes sec->heightsec = NULL; // sector used to get floor and ceiling height sec->sectornum = index; sec->damageinterval = 32; sec->terrainnum[sector_t::ceiling] = sec->terrainnum[sector_t::floor] = -1; if (floordrop) sec->Flags = SECF_FLOORDROP; // killough 3/7/98: end changes sec->gravity = 1.; // [RH] Default sector gravity of 1.0 sec->ZoneNumber = 0xFFFF; // killough 8/28/98: initialize all sectors to normal friction sec->friction = ORIG_FRICTION; sec->movefactor = ORIG_FRICTION_FACTOR; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { FName key = ParseKey(); switch(key) { case NAME_Heightfloor: sec->SetPlaneTexZ(sector_t::floor, CheckFloat(key)); continue; case NAME_Heightceiling: sec->SetPlaneTexZ(sector_t::ceiling, CheckFloat(key)); continue; case NAME_Texturefloor: SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false); continue; case NAME_Textureceiling: SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false); continue; case NAME_Lightlevel: sec->lightlevel = sector_t::ClampLight(CheckInt(key)); continue; case NAME_Special: sec->special = (short)CheckInt(key); if (isTranslated) sec->special = P_TranslateSectorSpecial(sec->special); else if (namespc == NAME_Hexen) { if (sec->special < 0 || sec->special > 255 || !HexenSectorSpecialOk[sec->special]) sec->special = 0; // NULL all unknown specials } continue; case NAME_Id: tagManager.AddSectorTag(index, CheckInt(key)); continue; default: break; } if (namespace_bits & (Zd|Zdt|Va)) switch(key) { case NAME_Xpanningfloor: sec->SetXOffset(sector_t::floor, CheckFloat(key)); continue; case NAME_Ypanningfloor: sec->SetYOffset(sector_t::floor, CheckFloat(key)); continue; case NAME_Xpanningceiling: sec->SetXOffset(sector_t::ceiling, CheckFloat(key)); continue; case NAME_Ypanningceiling: sec->SetYOffset(sector_t::ceiling, CheckFloat(key)); continue; case NAME_Xscalefloor: sec->SetXScale(sector_t::floor, CheckFloat(key)); continue; case NAME_Yscalefloor: sec->SetYScale(sector_t::floor, CheckFloat(key)); continue; case NAME_Xscaleceiling: sec->SetXScale(sector_t::ceiling, CheckFloat(key)); continue; case NAME_Yscaleceiling: sec->SetYScale(sector_t::ceiling, CheckFloat(key)); continue; case NAME_Rotationfloor: sec->SetAngle(sector_t::floor, CheckAngle(key)); continue; case NAME_Rotationceiling: sec->SetAngle(sector_t::ceiling, CheckAngle(key)); continue; case NAME_Lightfloor: sec->SetPlaneLight(sector_t::floor, CheckInt(key)); continue; case NAME_Lightceiling: sec->SetPlaneLight(sector_t::ceiling, CheckInt(key)); continue; case NAME_Alphafloor: sec->SetAlpha(sector_t::floor, CheckFloat(key)); continue; case NAME_Alphaceiling: sec->SetAlpha(sector_t::ceiling, CheckFloat(key)); continue; case NAME_Renderstylefloor: { const char *str = CheckString(key); if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::floor, PLANEF_ADDITIVE, 0); else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ADDITIVE); else sc.ScriptMessage("Unknown value \"%s\" for 'renderstylefloor'\n", str); continue; } case NAME_Renderstyleceiling: { const char *str = CheckString(key); if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::ceiling, PLANEF_ADDITIVE, 0); else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ADDITIVE); else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyleceiling'\n", str); continue; } case NAME_Lightfloorabsolute: if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0); continue; case NAME_Lightceilingabsolute: if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING); else sec->ChangeFlags(sector_t::ceiling, PLANEF_ABSLIGHTING, 0); continue; case NAME_Gravity: sec->gravity = CheckFloat(key); continue; case NAME_Lightcolor: lightcolor = CheckInt(key); continue; case NAME_Fadecolor: fadecolor = CheckInt(key); continue; case NAME_Desaturation: desaturation = int(255*CheckFloat(key)); continue; case NAME_Silent: Flag(sec->Flags, SECF_SILENT, key); continue; case NAME_NoRespawn: Flag(sec->Flags, SECF_NORESPAWN, key); continue; case NAME_Nofallingdamage: Flag(sec->Flags, SECF_NOFALLINGDAMAGE, key); continue; case NAME_Dropactors: Flag(sec->Flags, SECF_FLOORDROP, key); continue; case NAME_SoundSequence: sec->SeqName = CheckString(key); sec->seqType = -1; continue; case NAME_hidden: Flag(sec->MoreFlags, SECF_HIDDEN, key); break; case NAME_Waterzone: Flag(sec->MoreFlags, SECF_UNDERWATER, key); break; case NAME_floorplane_a: fplaneflags |= 1; fp[0] = CheckFloat(key); break; case NAME_floorplane_b: fplaneflags |= 2; fp[1] = CheckFloat(key); break; case NAME_floorplane_c: fplaneflags |= 4; fp[2] = CheckFloat(key); break; case NAME_floorplane_d: fplaneflags |= 8; fp[3] = CheckFloat(key); break; case NAME_ceilingplane_a: cplaneflags |= 1; cp[0] = CheckFloat(key); break; case NAME_ceilingplane_b: cplaneflags |= 2; cp[1] = CheckFloat(key); break; case NAME_ceilingplane_c: cplaneflags |= 4; cp[2] = CheckFloat(key); break; case NAME_ceilingplane_d: cplaneflags |= 8; cp[3] = CheckFloat(key); break; case NAME_damageamount: sec->damageamount = CheckInt(key); break; case NAME_damagetype: sec->damagetype = CheckString(key); break; case NAME_damageinterval: sec->damageinterval = CheckInt(key); if (sec->damageinterval < 1) sec->damageinterval = 1; break; case NAME_leakiness: sec->leakydamage = CheckInt(key); break; case NAME_damageterraineffect: Flag(sec->Flags, SECF_DMGTERRAINFX, key); break; case NAME_damagehazard: Flag(sec->Flags, SECF_HAZARD, key); break; case NAME_floorterrain: sec->terrainnum[sector_t::floor] = P_FindTerrain(CheckString(key)); break; case NAME_ceilingterrain: sec->terrainnum[sector_t::ceiling] = P_FindTerrain(CheckString(key)); break; case NAME_MoreIds: // delay parsing of the tag string until parsing of the sector is complete // This ensures that the ID is always the first tag in the list. tagstring = CheckString(key); break; default: break; } if ((namespace_bits & (Zd | Zdt)) && !strnicmp("user_", key.GetChars(), 5)) { AddUserKey(key, UDMF_Sector, index); } } if (tagstring.IsNotEmpty()) { FScanner sc; sc.OpenString("tagstring", tagstring); // scan the string as long as valid numbers can be found while (sc.CheckNumber()) { if (sc.Number != 0) tagManager.AddSectorTag(index, sc.Number); } } if (sec->damageamount == 0) { // If no damage is set, clear all other related properties so that they do not interfere // with other means of setting them. sec->damagetype = NAME_None; sec->damageinterval = 0; sec->leakydamage = 0; sec->Flags &= ~SECF_DAMAGEFLAGS; } // Reset the planes to their defaults if not all of the plane equation's parameters were found. if (fplaneflags != 15) { sec->floorplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::floor), sector_t::floor); } else { // normalize the vector, it must have a length of 1 DVector3 n = DVector3(fp[0], fp[1], fp[2]).Unit(); sec->floorplane.set(n.X, n.Y, n.Z, fp[3]); } if (cplaneflags != 15) { sec->ceilingplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::ceiling), sector_t::ceiling); } else { DVector3 n = DVector3(cp[0], cp[1], cp[2]).Unit(); sec->ceilingplane.set(n.X, n.Y, n.Z, cp[3]); } if (lightcolor == -1 && fadecolor == -1 && desaturation == -1) { // [RH] Sectors default to white light with the default fade. // If they are outside (have a sky ceiling), they use the outside fog. if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside)) { if (fogMap == NULL) fogMap = GetSpecialLights(PalEntry(255, 255, 255), level.outsidefog, 0); sec->ColorMap = fogMap; } else { if (normMap == NULL) normMap = GetSpecialLights (PalEntry (255,255,255), level.fadeto, NormalLight.Desaturate); sec->ColorMap = normMap; } } else { if (lightcolor == -1) lightcolor = PalEntry(255,255,255); if (fadecolor == -1) { if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside)) fadecolor = level.outsidefog; else fadecolor = level.fadeto; } if (desaturation == -1) desaturation = NormalLight.Desaturate; sec->ColorMap = GetSpecialLights (lightcolor, fadecolor, desaturation); } }
int TestExistingSurface () { int failures = 0; int destroyed = 0; cairo_surface_t *cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10); cairo_surface_set_user_data (cs, &destruction_key, &destroyed, SurfaceDestroyNotifier); failures += CheckInt (cairo_surface_get_reference_count(cs), 1); failures += CheckInt (destroyed, 0); nsRefPtr<gfxASurface> s = gfxASurface::Wrap(cs); failures += CheckInt (GetASurfaceRefCount(s.get()), 2); cairo_surface_reference(cs); failures += CheckInt (GetASurfaceRefCount(s.get()), 3); failures += CheckInt (cairo_surface_get_reference_count(cs), 3); failures += CheckInt (destroyed, 0); gfxASurface *savedWrapper = s.get(); s = nullptr; failures += CheckInt (cairo_surface_get_reference_count(cs), 2); failures += CheckInt (destroyed, 0); s = gfxASurface::Wrap(cs); failures += CheckPointer (s.get(), savedWrapper); failures += CheckInt (GetASurfaceRefCount(s.get()), 3); failures += CheckInt (cairo_surface_get_reference_count(cs), 3); failures += CheckInt (destroyed, 0); cairo_surface_destroy(cs); failures += CheckInt (GetASurfaceRefCount(s.get()), 2); failures += CheckInt (cairo_surface_get_reference_count(cs), 2); failures += CheckInt (destroyed, 0); s = nullptr; failures += CheckInt (cairo_surface_get_reference_count(cs), 1); failures += CheckInt (destroyed, 0); cairo_surface_destroy(cs); failures += CheckInt (destroyed, 1); return failures; }
bool ParsePage() { FStrifeDialogueNode *node = new FStrifeDialogueNode; FStrifeDialogueReply **replyptr = &node->Children; memset(node, 0, sizeof(*node)); //node->ItemCheckCount[0] = node->ItemCheckCount[1] = node->ItemCheckCount[2] = -1; node->ThisNodeNum = StrifeDialogues.Push(node); node->ItemCheckNode = -1; FString SpeakerName; FString Dialogue; while (!sc.CheckToken('}')) { bool block = false; FName key = ParseKey(true, &block); if (!block) { switch(key) { case NAME_Name: SpeakerName = CheckString(key); break; case NAME_Panel: node->Backdrop = TexMan.CheckForTexture (CheckString(key), FTexture::TEX_MiscPatch); break; case NAME_Voice: { const char * name = CheckString(key); if (name[0] != 0) { FString soundname = "svox/"; soundname += name; node->SpeakerVoice = FSoundID(S_FindSound(soundname)); if (node->SpeakerVoice == 0 && namespace_bits == Zd) { node->SpeakerVoice = FSoundID(S_FindSound(name)); } } } break; case NAME_Dialog: Dialogue = CheckString(key); break; case NAME_Drop: node->DropType = CheckActorType(key); break; case NAME_Link: node->ItemCheckNode = CheckInt(key); break; } } else { switch(key) { case NAME_Ifitem: if (!ParseIfItem(node)) return false; break; case NAME_Choice: if (!ParseChoice(replyptr)) return false; break; default: sc.UnGet(); Skip(); } } } node->SpeakerName = ncopystring(SpeakerName); node->Dialogue = ncopystring(Dialogue); return true; }
void ParseLinedef(line_t *ld, int index) { bool passuse = false; bool strifetrans = false; bool strifetrans2 = false; FString arg0str, arg1str; memset(ld, 0, sizeof(*ld)); ld->Alpha = FRACUNIT; ld->id = -1; ld->sidedef[0] = ld->sidedef[1] = NULL; if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX; if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX; if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { FName key = ParseKey(); // This switch contains all keys of the UDMF base spec switch(key) { case NAME_V1: ld->v1 = (vertex_t*)(intptr_t)CheckInt(key); // must be relocated later continue; case NAME_V2: ld->v2 = (vertex_t*)(intptr_t)CheckInt(key); // must be relocated later continue; case NAME_Special: ld->special = CheckInt(key); if (namespc == NAME_Hexen) { if (ld->special < 0 || ld->special > 140 || !HexenLineSpecialOk[ld->special]) ld->special = 0; // NULL all specials which don't exist in Hexen } continue; case NAME_Id: ld->id = CheckInt(key); continue; case NAME_Sidefront: ld->sidedef[0] = (side_t*)(intptr_t)(1 + CheckInt(key)); continue; case NAME_Sideback: ld->sidedef[1] = (side_t*)(intptr_t)(1 + CheckInt(key)); continue; case NAME_Arg0: case NAME_Arg1: case NAME_Arg2: case NAME_Arg3: case NAME_Arg4: ld->args[int(key)-int(NAME_Arg0)] = CheckInt(key); continue; case NAME_Arg0Str: CHECK_N(Zd); arg0str = CheckString(key); continue; case NAME_Arg1Str: CHECK_N(Zd); arg1str = CheckString(key); continue; case NAME_Blocking: Flag(ld->flags, ML_BLOCKING, key); continue; case NAME_Blockmonsters: Flag(ld->flags, ML_BLOCKMONSTERS, key); continue; case NAME_Twosided: Flag(ld->flags, ML_TWOSIDED, key); continue; case NAME_Dontpegtop: Flag(ld->flags, ML_DONTPEGTOP, key); continue; case NAME_Dontpegbottom: Flag(ld->flags, ML_DONTPEGBOTTOM, key); continue; case NAME_Secret: Flag(ld->flags, ML_SECRET, key); continue; case NAME_Blocksound: Flag(ld->flags, ML_SOUNDBLOCK, key); continue; case NAME_Dontdraw: Flag(ld->flags, ML_DONTDRAW, key); continue; case NAME_Mapped: Flag(ld->flags, ML_MAPPED, key); continue; case NAME_Jumpover: CHECK_N(St | Zd | Zdt | Va) Flag(ld->flags, ML_RAILING, key); continue; case NAME_Blockfloaters: CHECK_N(St | Zd | Zdt | Va) Flag(ld->flags, ML_BLOCK_FLOATERS, key); continue; case NAME_Translucent: CHECK_N(St | Zd | Zdt | Va) strifetrans = CheckBool(key); continue; case NAME_Transparent: CHECK_N(St | Zd | Zdt | Va) strifetrans2 = CheckBool(key); continue; case NAME_Passuse: CHECK_N(Dm | Zd | Zdt | Va) passuse = CheckBool(key); continue; default: break; } // This switch contains all keys of the UDMF base spec which only apply to Hexen format specials if (!isTranslated) switch (key) { case NAME_Playercross: Flag(ld->activation, SPAC_Cross, key); continue; case NAME_Playeruse: Flag(ld->activation, SPAC_Use, key); continue; case NAME_Playeruseback: Flag(ld->activation, SPAC_UseBack, key); continue; case NAME_Monstercross: Flag(ld->activation, SPAC_MCross, key); continue; case NAME_Impact: Flag(ld->activation, SPAC_Impact, key); continue; case NAME_Playerpush: Flag(ld->activation, SPAC_Push, key); continue; case NAME_Missilecross: Flag(ld->activation, SPAC_PCross, key); continue; case NAME_Monsteruse: Flag(ld->activation, SPAC_MUse, key); continue; case NAME_Monsterpush: Flag(ld->activation, SPAC_MPush, key); continue; case NAME_Repeatspecial: Flag(ld->flags, ML_REPEAT_SPECIAL, key); continue; default: break; } // This switch contains all keys which are ZDoom specific if (namespace_bits & (Zd|Zdt|Va)) switch(key) { case NAME_Alpha: ld->Alpha = CheckFixed(key); continue; case NAME_Renderstyle: { const char *str = CheckString(key); if (!stricmp(str, "translucent")) ld->flags &= ~ML_ADDTRANS; else if (!stricmp(str, "add")) ld->flags |= ML_ADDTRANS; else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyle'\n", str); continue; } case NAME_Anycross: Flag(ld->activation, SPAC_AnyCross, key); continue; case NAME_Monsteractivate: Flag(ld->flags, ML_MONSTERSCANACTIVATE, key); continue; case NAME_Blockplayers: Flag(ld->flags, ML_BLOCK_PLAYERS, key); continue; case NAME_Blockeverything: Flag(ld->flags, ML_BLOCKEVERYTHING, key); continue; case NAME_Zoneboundary: Flag(ld->flags, ML_ZONEBOUNDARY, key); continue; case NAME_Clipmidtex: Flag(ld->flags, ML_CLIP_MIDTEX, key); continue; case NAME_Wrapmidtex: Flag(ld->flags, ML_WRAP_MIDTEX, key); continue; case NAME_Midtex3d: Flag(ld->flags, ML_3DMIDTEX, key); continue; case NAME_Checkswitchrange: Flag(ld->flags, ML_CHECKSWITCHRANGE, key); continue; case NAME_Firstsideonly: Flag(ld->flags, ML_FIRSTSIDEONLY, key); continue; case NAME_blockprojectiles: Flag(ld->flags, ML_BLOCKPROJECTILE, key); continue; case NAME_blockuse: Flag(ld->flags, ML_BLOCKUSE, key); continue; case NAME_blocksight: Flag(ld->flags, ML_BLOCKSIGHT, key); continue; case NAME_blockhitscan: Flag(ld->flags, ML_BLOCKHITSCAN, key); continue; // [Dusk] lock number case NAME_Locknumber: ld->locknumber = CheckInt(key); continue; default: break; } if (!strnicmp("user_", key.GetChars(), 5)) { AddUserKey(key, UDMF_Line, index); } } if (isTranslated) { int saved = ld->flags; maplinedef_t mld; memset(&mld, 0, sizeof(mld)); mld.special = ld->special; mld.tag = ld->id; P_TranslateLineDef(ld, &mld); ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY)); } if (passuse && (ld->activation & SPAC_Use)) { ld->activation = (ld->activation & ~SPAC_Use) | SPAC_UseThrough; } if (strifetrans && ld->Alpha == FRACUNIT) { ld->Alpha = FRACUNIT * 3/4; } if (strifetrans2 && ld->Alpha == FRACUNIT) { ld->Alpha = FRACUNIT * 1/4; } if (ld->sidedef[0] == NULL) { ld->sidedef[0] = (side_t*)(intptr_t)(1); Printf("Line %d has no first side.\n", index); } if (arg0str.IsNotEmpty() && (P_IsACSSpecial(ld->special) || ld->special == 0)) { ld->args[0] = -FName(arg0str); } if (arg1str.IsNotEmpty() && (P_IsThingSpecial(ld->special) || ld->special == 0)) { ld->args[1] = -FName(arg1str); } }
bool ParseChoice(FStrifeDialogueReply **&replyptr) { FStrifeDialogueReply *reply = new FStrifeDialogueReply; memset(reply, 0, sizeof(*reply)); reply->Next = *replyptr; *replyptr = reply; replyptr = &reply->Next; FString ReplyString; FString QuickYes; FString QuickNo; FString LogString; bool closeDialog = false; reply->NeedsGold = false; while (!sc.CheckToken('}')) { bool block = false; FName key = ParseKey(true, &block); if (!block) { switch(key) { case NAME_Text: ReplyString = CheckString(key); break; case NAME_Displaycost: reply->NeedsGold = CheckBool(key); break; case NAME_Yesmessage: QuickYes = CheckString(key); //if (!QuickYes.Compare("_")) QuickYes = ""; break; case NAME_Nomessage: QuickNo = CheckString(key); break; case NAME_Log: if (namespace_bits == St) { const char *s = CheckString(key); if(strlen(s) < 4 || strnicmp(s, "LOG", 3) != 0) { sc.ScriptMessage("Log must be in the format of LOG# to compile, ignoring."); } else { reply->LogNumber = atoi(s + 3); } } else { LogString = CheckString(key); } break; case NAME_Giveitem: reply->GiveType = CheckActorType(key); break; case NAME_Nextpage: reply->NextNode = CheckInt(key); break; case NAME_Closedialog: closeDialog = CheckBool(key); break; case NAME_Special: reply->ActionSpecial = CheckInt(key); if (reply->ActionSpecial < 0 || reply->ActionSpecial > 255) reply->ActionSpecial = 0; break; case NAME_Arg0: case NAME_Arg1: case NAME_Arg2: case NAME_Arg3: case NAME_Arg4: reply->Args[int(key)-int(NAME_Arg0)] = CheckInt(key); break; } } else { switch(key) { case NAME_Cost: ParseCost(reply); break; default: sc.UnGet(); Skip(); } } } // Todo: Finalize if (reply->ItemCheck.Size() > 0) { if (reply->ItemCheck[0].Amount <= 0) reply->NeedsGold = false; } reply->Reply = ncopystring(ReplyString); reply->QuickYes = ncopystring(QuickYes); if (reply->ItemCheck.Size() > 0 && reply->ItemCheck[0].Item != NULL) { reply->QuickNo = ncopystring(QuickNo); } else { reply->QuickNo = NULL; } reply->LogString = ncopystring(LogString); if(!closeDialog) reply->NextNode *= -1; return true; }
void ParseThing(FMapThing *th) { FString arg0str, arg1str; memset(th, 0, sizeof(*th)); th->gravity = FRACUNIT; th->RenderStyle = STYLE_Count; th->alpha = -1; th->health = 1; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { FName key = ParseKey(); switch(key) { case NAME_Id: th->thingid = CheckInt(key); break; case NAME_X: th->x = CheckFixed(key); break; case NAME_Y: th->y = CheckFixed(key); break; case NAME_Height: th->z = CheckFixed(key); break; case NAME_Angle: th->angle = (short)CheckInt(key); break; case NAME_Type: th->type = (short)CheckInt(key); break; case NAME_Conversation: CHECK_N(Zd | Zdt) th->Conversation = CheckInt(key); break; case NAME_Special: CHECK_N(Hx | Zd | Zdt | Va) th->special = CheckInt(key); break; case NAME_Gravity: CHECK_N(Zd | Zdt) th->gravity = CheckFixed(key); break; case NAME_Arg0: case NAME_Arg1: case NAME_Arg2: case NAME_Arg3: case NAME_Arg4: CHECK_N(Hx | Zd | Zdt | Va) th->args[int(key)-int(NAME_Arg0)] = CheckInt(key); break; case NAME_Arg0Str: CHECK_N(Zd); arg0str = CheckString(key); break; case NAME_Arg1Str: CHECK_N(Zd); arg1str = CheckString(key); break; case NAME_Skill1: case NAME_Skill2: case NAME_Skill3: case NAME_Skill4: case NAME_Skill5: case NAME_Skill6: case NAME_Skill7: case NAME_Skill8: case NAME_Skill9: case NAME_Skill10: case NAME_Skill11: case NAME_Skill12: case NAME_Skill13: case NAME_Skill14: case NAME_Skill15: case NAME_Skill16: if (CheckBool(key)) th->SkillFilter |= (1<<(int(key)-NAME_Skill1)); else th->SkillFilter &= ~(1<<(int(key)-NAME_Skill1)); break; case NAME_Class1: case NAME_Class2: case NAME_Class3: case NAME_Class4: case NAME_Class5: case NAME_Class6: case NAME_Class7: case NAME_Class8: case NAME_Class9: case NAME_Class10: case NAME_Class11: case NAME_Class12: case NAME_Class13: case NAME_Class14: case NAME_Class15: case NAME_Class16: CHECK_N(Hx | Zd | Zdt | Va) if (CheckBool(key)) th->ClassFilter |= (1<<(int(key)-NAME_Class1)); else th->ClassFilter &= ~(1<<(int(key)-NAME_Class1)); break; case NAME_Ambush: Flag(th->flags, MTF_AMBUSH, key); break; case NAME_Dormant: CHECK_N(Hx | Zd | Zdt | Va) Flag(th->flags, MTF_DORMANT, key); break; case NAME_Single: Flag(th->flags, MTF_SINGLE, key); break; case NAME_Coop: Flag(th->flags, MTF_COOPERATIVE, key); break; case NAME_Dm: Flag(th->flags, MTF_DEATHMATCH, key); break; case NAME_Translucent: CHECK_N(St | Zd | Zdt | Va) Flag(th->flags, MTF_SHADOW, key); break; case NAME_Invisible: CHECK_N(St | Zd | Zdt | Va) Flag(th->flags, MTF_ALTSHADOW, key); break; case NAME_Friend: // This maps to Strife's friendly flag CHECK_N(Dm | Zd | Zdt | Va) Flag(th->flags, MTF_FRIENDLY, key); break; case NAME_Strifeally: CHECK_N(St | Zd | Zdt | Va) Flag(th->flags, MTF_FRIENDLY, key); break; case NAME_Standing: CHECK_N(St | Zd | Zdt | Va) Flag(th->flags, MTF_STANDSTILL, key); break; case NAME_Countsecret: CHECK_N(Zd | Zdt | Va) Flag(th->flags, MTF_SECRET, key); break; case NAME_Renderstyle: { FName style = CheckString(key); switch (style) { case NAME_None: th->RenderStyle = STYLE_None; break; case NAME_Normal: th->RenderStyle = STYLE_Normal; break; case NAME_Fuzzy: th->RenderStyle = STYLE_Fuzzy; break; case NAME_SoulTrans: th->RenderStyle = STYLE_SoulTrans; break; case NAME_OptFuzzy: th->RenderStyle = STYLE_OptFuzzy; break; case NAME_Stencil: th->RenderStyle = STYLE_Stencil; break; case NAME_AddStencil: th->RenderStyle = STYLE_AddStencil; break; case NAME_Translucent: th->RenderStyle = STYLE_Translucent; break; case NAME_Add: case NAME_Additive: th->RenderStyle = STYLE_Add; break; case NAME_Shaded: th->RenderStyle = STYLE_Shaded; break; case NAME_AddShaded: th->RenderStyle = STYLE_AddShaded; break; case NAME_TranslucentStencil: th->RenderStyle = STYLE_TranslucentStencil; break; case NAME_Shadow: th->RenderStyle = STYLE_Shadow; break; case NAME_Subtract: case NAME_Subtractive: th->RenderStyle = STYLE_Subtract; break; default: break; } } break; case NAME_Alpha: th->alpha = CheckFixed(key); break; case NAME_FillColor: th->fillcolor = CheckInt(key); case NAME_Health: th->health = CheckInt(key); break; case NAME_Score: th->score = CheckInt(key); break; case NAME_Pitch: th->pitch = (short)CheckInt(key); break; case NAME_Roll: th->roll = (short)CheckInt(key); break; case NAME_ScaleX: th->scaleX = CheckFixed(key); break; case NAME_ScaleY: th->scaleY = CheckFixed(key); break; case NAME_Scale: th->scaleX = th->scaleY = CheckFixed(key); break; default: if (0 == strnicmp("user_", key.GetChars(), 5)) { // Custom user key - Sets an actor's user variable directly FMapThingUserData ud; ud.Property = key; ud.Value = CheckInt(key); MapThingsUserData.Push(ud); } break; } } if (arg0str.IsNotEmpty() && (P_IsACSSpecial(th->special) || th->special == 0)) { th->args[0] = -FName(arg0str); } if (arg1str.IsNotEmpty() && (P_IsThingSpecial(th->special) || th->special == 0)) { th->args[1] = -FName(arg1str); } // Thing specials are only valid in namespaces with Hexen-type specials // and in ZDoomTranslated - which will use the translator on them. if (namespc == NAME_ZDoomTranslated) { maplinedef_t mld; line_t ld; if (th->special != 0) // if special is 0, keep the args (e.g. for bridge things) { // The trigger type is ignored here. mld.flags = 0; mld.special = th->special; mld.tag = th->args[0]; P_TranslateLineDef(&ld, &mld); th->special = ld.special; memcpy(th->args, ld.args, sizeof (ld.args)); } } else if (isTranslated) { th->special = 0; memset(th->args, 0, sizeof (th->args)); } }
void ParseSector(sector_t *sec, int index) { int lightcolor = -1; int fadecolor = -1; int desaturation = -1; int fplaneflags = 0, cplaneflags = 0; double fp[4] = { 0 }, cp[4] = { 0 }; memset(sec, 0, sizeof(*sec)); sec->lightlevel = 160; sec->SetXScale(sector_t::floor, FRACUNIT); // [RH] floor and ceiling scaling sec->SetYScale(sector_t::floor, FRACUNIT); sec->SetXScale(sector_t::ceiling, FRACUNIT); sec->SetYScale(sector_t::ceiling, FRACUNIT); sec->SetAlpha(sector_t::floor, FRACUNIT); sec->SetAlpha(sector_t::ceiling, FRACUNIT); sec->thinglist = NULL; sec->touching_thinglist = NULL; // phares 3/14/98 sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1; sec->nextsec = -1; //jff 2/26/98 add fields to support locking out sec->prevsec = -1; // stair retriggering until build completes sec->heightsec = NULL; // sector used to get floor and ceiling height sec->sectornum = index; if (floordrop) sec->Flags = SECF_FLOORDROP; // killough 3/7/98: end changes sec->gravity = 1.f; // [RH] Default sector gravity of 1.0 sec->ZoneNumber = 0xFFFF; // killough 8/28/98: initialize all sectors to normal friction sec->friction = ORIG_FRICTION; sec->movefactor = ORIG_FRICTION_FACTOR; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { FName key = ParseKey(); switch(key) { case NAME_Heightfloor: sec->SetPlaneTexZ(sector_t::floor, CheckInt(key) << FRACBITS); continue; case NAME_Heightceiling: sec->SetPlaneTexZ(sector_t::ceiling, CheckInt(key) << FRACBITS); continue; case NAME_Texturefloor: SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false); continue; case NAME_Textureceiling: SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false); continue; case NAME_Lightlevel: sec->lightlevel = sector_t::ClampLight(CheckInt(key)); continue; case NAME_Special: sec->special = (short)CheckInt(key); if (isTranslated) sec->special = P_TranslateSectorSpecial(sec->special); else if (namespc == NAME_Hexen) { if (sec->special < 0 || sec->special > 255 || !HexenSectorSpecialOk[sec->special]) sec->special = 0; // NULL all unknown specials } continue; case NAME_Id: sec->tag = (short)CheckInt(key); continue; default: break; } if (namespace_bits & (Zd|Zdt|Va)) switch(key) { case NAME_Xpanningfloor: sec->SetXOffset(sector_t::floor, CheckFixed(key)); continue; case NAME_Ypanningfloor: sec->SetYOffset(sector_t::floor, CheckFixed(key)); continue; case NAME_Xpanningceiling: sec->SetXOffset(sector_t::ceiling, CheckFixed(key)); continue; case NAME_Ypanningceiling: sec->SetYOffset(sector_t::ceiling, CheckFixed(key)); continue; case NAME_Xscalefloor: sec->SetXScale(sector_t::floor, CheckFixed(key)); continue; case NAME_Yscalefloor: sec->SetYScale(sector_t::floor, CheckFixed(key)); continue; case NAME_Xscaleceiling: sec->SetXScale(sector_t::ceiling, CheckFixed(key)); continue; case NAME_Yscaleceiling: sec->SetYScale(sector_t::ceiling, CheckFixed(key)); continue; case NAME_Rotationfloor: sec->SetAngle(sector_t::floor, CheckAngle(key)); continue; case NAME_Rotationceiling: sec->SetAngle(sector_t::ceiling, CheckAngle(key)); continue; case NAME_Lightfloor: sec->SetPlaneLight(sector_t::floor, CheckInt(key)); continue; case NAME_Lightceiling: sec->SetPlaneLight(sector_t::ceiling, CheckInt(key)); continue; case NAME_Alphafloor: sec->SetAlpha(sector_t::floor, CheckFixed(key)); continue; case NAME_Alphaceiling: sec->SetAlpha(sector_t::ceiling, CheckFixed(key)); continue; case NAME_Renderstylefloor: { const char *str = CheckString(key); if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::floor, PLANEF_ADDITIVE, 0); else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ADDITIVE); else sc.ScriptMessage("Unknown value \"%s\" for 'renderstylefloor'\n", str); continue; } case NAME_Renderstyleceiling: { const char *str = CheckString(key); if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::ceiling, PLANEF_ADDITIVE, 0); else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ADDITIVE); else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyleceiling'\n", str); continue; } case NAME_Lightfloorabsolute: if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING); else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0); continue; case NAME_Lightceilingabsolute: if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING); else sec->ChangeFlags(sector_t::ceiling, PLANEF_ABSLIGHTING, 0); continue; case NAME_Gravity: sec->gravity = float(CheckFloat(key)); continue; case NAME_Lightcolor: lightcolor = CheckInt(key); continue; case NAME_Fadecolor: fadecolor = CheckInt(key); continue; case NAME_Desaturation: desaturation = int(255*CheckFloat(key)); continue; case NAME_Silent: Flag(sec->Flags, SECF_SILENT, key); continue; case NAME_NoRespawn: Flag(sec->Flags, SECF_NORESPAWN, key); continue; case NAME_Nofallingdamage: Flag(sec->Flags, SECF_NOFALLINGDAMAGE, key); continue; case NAME_Dropactors: Flag(sec->Flags, SECF_FLOORDROP, key); continue; case NAME_SoundSequence: sec->SeqName = CheckString(key); sec->seqType = -1; continue; case NAME_hidden: Flag(sec->MoreFlags, SECF_HIDDEN, key); break; case NAME_Waterzone: Flag(sec->MoreFlags, SECF_UNDERWATER, key); break; case NAME_floorplane_a: fplaneflags |= 1; fp[0] = CheckFloat(key); break; case NAME_floorplane_b: fplaneflags |= 2; fp[1] = CheckFloat(key); break; case NAME_floorplane_c: fplaneflags |= 4; fp[2] = CheckFloat(key); break; case NAME_floorplane_d: fplaneflags |= 8; fp[3] = CheckFloat(key); break; case NAME_ceilingplane_a: cplaneflags |= 1; cp[0] = CheckFloat(key); break; case NAME_ceilingplane_b: cplaneflags |= 2; cp[1] = CheckFloat(key); break; case NAME_ceilingplane_c: cplaneflags |= 4; cp[2] = CheckFloat(key); break; case NAME_ceilingplane_d: cplaneflags |= 8; cp[3] = CheckFloat(key); break; default: break; } if (!strnicmp("user_", key.GetChars(), 5)) { AddUserKey(key, UDMF_Sector, index); } } sec->secretsector = !!(sec->special&SECRET_MASK); // Reset the planes to their defaults if not all of the plane equation's parameters were found. if (fplaneflags != 15) { sec->floorplane.a = sec->floorplane.b = 0; sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); sec->floorplane.c = FRACUNIT; sec->floorplane.ic = FRACUNIT; } else { double ulen = TVector3<double>(fp[0], fp[1], fp[2]).Length(); // normalize the vector, it must have a length of 1 sec->floorplane.a = FLOAT2FIXED(fp[0] / ulen); sec->floorplane.b = FLOAT2FIXED(fp[1] / ulen); sec->floorplane.c = FLOAT2FIXED(fp[2] / ulen); sec->floorplane.d = FLOAT2FIXED(fp[3] / ulen); sec->floorplane.ic = FLOAT2FIXED(ulen / fp[2]); } if (cplaneflags != 15) { sec->ceilingplane.a = sec->ceilingplane.b = 0; sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); sec->ceilingplane.c = -FRACUNIT; sec->ceilingplane.ic = -FRACUNIT; } else { double ulen = TVector3<double>(cp[0], cp[1], cp[2]).Length(); // normalize the vector, it must have a length of 1 sec->floorplane.a = FLOAT2FIXED(cp[0] / ulen); sec->floorplane.b = FLOAT2FIXED(cp[1] / ulen); sec->floorplane.c = FLOAT2FIXED(cp[2] / ulen); sec->floorplane.d = FLOAT2FIXED(cp[3] / ulen); sec->floorplane.ic = FLOAT2FIXED(ulen / cp[2]); } if (lightcolor == -1 && fadecolor == -1 && desaturation == -1) { // [RH] Sectors default to white light with the default fade. // If they are outside (have a sky ceiling), they use the outside fog. if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) { if (fogMap == NULL) fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); sec->ColorMap = fogMap; } else { if (normMap == NULL) normMap = GetSpecialLights (PalEntry (255,255,255), level.fadeto, NormalLight.Desaturate); sec->ColorMap = normMap; } } else { if (lightcolor == -1) lightcolor = PalEntry(255,255,255); if (fadecolor == -1) { if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) fadecolor = level.outsidefog; else fadecolor = level.fadeto; } if (desaturation == -1) desaturation = NormalLight.Desaturate; sec->ColorMap = GetSpecialLights (lightcolor, fadecolor, desaturation); } }
int TestNewSurface () { int failures = 0; int destroyed = 0; nsRefPtr<gfxASurface> s = new gfxImageSurface (gfxIntSize(10, 10), gfxImageFormat::ARGB32); cairo_surface_t *cs = s->CairoSurface(); cairo_surface_set_user_data (cs, &destruction_key, &destroyed, SurfaceDestroyNotifier); failures += CheckInt (GetASurfaceRefCount(s.get()), 1); failures += CheckInt (cairo_surface_get_reference_count(cs), 1); failures += CheckInt (destroyed, 0); cairo_surface_reference(cs); failures += CheckInt (GetASurfaceRefCount(s.get()), 2); failures += CheckInt (cairo_surface_get_reference_count(cs), 2); failures += CheckInt (destroyed, 0); gfxASurface *savedWrapper = s.get(); s = nullptr; failures += CheckInt (cairo_surface_get_reference_count(cs), 1); failures += CheckInt (destroyed, 0); s = gfxASurface::Wrap(cs); failures += CheckPointer (s.get(), savedWrapper); failures += CheckInt (GetASurfaceRefCount(s.get()), 2); failures += CheckInt (cairo_surface_get_reference_count(cs), 2); failures += CheckInt (destroyed, 0); cairo_surface_destroy(cs); failures += CheckInt (GetASurfaceRefCount(s.get()), 1); failures += CheckInt (cairo_surface_get_reference_count(cs), 1); failures += CheckInt (destroyed, 0); s = nullptr; failures += CheckInt (destroyed, 1); return failures; }
static bool CheckURL(const char *url, const char *scheme, const char *host, const char *domain, const char *siteowner, const char *tld, const char *maintld, const char */* tldregion */, const char *port, const char *path, int pathdepth, const char *filename, const char *extension, const char *params, const char *query, const char *fragment, const char *address, const char *tokens, int verbose=0) { if (verbose>0) printf("Checking with URL: '%s'\n", url); GlobalURL.SetURL((const unsigned char *)url); if (verbose>0) GlobalURL.Dump(); // GlobalURL.Dump(); return CheckString("URL", (const unsigned char *)url, GlobalURL.GetURL()) && CheckString("urltype", (const unsigned char *)scheme, GlobalURL.GetScheme()) && CheckString("host", (const unsigned char *)host, GlobalURL.GetHost()) && CheckString("domain", (const unsigned char *)domain, GlobalURL.GetDomain()) && CheckString("siteowner", (const unsigned char *)siteowner, GlobalURL.GetSiteOwner()) && CheckString("tld", (const unsigned char *)tld, GlobalURL.GetTLD()) && CheckString("maintld", (const unsigned char *)maintld, GlobalURL.GetMainTLD()) && #if 0 CheckString("tldregion", (const unsigned char *)tldregion, GlobalURL.GetTLDRegion()) && #endif CheckString("port", (const unsigned char *)port, GlobalURL.GetPort()) && CheckString("path", (const unsigned char *)path, GlobalURL.GetPath()) && CheckInt("pathdepth", pathdepth, GlobalURL.GetPathDepth()) && CheckString("filename", (const unsigned char *)filename, GlobalURL.GetFilename()) && CheckString("extension", (const unsigned char *)extension, GlobalURL.GetExtension()) && CheckString("params", (const unsigned char *)params, GlobalURL.GetParams()) && CheckString("query", (const unsigned char *)query, GlobalURL.GetQuery()) && CheckString("fragment", (const unsigned char *)fragment, GlobalURL.GetFragment()) && CheckString("address", (const unsigned char *)address, GlobalURL.GetAddress()) && CheckString("TOKENS", (const unsigned char *)tokens, (const unsigned char*)GetTokenString(GlobalURL)); }
PRINTSIZECHECKRESULT CPrintSize::CheckLastActiveItem(void) { PRINTSIZECHECKRESULT Result; Result = PRINT_SIZE_CHECK_UNCHANGED; switch (m_last_active_item_id) { case IDC_INCHES_WIDE: { Result = CheckDouble(IDC_INCHES_WIDE, m_inches_wide, m_min_inches_wide, m_max_inches_wide, PRINT_SIZE_INCHES_PRECISION); if (Result == PRINT_SIZE_CHECK_CHANGED) { m_Size.x = MakeFixed(m_inches_wide); compute_x_scale(); } break; } case IDC_INCHES_TALL: { Result = CheckDouble(IDC_INCHES_TALL, m_inches_tall, m_min_inches_tall, m_max_inches_tall, PRINT_SIZE_INCHES_PRECISION); if (Result == PRINT_SIZE_CHECK_CHANGED) { m_Size.y = MakeFixed(m_inches_tall); compute_y_scale(); } break; } case IDC_SHEETS_WIDE: { Result = CheckInt(IDC_SHEETS_WIDE, m_sheets_wide, m_min_sheets_wide, m_max_sheets_wide); if (Result == PRINT_SIZE_CHECK_CHANGED) { m_Size.x = m_Tile.x*m_sheets_wide; if (m_TileOverlap.x == 0) { m_Size.x -= (m_PaperMargins.Left+m_PaperMargins.Right); } else { m_Size.x -= (m_sheets_wide-1)*m_TileOverlap.x; } m_inches_wide = MakeDouble(m_Size.x); compute_x_scale(); } break; } case IDC_SHEETS_TALL: { Result = CheckInt(IDC_SHEETS_TALL, m_sheets_tall, m_min_sheets_tall, m_max_sheets_tall); if (Result == PRINT_SIZE_CHECK_CHANGED) { m_Size.y = m_Tile.y*m_sheets_tall; if (m_TileOverlap.y == 0) { m_Size.y -= (m_PaperMargins.Top+m_PaperMargins.Bottom); } else { m_Size.y -= (m_sheets_tall-1)*m_TileOverlap.y; } m_inches_tall = MakeDouble(m_Size.y); compute_y_scale(); } break; } case IDC_PRINT_SCALE: { Result = CheckDouble(IDC_PRINT_SCALE, m_scale, m_min_scale, m_max_scale, PRINT_SIZE_PERCENT_PRECISION); break; } } if (Result == PRINT_SIZE_CHECK_CHANGED) { update_size_from_scale(); update_all_but(m_last_active_item_id); } return Result; }
void ParseSidedef(side_t *sd, intmapsidedef_t *sdt, int index) { fixed_t texofs[2]={0,0}; memset(sd, 0, sizeof(*sd)); sdt->bottomtexture = "-"; sdt->toptexture = "-"; sdt->midtexture = "-"; sd->SetTextureXScale(FRACUNIT); sd->SetTextureYScale(FRACUNIT); sc.MustGetToken('{'); while (!sc.CheckToken('}')) { FName key = ParseKey(); switch(key) { case NAME_Offsetx: texofs[0] = CheckInt(key) << FRACBITS; continue; case NAME_Offsety: texofs[1] = CheckInt(key) << FRACBITS; continue; case NAME_Texturetop: sdt->toptexture = CheckString(key); continue; case NAME_Texturebottom: sdt->bottomtexture = CheckString(key); continue; case NAME_Texturemiddle: sdt->midtexture = CheckString(key); continue; case NAME_Sector: sd->sector = (sector_t*)(intptr_t)CheckInt(key); continue; default: break; } if (namespace_bits & (Zd|Zdt|Va)) switch(key) { case NAME_offsetx_top: sd->SetTextureXOffset(side_t::top, CheckFixed(key)); continue; case NAME_offsety_top: sd->SetTextureYOffset(side_t::top, CheckFixed(key)); continue; case NAME_offsetx_mid: sd->SetTextureXOffset(side_t::mid, CheckFixed(key)); continue; case NAME_offsety_mid: sd->SetTextureYOffset(side_t::mid, CheckFixed(key)); continue; case NAME_offsetx_bottom: sd->SetTextureXOffset(side_t::bottom, CheckFixed(key)); continue; case NAME_offsety_bottom: sd->SetTextureYOffset(side_t::bottom, CheckFixed(key)); continue; case NAME_scalex_top: sd->SetTextureXScale(side_t::top, CheckFixed(key)); continue; case NAME_scaley_top: sd->SetTextureYScale(side_t::top, CheckFixed(key)); continue; case NAME_scalex_mid: sd->SetTextureXScale(side_t::mid, CheckFixed(key)); continue; case NAME_scaley_mid: sd->SetTextureYScale(side_t::mid, CheckFixed(key)); continue; case NAME_scalex_bottom: sd->SetTextureXScale(side_t::bottom, CheckFixed(key)); continue; case NAME_scaley_bottom: sd->SetTextureYScale(side_t::bottom, CheckFixed(key)); continue; case NAME_light: sd->SetLight(CheckInt(key)); continue; case NAME_lightabsolute: Flag(sd->Flags, WALLF_ABSLIGHTING, key); continue; case NAME_lightfog: Flag(sd->Flags, WALLF_LIGHT_FOG, key); continue; case NAME_nofakecontrast: Flag(sd->Flags, WALLF_NOFAKECONTRAST, key); continue; case NAME_smoothlighting: Flag(sd->Flags, WALLF_SMOOTHLIGHTING, key); continue; case NAME_Wrapmidtex: Flag(sd->Flags, WALLF_WRAP_MIDTEX, key); continue; case NAME_Clipmidtex: Flag(sd->Flags, WALLF_CLIP_MIDTEX, key); continue; case NAME_Nodecals: Flag(sd->Flags, WALLF_NOAUTODECALS, key); continue; default: break; } if (!strnicmp("user_", key.GetChars(), 5)) { AddUserKey(key, UDMF_Side, index); } } // initialization of these is delayed to allow separate offsets and add them with the global ones. sd->AddTextureXOffset(side_t::top, texofs[0]); sd->AddTextureXOffset(side_t::mid, texofs[0]); sd->AddTextureXOffset(side_t::bottom, texofs[0]); sd->AddTextureYOffset(side_t::top, texofs[1]); sd->AddTextureYOffset(side_t::mid, texofs[1]); sd->AddTextureYOffset(side_t::bottom, texofs[1]); }
void RunCommand(byte* _this, byte* player, const char* ccommand, uint32_t rights, bool console) { if(!ccommand) return; if(ccommand[0] != '#') return; std::string command(ccommand); command = Trim(command); std::string rawcmd = command; size_t spacepos = command.find_first_of(' '); if(spacepos != std::string::npos) rawcmd.erase(spacepos); if(rawcmd == "#mapinfo") { const char* map_file = Config::CurrentMapName.c_str(); const char* map_name = Config::CurrentMapTitle.c_str(); uint32_t tme = zxmgr::GetCurrentMapTime()/1000; uint32_t tm_h = tme / 3600; uint32_t tm_m = tme / 60 - tm_h * 60; uint32_t tm_s = tme - (tm_h * 3600 + tm_m * 60); tme = zxmgr::GetTotalMapTime()*60; uint32_t tt_h = tme / 3600; uint32_t tt_m = tme / 60 - tt_h * 60; uint32_t tt_s = tme - (tt_h * 3600 + tt_m * 60); std::string time_left = "infinite"; if(!Config::Suspended && zxmgr::GetTotalMapTime() != 0x7FFFFFFF) time_left = Format("%u:%02u:%02u", tt_h, tt_m, tt_s); if(player) zxmgr::SendMessage(player, "map: \"%s\" in \"%s\", time elapsed: %u:%02u:%02u, time total: %s", map_name, map_file, tm_h, tm_m, tm_s, time_left.c_str()); else if(console) Printf("Map: \"%s\" in \"%s\", time elapsed: %u:%02u:%02u, time total: %s", map_name, map_file, tm_h, tm_m, tm_s, time_left.c_str()); goto ex; } if(rights & GMF_CMD_CHAT) { if(command.find("#@") == 0) { command.erase(0, 2); std::string what = ""; if(!player || console) what = Format("[broadcast] <server%u>: %s", Config::ServerID, command.c_str()); else if(player) what = Format("[broadcast] %s: %s", *(const char**)(player + 0x18), command.c_str()); else what = Format("[broadcast] %s", command.c_str()); if(!NetCmd_Broadcast(what)) NetHat::Connected = false; goto ex; } else if(command.find("#!") == 0) { command.erase(0, 2); if(!player || console) zxmgr::SendMessage(NULL, "<server>: %s", command.c_str()); else if(player) zxmgr::SendMessage(NULL, "%s: %s", *(const char**)(player + 0x18), command.c_str()); else zxmgr::SendMessage(NULL, command.c_str()); goto ex; } } if(rights & GMF_CMD_KICK) { if(rawcmd == "#kick") { command.erase(0, 5); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(target) zxmgr::Kick(target, false); goto ex; } else if(rawcmd == "#kickme") { if(!player || console) { Printf("This command may not be used from the console."); goto ex; } if(player) zxmgr::Kick(player, true); goto ex; } else if(rawcmd == "#kickall") { zxmgr::KickAll(NULL); goto ex; } else if(rawcmd == "#kick_silent") { command.erase(0, 12); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(target) zxmgr::Kick(target, true); goto ex; } else if(rawcmd == "#disconnect") { command.erase(0, 11); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(target) zxmgr::Disconnect(target); goto ex; } } if(rights & GMF_CMD_INFO) { if(rawcmd == "#locate") { command.erase(0, 7); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(target && *(byte**)(target + 0x38)) { uint32_t p_x = *(uint8_t*)(*(uint32_t*)(*(byte**)(target + 0x38) + 0x10)); uint32_t p_y = *(uint8_t*)(*(uint32_t*)(*(byte**)(target + 0x38) + 0x10) + 1); if(!player || console) Printf("%s (%u:%u)", *(const char**)(target + 0x18), p_x, p_y); else if(player) zxmgr::SendMessage(player, "%s (%u:%u)", *(const char**)(target + 0x18), p_x, p_y); } goto ex; } else if(rawcmd == "#info") { command.erase(0, 5); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(!target) goto ex; if(!*(byte**)(target + 0x38)) goto ex; const char* p_charname = *(const char**)(target + 0x18); const char* p_logname = *(const char**)(target + 0x0A78); byte* netinf = zxmgr::GetNetworkStruct(target); bool p_connected = (netinf); const char* p_address = "n/a"; if(p_connected) p_address = (const char*)(netinf + 8); std::string p_state; if(p_connected) p_state = Format("connected (%s)", p_address); else p_state = "disconnected"; byte* unit = *(byte**)(target + 0x38); uint8_t p_body = *(uint8_t*)(unit + 0x84); uint8_t p_reaction = *(uint8_t*)(unit + 0x86); uint8_t p_mind = *(uint8_t*)(unit + 0x88); uint8_t p_spirit = *(uint8_t*)(unit + 0x8A); const char* p_strong = (vd2_CheckStrong(unit) ? "yes" : "no"); if(!player || console) { Printf("nickname: \"%s\", login: \"%s\", state: %s, stats: [%u,%u,%u,%u], strong: %s", p_charname, p_logname, p_state.c_str(), p_body, p_reaction, p_mind, p_spirit, p_strong); } else if(player) { zxmgr::SendMessage(player, "nickname: \"%s\", login: \"%s\", state: %s, stats: [%u,%u,%u,%u], strong: %s\n", p_charname, p_logname, p_state.c_str(), p_body, p_reaction, p_mind, p_spirit, p_strong); } goto ex; } else if(rawcmd == "#scan") { if(!player) goto ex; byte* unit = *(byte**)(player + 0x38); if(!unit) goto ex; SR_DumpToFile(player); goto ex; } } if(rights & GMF_CMD_KILL) { if(rawcmd == "#kill") { command.erase(0, 5); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(target) { uint32_t tri = 0; if(!*(uint32_t*)(target + 0x2C)) tri = *(uint32_t*)(target + 0x14); if(CHECK_FLAG(tri, GMF_ANY)) { if(((tri & GMF_GODMODE) && (rights & GMF_GODMODE_ADMIN)) || (tri & GMF_GODMODE_ADMIN)) goto ex; } zxmgr::Kill(target, player); } goto ex; } else if(rawcmd == "#murder") { command.erase(0, 7); command = TrimLeft(command); byte* target = zxmgr::FindByNickname(command.c_str()); if(target) { uint32_t tri = 0; if(!*(uint32_t*)(target + 0x2C)) tri = *(uint32_t*)(target + 0x14); if(CHECK_FLAG(tri, GMF_ANY)) { if((((tri & GMF_GODMODE) && !(rights & GMF_GODMODE_ADMIN)) || (tri & GMF_GODMODE_ADMIN)) && target != player) goto ex; } zxmgr::Kill(target, player); byte* unit = *(byte**)(target + 0x38); if(unit && target != player) DropEverything(unit, true); } goto ex; } else if(rawcmd == "#killall") { zxmgr::KillAll(player, false); } else if(rawcmd == "#killai") { zxmgr::KillAll(player, true); } } if(rights & GMF_CMD_PICKUP) { if(rawcmd == "#pickup") { if(!player || console) { Printf("This command may not be used from the console."); goto ex; } if(player) { cheat_codes_2(player, ccommand); } goto ex; } } if(rights & GMF_CMD_SUMMON) { if(rawcmd == "#summon") { if(!player || console) { Printf("This command may not be used from the console."); goto ex; } if(player && *(byte**)(player + 0x38)) { command.erase(0, 7); command = Trim(command); if(!command.length()) goto ex; uint32_t count = 1; size_t fsp = command.find_first_of(" "); if(fsp != std::string::npos) { std::string intstr = command; intstr.erase(fsp); if(CheckInt(intstr)) { command.erase(0, fsp + 1); command = TrimLeft(command); count = StrToInt(intstr); if(!count) count = 1; } } if(!command.length()) goto ex; for(uint32_t i = 0; i < count; i++) { byte* unit = zxmgr::Summon(player, command.c_str(), *(byte**)(0x00642C2C), false, NULL); //byte* unit = Map::CreateUnitForEx(player, command.c_str(), false); //zxmgr::SendMessage(NULL, "what: %02X\n", *(uint8_t*)(*(byte**)(unit + 0x1C4) + 0x78)); //Unit::SetSpells(unit); } } } } if(rights & GMF_CMD_SET) { if(rawcmd == "#nextmap") { zxmgr::NextMap(); goto ex; } else if(rawcmd == "#prevmap") { zxmgr::PrevMap(); goto ex; } else if(rawcmd == "#resetmap") { if(Config::Suspended) { zxmgr::SetTotalMapTime(Config::OriginalTime); Config::Suspended = false; } zxmgr::ResetMap(); goto ex; } else if(rawcmd == "#shutdown") { TerminateProcess(GetCurrentProcess(), 100); goto ex; } else if(rawcmd == "#suspend") { if(!Config::Suspended) { Config::OriginalTime = zxmgr::GetTotalMapTime(); zxmgr::SetTotalMapTime(0x7FFFFFFF); if(!player || console) Printf("Map timer suspended."); else if(player) zxmgr::SendMessage(player, "suspend: map timer suspended."); } else { bool change_map = false; uint32_t cur_time = zxmgr::GetCurrentMapTime() / 60000; if(cur_time >= Config::OriginalTime) change_map = true; zxmgr::SetTotalMapTime(Config::OriginalTime); Config::OriginalTime = 0; if(!player || console) Printf("Map timer released."); else if(player) zxmgr::SendMessage(player, "suspend: map timer released."); if(change_map) { Printf("Note: map timer beyond total map time. Changing map..."); zxmgr::NextMap(); } } Config::Suspended = !Config::Suspended; goto ex; } else if(rawcmd == "#set" && (command.find("#set mode") == 0)) { command.erase(0, 9); command = Trim(command); if(!command.length()) { if(!player || console) Printf("Mode is set to %08X.", Config::ServerFlags); else if(player) zxmgr::SendMessage(player, "mode is set to %08X", Config::ServerFlags); } else { int32_t add_flags = 0; if(command[0] == '+') add_flags = 1; else if(command[0] == '-') add_flags = -1; else if(command[0] == '=') add_flags = 0; else goto ex; if(add_flags != 0) command.erase(0, 1); if(command[0] != '=') goto ex; command.erase(0, 1); uint32_t old_mode = Config::ServerFlags; uint32_t flags = ParseFlags(TrimLeft(command)); if(add_flags == -1) Config::ServerFlags &= ~flags; else if(add_flags == 1) Config::ServerFlags |= flags; else Config::ServerFlags = flags; if(old_mode != Config::ServerFlags) { if(!player || console) Printf("Mode is set to %08X (was: %08X).", Config::ServerFlags, old_mode); else if(player) zxmgr::SendMessage(player, "mode is set to %08X (was: %08X)", Config::ServerFlags, old_mode); if(Config::ServerFlags & SVF_SOFTCORE) { MAX_SKILL = 110; Config::ServerCaps |= SVC_SOFTCORE; } else { MAX_SKILL = 100; Config::ServerCaps &= ~SVC_SOFTCORE; } } else { if(!player || console) Printf("Mode is set to %08X.", Config::ServerFlags); else if(player) zxmgr::SendMessage(player, "mode is set to %08X", Config::ServerFlags); } } goto ex; } else if(command.find("#speed") == 0) { command.erase(0, 6); command = Trim(command); if(!CheckInt(command)) goto ex; uint32_t speed = StrToInt(command); if(!speed) speed = 1; if(speed > 8) speed = 8; zxmgr::SetSpeed(speed); goto ex; } else if(rawcmd == "#mapwide") { if(!player || console) { Printf("This command may not be used from the console."); goto ex; } uint32_t what = 7; // blizzard command.erase(0, 8); command = Trim(command); if(CheckInt(command) && command.length()) what = StrToInt(command); byte* unit = *(byte**)(player + 0x38); if(!unit) goto ex; uint8_t p_x = *(uint8_t*)(*(byte**)(unit + 0x10)); uint8_t p_y = *(uint8_t*)(*(byte**)(unit + 0x10) + 1); uint32_t p_mapwidth = *(uint32_t*)(*(uint32_t*)(0x006B16A8) + 0x50000); uint32_t p_mapheight = *(uint32_t*)(*(uint32_t*)(0x006B16A8) + 0x50004); uint32_t step_x = 1; uint32_t step_y = 1; switch(what) { case 7: // blizzard step_x = 1; step_y = 1; break; case 14: // darkness case 15: // light case 6: // poison cloud step_x = 1; step_y = 1; break; case 9: // acid steam step_x = 1; step_y = 1; break; case 2: // fire ball step_x = 1; step_y = 1; break; case 3: // fire wall step_x = 1; step_y = 1; break; default: // any other spell is forbidden goto ex; } uint32_t count_x = 51; uint32_t count_y = 51; int32_t start_x = p_x - 25; int32_t start_y = p_y - 25; for(int32_t i = start_x; i <= start_x+count_x; i++) { for(int32_t j = start_y; j <= start_y+count_y; j++) { if(i < 8 || i > p_mapwidth-8 || j < 8 || j > p_mapheight-8) continue; zxmgr::CastPointEffect(unit, i, j, what); } } goto ex; } else if(rawcmd == "#inn") { if(!player) goto ex; byte* unit = *(byte**)(player + 0x38); if(!unit) goto ex; byte* item = *(byte**)(unit + 0x74); if(!item) goto ex; zxmgr::SendMessage(NULL, "%04x", *(uint16_t*)(item+0x40)); goto ex; } else if(rawcmd == "#uh") { if(!player) goto ex; SOCKET ps = zxmgr::GetSocket(player); Packet testp; testp.WriteUInt32(0xBADFACE1); SOCK_SendPacket(ps, testp, 0, true); goto ex; } } if(rights & GMF_CMD_CREATE) { if(rawcmd == "#create") { if(!player || console) { Printf("This command may not be used from the console."); goto ex; } if(!*(byte**)(player + 0x38)) goto ex; command.erase(0, 7); command = Trim(command); uint32_t count = 1; size_t fsp = command.find_first_of(" "); if(fsp != std::string::npos) { std::string intstr = command; intstr.erase(fsp); if(CheckInt(intstr)) { command.erase(0, fsp + 1); command = TrimLeft(command); count = StrToInt(intstr); if(!count) count = 1; } } if(ToLower(command) == "gold") { zxmgr::GiveMoney(player, count, 1); } else { if(command.find("{") != std::string::npos) { for(uint32_t i = 0; i < count; i++) { byte* t_item = zxmgr::ConstructItem(command); if(!t_item) goto ex; // special case for scrolls/potions if(*(uint8_t*)(t_item + 0x58) == 0 && *(uint8_t*)(t_item + 0x45) == 0 && *(uint8_t*)(t_item + 0x46) == 0 && *(uint16_t*)(t_item + 0x4A) == 1) { *(uint16_t*)(t_item + 0x42) = count; zxmgr::GiveItemTo(t_item, player); break; } *(uint16_t*)(t_item + 0x42) = 1; zxmgr::GiveItemTo(t_item, player); } } else { byte* t_item = zxmgr::ConstructItem(command); if(!t_item) goto ex; *(uint16_t*)(t_item + 0x42) = count; zxmgr::GiveItemTo(t_item, player); } } zxmgr::UpdateUnit(*(byte**)(player + 0x38), player, 0xFFFFFFFF, 0xFFB, 0, 0); goto ex; } } // #modify player +god: // включает годмод. годмод сбрасывается при выходе игрока с карты ИЛИ при выходе установившего ГМа с карты. // #modify player ++god: годмод НЕ сбрасывается при выходе ГМа с карты. // #modify player -god (--god): отменяет команды выше. количество минусов в данном случае значения не имеет. // #modify player +spells: временно добавляет все заклинания. при выходе игрока или установившего ГМа с карты заклинания // сбрасываются обратно на старую книгу. также можно сбросить заклинания через #modify player -spells. // #modify player -spells: если книга заклинаний игрока не менялась, временно удаляет все заклинания. // при выходе игрока или ГМа с карты заклинания возвращаются в норму. эффект отменяется через #modify player +spells. // #modify player ++spells: то же самое, но навсегда. сбросить заклинания обратно невозможно. // #modify player --spells: см. выше про -spells. if(rights & GMF_CMD_MODIFY) { if(rawcmd == "#modify") { command.erase(0, 7); command = Trim(command); byte* target = NULL; std::string targetname = ""; for(size_t i = 0; i < command.length(); i++) { targetname += command[i]; if(targetname == "self") continue; target = zxmgr::FindByNickname(targetname.c_str()); if(target) break; } if(!target) { std::string lowercommand = ToLower(command); if(lowercommand.find("self") == 0) { targetname = "self"; target = player; } else goto ex; } Player* pi = PI_Get(target); if(!pi) goto ex; command.erase(0, targetname.length()); command = TrimLeft(command); if(!command.length()) goto ex; int r_change = 0; if(command[0] == '+') r_change = 1; else if(command[0] == '-') r_change = -1; if(!r_change) goto ex; command.erase(0, 1); if(!command.length()) goto ex; if(command[0] == '+') r_change = 2; else if(command[0] == '-') r_change = -2; if(r_change == 2 || r_change == -2) command.erase(0, 1); command = ToLower(TrimLeft(command)); byte* unit = *(byte**)(target + 0x38); if(command == "god") { if(r_change > 0) { pi->GodMode = true; if(r_change == 1) pi->GodSetter = player; else pi->GodSetter = NULL; } else if(r_change < 0) { pi->GodMode = false; pi->GodSetter = NULL; } } else if(command == "spells" && unit) { if(r_change > 0) { if(pi->SetSpells == -1 && r_change != 2) // prev. command removed spells { pi->SetSpells = 0; zxmgr::SetSpells(unit, pi->LastSpells); pi->LastSpells = 0; } else { if(r_change == 1) { pi->SetSpells = 1; pi->SpellSetter = player; } else { pi->SetSpells = 0; pi->SpellSetter = NULL; } pi->LastSpells = zxmgr::GetSpells(unit); zxmgr::SetSpells(unit, 0xFFFFFFFF); } } else if(r_change < 0) { if(pi->SetSpells == 1 && r_change != -2) // prev. command added spells { pi->SetSpells = 0; zxmgr::SetSpells(unit, pi->LastSpells); pi->LastSpells = 0; } else { if(r_change == -1) { pi->SetSpells = 1; pi->SpellSetter = player; } else { pi->SetSpells = 0; pi->SpellSetter = NULL; } pi->SetSpells = -1; pi->LastSpells = zxmgr::GetSpells(unit); zxmgr::SetSpells(unit, 0); } } zxmgr::UpdateUnit(unit, 0, 0xFFFFFFFF, 0xFFB, 0, 0); } else if(command == "knowledge" && unit) { if(r_change > 0) { } else if(r_change < 0) { } } } } ex: return; }