void MenuItemSelect(Gwen::Controls::Base* pControl) { if (Hidden()) { SetHidden(false); } else { SetHidden(true); } }
/** Starts the next job in the list */ void D2DContentDownloadDialog::RunNextJob() { // Clean up potential done job delete Zip; Zip = NULL; delete Downloader; Downloader = NULL; if(NextJobs.empty()) { SetHidden(true); // FIXME: Add method to actually close these dialogs... // We're done with everything, apply changes Engine::GAPI->ReloadTextures(); return; } Zip = new ZipArchive; // Get next job Job = NextJobs.front(); NextJobs.pop_front(); LogInfo() << "Downloading file: " << Job.DownloadPackage; // Start new download switch(DownloadType) { case EDL_Normalmaps_Find: default: { // Find which normalmap package we have to download std::string pck = ModSpecific::GetModNormalmapPackName(); Header->SetCaption("Downloading..."); CreateDirectory(Job.TargetPath.c_str(), NULL); TargetFolder = Job.TargetPath.c_str(); } break; } try{ Downloader = new FileDownloader("http://www.gothic-dx11.de/download/" + Job.DownloadPackage, Job.DownloadPackage, ProgressCallback, this); }catch(std::exception e) { LogErrorBox() << "Failed to start content download. Reason: " << e.what(); delete Downloader; // FIXME: Ugly. Should close this on error. SetHidden(true); return; } }
void MenuItemSelect(Gwen::Controls::Base* pControl) { if (m_profWindow->Hidden()) { m_profWindow->SetHidden(false); } else { m_profWindow->SetHidden(true); } }
void wxSettableHeaderColumn::SetIndividualFlags(int flags) { SetResizeable((flags & wxCOL_RESIZABLE) != 0); SetSortable((flags & wxCOL_SORTABLE) != 0); SetReorderable((flags & wxCOL_REORDERABLE) != 0); SetHidden((flags & wxCOL_HIDDEN) != 0); }
// Initialize a conversation. When NULL is being passed create some standard objects for them void CConversation::Init (sf::RenderWindow *pWindow, CTextArea *pTextArea, map<int, SCharacter *> *pCharacters, vector<string> *pFlags) { m_pWindow = pWindow; SetTextArea (pTextArea); SetCharacters (pCharacters); SetFlags (pFlags); SetHidden (false); // initialize the background m_Background.Init (m_pWindow); // Define the Default effects m_DefaultBGIn.m_Type = GFXEffect::FADE; // Fade the scenes in m_DefaultBGIn.m_fStartingValue = 0; m_DefaultBGIn.m_fTargetValue = 255; m_DefaultBGIn.m_fDuration = 1; m_DefaultBGOut.m_Type = GFXEffect::FADE; // Fade the scenes out m_DefaultBGOut.m_fStartingValue = 255; m_DefaultBGOut.m_fTargetValue = 0; m_DefaultBGOut.m_fDuration = 1; // Go to the first scene m_CurScene = 0; }
void Treasure::OnCollidePlayer(Player* p) { if (m_sceneNode && p->IsLocalPlayer()) { // Hide SetHidden(true); p->GetEffect()->SetColour(Colour(0.8f, 1, 1, 1)); p->ShowAttacked(); // Sound fx - TODO different wavs // TODO CONFIG TheSoundManager::Instance()->PlayWav("sound/cashreg.wav"); TheSoundManager::Instance()->PlayWav("sound/bonus_points.wav"); // Add points to local player score ChangePlayerCount(SCORE_KEY, m_points); // Set key in database so this treasure cannot be collected again p->SetKeyVal(MakeTreasureKey(), "y"); // immediate effect TheObjectUpdater::Instance()->SendUpdateReq(p->GetId(), MakeTreasureKey(), "y"); ChangePlayerCount(TREASURE_KEY, +1); } }
void Menu::Close() { SetHidden(true); if (GetDeleteOnClose()) { DelayedDelete(); } }
void set_oper_host(aClient *sptr, char *host) { char uhost[HOSTLEN + USERLEN + 1]; char *p; strlcpy(uhost, host, sizeof(uhost)); if ((p = strchr(uhost, '@'))) { *p++ = '\0'; strlcpy(sptr->user->username, uhost, sizeof(sptr->user->username)); sendto_server(NULL, 0, 0, ":%s SETIDENT %s", sptr->name, sptr->user->username); host = p; } iNAH_host(sptr, host); SetHidden(sptr); }
void Treasure::Update() { // TODO Doesn't move, so no need to do this every frame, right? Ve1Object::Update(); if (m_sceneNode) { Matrix m; m.Translate(m_pos); m_sceneNode->SetLocalTransform(m); m_glow->SetLocalTransform(m); // ??? WHY ??? if (m_sceneNode->GetAABB()) { m_sceneNode->SetAABB(AABB( m_pos.x - XSIZE, m_pos.x + XSIZE, m_pos.y, m_pos.y + YSIZE, m_pos.z - XSIZE, m_pos.z + XSIZE)); } // Delete scene node if we have already been collected // (Extra check in case player not created yet when Load() called) std::string key = MakeTreasureKey(); Assert(GetLocalPlayer()); if (GetLocalPlayer()->Exists(key)) { // Or OnLocationExit ..? SetHidden(true); m_sceneNode = 0; } } GetAABB()->Set( m_pos.x - XSIZE, m_pos.x + XSIZE, m_pos.y, m_pos.y + YSIZE, m_pos.z - XSIZE, m_pos.z + XSIZE); }
/** Draws this sub-view */ void D2DContentDownloadDialog::Draw(const D2D1_RECT_F& clientRectAbs, float deltaTime) { std::string message; if(!Downloader) return; // FIXME: This should be in an update-function // Start the next job if we are done unzipping or the download failed if(UnzipFile == UnzipNumFiles - 1 || Downloader->GetProgress().hasFailed) { UnzipFile = 0; UnzipNumFiles = 0; // Done! // Check for other jobs RunNextJob(); } // Need to check again if the download failed and "RunNextJob()" has deleted the downloader if(!Downloader || IsHidden() || (Downloader->GetProgress().LastInfo.ulProgressMax == 0 && UnzipNumFiles == 0)) // Also don't draw if we are currently not doing anything return; // Size in mbyte float dlCurrent = Downloader->GetProgress().LastInfo.ulProgress / (1024.0f * 1024.0f); float dlMax = Downloader->GetProgress().LastInfo.ulProgressMax / (1024.0f * 1024.0f); if(dlCurrent != dlMax && Downloader->GetProgress().LastInfo.ulProgressMax != 0) { switch(Downloader->GetProgress().LastInfo.ulStatusCode) { case BINDSTATUS_FINDINGRESOURCE: message = "Finding resource..."; break; case BINDSTATUS_CONNECTING: message = "Connecting..."; break; case BINDSTATUS_SENDINGREQUEST: message = "Sending request..."; break; case BINDSTATUS_MIMETYPEAVAILABLE: message = "Mime type available"; break; case BINDSTATUS_CACHEFILENAMEAVAILABLE: message = "Cache filename available"; break; case BINDSTATUS_BEGINDOWNLOADDATA: message = "Begin download"; break; default: { char txt[256]; sprintf_s(txt, "Downloading %s ... (%.2f/%.2f MBytes)", Job.DownloadPackage.c_str(), dlCurrent, dlMax); message = txt; } } } if(UnzipNumFiles > 0) // Unzip-Phase { char txt[256]; sprintf_s(txt, "Unpacking... (%d/%d files)", UnzipFile, UnzipNumFiles); message = txt; if(UnzipFile == UnzipNumFiles - 1) { SetHidden(true); MainView->AddMessageBox("Success!", "Successfully downloaded and unpacked data. Please restart the game to apply the changes!"); } } Header->SetCaption(message); D2DDialog::Draw(clientRectAbs, deltaTime); }
/* * cryptlink_serv - CRYPTLINK SERV message handler * parv[0] == CRYPTLINK * parv[1] == SERV * parv[2] == server name * parv[3] == keyphrase * parv[4] == :server info (M-line) */ static void cryptlink_serv(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { char info[REALLEN + 1]; char *name; struct Client *target_p; char *key = client_p->localClient->out_key; unsigned char *b64_key; struct ConfItem *conf; struct AccessItem *aconf; char *encrypted; const char *p; int enc_len; /* if (client_p->name[0] != 0) return; */ if ((parc < 5) || (*parv[4] == '\0')) { cryptlink_error(client_p, "SERV", "Invalid params", "CRYPTLINK SERV - Invalid params"); return; } if ((name = parse_cryptserv_args(client_p, parv, parc, info, key)) == NULL) { cryptlink_error(client_p, "SERV", "Invalid params", "CRYPTLINK SERV - Invalid params"); return; } /* CRYPTLINK SERV support => TS support */ client_p->tsinfo = TS_DOESTS; if (bogus_host(name)) { exit_client(client_p, client_p, "Bogus server name"); return; } /* Now we just have to call check_server and everything should be * checked for us... -A1kmm. */ switch (check_server(name, client_p, CHECK_SERVER_CRYPTLINK)) { case -1: if (ConfigFileEntry.warn_no_nline) { cryptlink_error(client_p, "SERV", "Unauthorized server connection attempt: No entry for server", NULL); } exit_client(client_p, client_p, "Invalid server name"); return; break; case -2: cryptlink_error(client_p, "SERV", "Unauthorized server connection attempt: CRYPTLINK not " "enabled on remote server", "CRYPTLINK not enabled"); return; break; case -3: cryptlink_error(client_p, "SERV", "Unauthorized server connection attempt: Invalid host", "Invalid host"); return; break; } if ((target_p = find_server(name))) { /* * This link is trying feed me a server that I already have * access through another path -- multiple paths not accepted * currently, kill this link immediately!! * * Rather than KILL the link which introduced it, KILL the * youngest of the two links. -avalon * * Definitely don't do that here. This is from an unregistered * connect - A1kmm. */ cryptlink_error(client_p, "SERV", "Attempt to re-introduce existing server", "Server Exists"); return; } if (ServerInfo.hub && IsCapable(client_p, CAP_LL)) { if (IsCapable(client_p, CAP_HUB)) { ClearCap(client_p,CAP_LL); sendto_realops_flags(UMODE_ALL, L_ALL, "*** LazyLinks to a hub from a hub, that's a no-no."); } else { client_p->localClient->serverMask = nextFreeMask(); if(!client_p->localClient->serverMask) { sendto_realops_flags(UMODE_ALL, L_ALL, "serverMask is full!"); /* try and negotiate a non LL connect */ ClearCap(client_p,CAP_LL); } } } else if (IsCapable(client_p, CAP_LL)) { if (!IsCapable(client_p, CAP_HUB)) { ClearCap(client_p,CAP_LL); sendto_realops_flags(UMODE_ALL, L_ALL, "*** LazyLinks to a leaf from a leaf, that's a no-no."); } } conf = find_conf_name(&client_p->localClient->confs, name, SERVER_TYPE); if (conf == NULL) { cryptlink_error(client_p, "AUTH", "Lost C-line for server", "Lost C-line" ); return; } /* * if we are connecting (Handshake), we already have the name from the * connect {} block in client_p->name */ strlcpy(client_p->name, name, sizeof(client_p->name)); p = info; if (!strncmp(info, "(H)", 3)) { SetHidden(client_p); if ((p = strchr(info, ' ')) != NULL) { p++; if (*p == '\0') p = "(Unknown Location)"; } else p = "(Unknown Location)"; } strlcpy(client_p->info, p, sizeof(client_p->info)); client_p->hopcount = 0; aconf = (struct AccessItem *)map_to_conf(conf); if (!(client_p->localClient->out_cipher || (client_p->localClient->out_cipher = check_cipher(client_p, aconf)))) { cryptlink_error(client_p, "AUTH", "Couldn't find compatible cipher", "Couldn't find compatible cipher"); return; } encrypted = MyMalloc(RSA_size(ServerInfo.rsa_private_key)); enc_len = RSA_public_encrypt(client_p->localClient->out_cipher->keylen, (unsigned char *)key, (unsigned char *)encrypted, aconf->rsa_public_key, RSA_PKCS1_PADDING); if (enc_len <= 0) { report_crypto_errors(); MyFree(encrypted); cryptlink_error(client_p, "AUTH", "Couldn't encrypt data", "Couldn't encrypt data"); return; } base64_block(&b64_key, encrypted, enc_len); MyFree(encrypted); if (!IsWaitAuth(client_p)) { cryptlink_init(client_p, conf, NULL); } sendto_one(client_p, "CRYPTLINK AUTH %s %s", client_p->localClient->out_cipher->name, b64_key); /* needed for old servers that can't shove data back into slink */ send_queued_write(client_p); SetCryptOut(client_p); MyFree(b64_key); }
void Menu::Open() { SetHidden(false); BringToFront(); }
void Actor::HandleCommand( const ParsedCommand &command ) { HandleParams; const CString& sName = sParam(0); // Commands that go in the tweening queue: if ( sName=="sleep" ) Sleep( fParam(1) ); else if( sName=="linear" ) BeginTweening( fParam(1), TWEEN_LINEAR ); else if( sName=="accelerate" ) BeginTweening( fParam(1), TWEEN_ACCELERATE ); else if( sName=="decelerate" ) BeginTweening( fParam(1), TWEEN_DECELERATE ); else if( sName=="bouncebegin" ) BeginTweening( fParam(1), TWEEN_BOUNCE_BEGIN ); else if( sName=="bounceend" ) BeginTweening( fParam(1), TWEEN_BOUNCE_END ); else if( sName=="spring" ) BeginTweening( fParam(1), TWEEN_SPRING ); else if( sName=="stoptweening" ) { StopTweening(); BeginTweening( 0.0001f, TWEEN_LINEAR ); } // Why BeginT again? -Chris else if( sName=="finishtweening" ) FinishTweening(); else if( sName=="hurrytweening" ) HurryTweening( fParam(1) ); else if( sName=="x" ) SetX( fParam(1) ); else if( sName=="y" ) SetY( fParam(1) ); else if( sName=="z" ) SetZ( fParam(1) ); else if( sName=="addx" ) SetX( GetDestX()+fParam(1) ); else if( sName=="addy" ) SetY( GetDestY()+fParam(1) ); else if( sName=="addz" ) SetZ( GetDestZ()+fParam(1) ); else if( sName=="zoom" ) SetZoom( fParam(1) ); else if( sName=="zoomx" ) SetZoomX( fParam(1) ); else if( sName=="zoomy" ) SetZoomY( fParam(1) ); else if( sName=="zoomz" ) SetZoomZ( fParam(1) ); else if( sName=="zoomtowidth" ) ZoomToWidth( fParam(1) ); else if( sName=="zoomtoheight" ) ZoomToHeight( fParam(1) ); else if( sName=="stretchto" ) StretchTo( RectF( fParam(1), fParam(2), fParam(3), fParam(4) ) ); else if( sName=="cropleft" ) SetCropLeft( fParam(1) ); else if( sName=="croptop" ) SetCropTop( fParam(1) ); else if( sName=="cropright" ) SetCropRight( fParam(1) ); else if( sName=="cropbottom" ) SetCropBottom( fParam(1) ); else if( sName=="fadeleft" ) SetFadeLeft( fParam(1) ); else if( sName=="fadetop" ) SetFadeTop( fParam(1) ); else if( sName=="faderight" ) SetFadeRight( fParam(1) ); else if( sName=="fadebottom" ) SetFadeBottom( fParam(1) ); else if( sName=="fadecolor" ) SetFadeDiffuseColor( cParam(1) ); else if( sName=="diffuse" ) SetDiffuse( cParam(1) ); else if( sName=="diffuseleftedge" ) SetDiffuseLeftEdge( cParam(1) ); else if( sName=="diffuserightedge" ) SetDiffuseRightEdge( cParam(1) ); else if( sName=="diffusetopedge" ) SetDiffuseTopEdge( cParam(1) ); else if( sName=="diffusebottomedge" ) SetDiffuseBottomEdge( cParam(1) ); /* Add left/right/top/bottom for alpha if needed. */ else if( sName=="diffusealpha" ) SetDiffuseAlpha( fParam(1) ); else if( sName=="diffusecolor" ) SetDiffuseColor( cParam(1) ); else if( sName=="glow" ) SetGlow( cParam(1) ); else if( sName=="glowmode" ) { if(!sParam(1).CompareNoCase("whiten")) SetGlowMode( GLOW_WHITEN ); else if(!sParam(1).CompareNoCase("brighten")) SetGlowMode( GLOW_BRIGHTEN ); else ASSERT(0); } else if( sName=="rotationx" ) SetRotationX( fParam(1) ); else if( sName=="rotationy" ) SetRotationY( fParam(1) ); else if( sName=="rotationz" ) SetRotationZ( fParam(1) ); else if( sName=="heading" ) AddRotationH( fParam(1) ); else if( sName=="pitch" ) AddRotationP( fParam(1) ); else if( sName=="roll" ) AddRotationR( fParam(1) ); else if( sName=="shadowlength" ) SetShadowLength( fParam(1) ); else if( sName=="horizalign" ) SetHorizAlign( sParam(1) ); else if( sName=="vertalign" ) SetVertAlign( sParam(1) ); else if( sName=="diffuseblink" ) SetEffectDiffuseBlink(); else if( sName=="diffuseshift" ) SetEffectDiffuseShift(); else if( sName=="glowblink" ) SetEffectGlowBlink(); else if( sName=="glowshift" ) SetEffectGlowShift(); else if( sName=="rainbow" ) SetEffectRainbow(); else if( sName=="wag" ) SetEffectWag(); else if( sName=="bounce" ) SetEffectBounce(); else if( sName=="bob" ) SetEffectBob(); else if( sName=="pulse" ) SetEffectPulse(); else if( sName=="spin" ) SetEffectSpin(); else if( sName=="vibrate" ) SetEffectVibrate(); else if( sName=="stopeffect" ) SetEffectNone(); else if( sName=="effectcolor1" ) SetEffectColor1( cParam(1) ); else if( sName=="effectcolor2" ) SetEffectColor2( cParam(1) ); else if( sName=="effectperiod" ) SetEffectPeriod( fParam(1) ); else if( sName=="effectoffset" ) SetEffectOffset( fParam(1) ); else if( sName=="effectdelay" ) SetEffectDelay( fParam(1) ); else if( sName=="effectclock" ) SetEffectClock( sParam(1) ); else if( sName=="effectmagnitude" ) SetEffectMagnitude( RageVector3(fParam(1),fParam(2),fParam(3)) ); else if( sName=="scaletocover" ) { RectI R(iParam(1), iParam(2), iParam(3), iParam(4)); ScaleToCover(R); } else if( sName=="scaletofit" ) { RectI R(iParam(1), iParam(2), iParam(3), iParam(4)); ScaleToFitInside(R); } // Commands that take effect immediately (ignoring the tweening queue): else if( sName=="animate" ) EnableAnimation( bParam(1) ); else if( sName=="setstate" ) SetState( iParam(1) ); else if( sName=="texturewrapping" ) SetTextureWrapping( bParam(1) ); else if( sName=="additiveblend" ) SetBlendMode( bParam(1) ? BLEND_ADD : BLEND_NORMAL ); else if( sName=="blend" ) SetBlendMode( sParam(1) ); else if( sName=="zbuffer" ) SetUseZBuffer( bParam(1) ); else if( sName=="ztest" ) SetZTestMode( bParam(1)?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); else if( sName=="ztestmode" ) SetZTestMode( sParam(1) ); else if( sName=="zwrite" ) SetZWrite( bParam(1) ); else if( sName=="clearzbuffer" ) SetClearZBuffer( bParam(1) ); else if( sName=="backfacecull" ) SetCullMode( bParam(1) ? CULL_BACK : CULL_NONE ); else if( sName=="cullmode" ) SetCullMode( sParam(1) ); else if( sName=="hidden" ) SetHidden( bParam(1) ); else if( sName=="hibernate" ) SetHibernate( fParam(1) ); else if( sName=="draworder" ) SetDrawOrder( iParam(1) ); else if( sName=="playcommand" ) PlayCommand( sParam(1) ); else if( sName=="queuecommand" ) { ParsedCommand newcommand = command; newcommand.vTokens.erase( newcommand.vTokens.begin() ); QueueCommand( newcommand ); return; // don't do parameter number checking } /* These are commands intended for a Sprite commands, but they will get * sent to all sub-actors (which aren't necessarily Sprites) on * GainFocus and LoseFocus. So, don't run CheckHandledParams * on these commands. */ else if( sName=="customtexturerect" || sName=="texcoordvelocity" || sName=="scaletoclipped" || sName=="stretchtexcoords" || sName=="position" || sName=="loop" || sName=="play" || sName=="pause" || sName=="rate" ) return; else { CString sError = ssprintf( "Actor::HandleCommand: Unrecognized command name '%s'.", sName.c_str() ); LOG->Warn( sError ); Dialog::OK( sError ); } CheckHandledParams; }