int main(int argc, char *argv[]) { float sz, arg; int c; char *myname = "mag"; short done; /* prototypes */ int fontsize(double); double stepsize(double); while (--argc > 0 && (*++argv)[0] == '-') { if (isdigit((int)(*argv)[1])) { /* allow negative numbers as arguments */ break; } done=0; while ((!done) && (c = *++argv[0])) /* allow -bcK like options */ switch (c) { case 'r': invert = 1; break; case 'R': if (*++argv[0] == '\0') { argc--; argv++; } DPI = atof(argv[0]); done = 1; break; default: fatal("%s: %c illegal option\n", myname, c); } } if (argc < 1) fatal("Usage: %s [-r] [-Rdpi] size . . .\n", myname); for ( ; argc; argc--, argv++) { arg=atof(argv[0]); switch (invert) { case 0: printf("%d%c", fontsize(arg), argc > 1 ? ' ' : '\n'); break; case 1: sz=stepsize(arg); if (((int)(10*sz))%10==0) printf("%d%c", (int)sz, argc > 1 ? ' ' : '\n'); else printf("%f%c", sz, argc > 1 ? ' ' : '\n'); } } return 0; }
void MixMod::vem (void) { int i, mycounter; double step,xs,ymax; int imin,imax,icount; for(icount=0;icount<maxstep;icount++) { Gradient ( ); imax=maxderiv(ymax); imin=minderiv(); for(i=0;i<n;i++) { ht[i]=(xf[i][imax]-xf[i][imin]); ht[i]=ht[i]*p[imin]; } step=stepsize (); xs=step*p[imin]; p[imin]=p[imin]-xs; p[imax]=p[imax]+xs; VEMStepsDone = VEMStepsDone + 1; if (((ymax-1.0 )< acc) || (icount == (maxstep-1))) { //stopping criterion is fulfilled! vem_details[0] = k+0.0; //save results of VEM-algorithm in vem_details vem_details[1] = ymax-1.0; //final accurancy of vem... mycounter=0; for (i=2; i<(k+2); i++){ vem_details[i] = p[mycounter]; mycounter++; } mycounter=0; for (i=(2+k); i<((2*k)+2); i++){ vem_details[i] = t[mycounter]; mycounter++; } mycounter=0; for (i=(2+2*k); i<((3*k)+2); i++){ vem_details[i] = grad[mycounter]; mycounter++; } // grad break; } } }
void CWorld::Precache( void ) { COM_TimestampedLog( "CWorld::Precache - Start" ); g_WorldEntity = this; g_fGameOver = false; g_pLastSpawn = NULL; g_Language.SetValue( LANGUAGE_ENGLISH ); // TODO use VGUI to get current language #ifndef INFESTED_DLL ConVarRef stepsize( "sv_stepsize" ); stepsize.SetValue( 24 ); #endif ConVarRef roomtype( "room_type" ); roomtype.SetValue( 0 ); // Set up game rules Assert( !g_pGameRules ); if (g_pGameRules) { delete g_pGameRules; } InstallGameRules(); Assert( g_pGameRules ); g_pGameRules->Init(); CSoundEnt::InitSoundEnt(); // UNDONE: Make most of these things server systems or precache_registers // ================================================= // Activities // ================================================= ActivityList_Free(); RegisterSharedActivities(); EventList_Free(); RegisterSharedEvents(); // Only allow precaching between LevelInitPreEntity and PostEntity CBaseEntity::SetAllowPrecache( true ); COM_TimestampedLog( "IGameSystem::LevelInitPreEntityAllSystems" ); IGameSystem::LevelInitPreEntityAllSystems( STRING( GetModelName() ) ); COM_TimestampedLog( "g_pGameRules->CreateStandardEntities()" ); // Create the player resource g_pGameRules->CreateStandardEntities(); COM_TimestampedLog( "InitBodyQue()" ); InitBodyQue(); COM_TimestampedLog( "SENTENCEG_Init()" ); // init sentence group playback stuff from sentences.txt. // ok to call this multiple times, calls after first are ignored. SENTENCEG_Init(); COM_TimestampedLog( "PrecacheStandardParticleSystems()" ); // Precache standard particle systems PrecacheStandardParticleSystems( ); // the area based ambient sounds MUST be the first precache_sounds COM_TimestampedLog( "W_Precache()" ); // player precaches W_Precache (); // get weapon precaches COM_TimestampedLog( "ClientPrecache()" ); ClientPrecache(); COM_TimestampedLog( "PrecacheTempEnts()" ); // precache all temp ent stuff CBaseTempEntity::PrecacheTempEnts(); COM_TimestampedLog( "LightStyles" ); // // Setup light animation tables. 'a' is total darkness, 'z' is maxbright. // for ( int i = 0; i < ARRAYSIZE(g_DefaultLightstyles); i++ ) { engine->LightStyle( i, GetDefaultLightstyleString(i) ); } // styles 32-62 are assigned by the light program for switchable lights // 63 testing engine->LightStyle(63, "a"); COM_TimestampedLog( "InitializeAINetworks" ); // ================================================= // Load and Init AI Networks // ================================================= CAI_NetworkManager::InitializeAINetworks(); // ================================================= // Load and Init AI Schedules // ================================================= COM_TimestampedLog( "LoadAllSchedules" ); g_AI_SchedulesManager.LoadAllSchedules(); // ================================================= // Initialize NPC Relationships // ================================================= COM_TimestampedLog( "InitDefaultAIRelationships" ); g_pGameRules->InitDefaultAIRelationships(); COM_TimestampedLog( "InitInteractionSystem" ); CBaseCombatCharacter::InitInteractionSystem(); COM_TimestampedLog( "g_pGameRules->Precache" ); // Call the gamerules precache after the AI precache so that games can precache NPCs that are always loaded g_pGameRules->Precache(); if ( m_iszChapterTitle != NULL_STRING ) { DevMsg( 2, "Chapter title: %s\n", STRING(m_iszChapterTitle) ); CMessage *pMessage = (CMessage *)CBaseEntity::Create( "env_message", vec3_origin, vec3_angle, NULL ); if ( pMessage ) { pMessage->SetMessage( m_iszChapterTitle ); m_iszChapterTitle = NULL_STRING; // send the message entity a play message command, delayed by 1 second pMessage->AddSpawnFlags( SF_MESSAGE_ONCE ); pMessage->SetThink( &CMessage::SUB_CallUseToggle ); pMessage->SetNextThink( gpGlobals->curtime + 1.0f ); } } g_iszFuncBrushClassname = AllocPooledString("func_brush"); if ( m_iszDetailSpriteMaterial.Get() != NULL_STRING ) { PrecacheMaterial( STRING( m_iszDetailSpriteMaterial.Get() ) ); } COM_TimestampedLog( "CWorld::Precache - Finish" ); }
static void draw_prelude (int drawcnt, double lobound, double upbound, char *probname) { double labelstep = stepsize (lobound, upbound, 60); double labello; double m; printf ("%%!PS-Adobe-2.0\n"); printf ("/yloc {%.2f exch sub %.2f mul %.2f div %.2f add} def\n", upbound, (double) DRAWING_HEIGHT, upbound - lobound, (double) DRAWING_BOTTOM); printf ("/xloc {%.2f mul %d div %.2f add} def\n", (double) DRAWING_WIDTH, drawcnt, (double) DRAWING_LEFT); printf ("/loc {yloc exch xloc exch} def\n"); printf ("/n {pop loc 1 0 360 arc fill} def\n"); printf ("/e {newpath 0.75 0.75 0.75 setrgbcolor loc moveto loc lineto stroke} def\n"); printf ("/dn {0 1 0 setrgbcolor n} def\n"); printf ("/cn {1 0 0 setrgbcolor n} def\n"); printf ("/bn {1 0 1 setrgbcolor n} def\n"); printf ("/un {1 1 0 setrgbcolor n} def\n"); printf ("/tbn {un} def\n"); printf ("/tcn {un} def\n"); printf ("/dw {gsave newpath 0 0 moveto true charpath pathbbox\n"); printf (" exch 4 3 roll sub 3 1 roll sub grestore} def\n"); printf ("/lbl {gsave loc translate newpath 0 0 moveto %.2f 0 lineto stroke\n", (double) -DRAWING_TIC); printf (" dup dw %.2f 0 moveto 2 div exch neg exch rmoveto show grestore} def\n", (double) -(DRAWING_TIC + DRAWING_TICGAP)); printf ("gsave\n"); printf ("/Helvetica findfont 24 scalefont setfont\n"); printf ("0 0 0 setrgbcolor\n"); printf ("newpath\n"); printf ("%.2f 2 div %.2f add %.2f %.2f add moveto\n", (double) DRAWING_WIDTH, (double) DRAWING_LEFT, (double) DRAWING_HEIGHT, (double) DRAWING_BOTTOM); printf ("(%s Branching Tree) dup stringwidth pop 2 div neg %.2f rmoveto show\n", probname, (double) DRAWING_TITLEGAP); printf ("grestore\n"); printf ("gsave\n"); printf ("0 setlinewidth\n"); printf ("0 0 0 setrgbcolor\n"); printf ("/Helvetica findfont 10 scalefont setfont\n"); printf ("%.2f 0 translate\n", (double) -DRAWING_TICMARGIN); m = fmod (lobound, labelstep); if (m == 0.0) labello = lobound; else labello = lobound + labelstep - m; printf ("newpath 0 %.2f loc moveto 0 %.2f loc lineto stroke\n", lobound, upbound); for (m = labello; m <= upbound; m += labelstep) { printf ("(%.0f) 0 %.2f lbl\n", m, m); } printf ("grestore\n"); printf ("gsave\n"); printf ("0.5 setlinewidth\n"); printf ("0 0 0 setrgbcolor\n"); printf ("\n"); }