这篇教程C++ CM_InlineModel函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CM_InlineModel函数的典型用法代码示例。如果您正苦于以下问题:C++ CM_InlineModel函数的具体用法?C++ CM_InlineModel怎么用?C++ CM_InlineModel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CM_InlineModel函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CL_ParseConfigString/*================CL_ParseConfigString================*/void CL_ParseConfigString(void){ int i; char *s; char olds[MAX_QPATH]; i = MSG_ReadShort(&net_message); if (i < 0 || i >= MAX_CONFIGSTRINGS) Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); s = MSG_ReadString(&net_message); strncpy(olds, cl.configstrings[i], sizeof(olds)); olds[sizeof(olds)-1] = 0; strcpy(cl.configstrings[i], s); // do something apropriate if (i >= CS_LIGHTS && i < CS_LIGHTS + MAX_LIGHTSTYLES) CL_SetLightstyle(i - CS_LIGHTS); else if (i == CS_CDTRACK) { if (cl.refresh_prepped) // CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true); CL_PlayBackgroundTrack(); // Knightmare changed } else if (i >= CS_MODELS && i < CS_MODELS + MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i - CS_MODELS] = re.RegisterModel(cl.configstrings[i]); if (cl.configstrings[i][0] == '*') cl.model_clip[i - CS_MODELS] = CM_InlineModel(cl.configstrings[i]); else cl.model_clip[i - CS_MODELS] = NULL; } } else if (i >= CS_SOUNDS && i < CS_SOUNDS + MAX_MODELS) { if (cl.refresh_prepped) cl.sound_precache[i - CS_SOUNDS] = S_RegisterSound(cl.configstrings[i]); } else if (i >= CS_IMAGES && i < CS_IMAGES + MAX_MODELS) { if (cl.refresh_prepped) cl.image_precache[i - CS_IMAGES] = re.RegisterPic(cl.configstrings[i]); } else if (i >= CS_PLAYERSKINS && i < CS_PLAYERSKINS + MAX_CLIENTS) { if (cl.refresh_prepped && strcmp(olds, s)) CL_ParseClientinfo(i - CS_PLAYERSKINS); }}
开发者ID:qbism,项目名称:qbq2,代码行数:58,
示例2: SV_ClearWorld/*===============SV_ClearWorld===============*/void SV_ClearWorld( void ) { clipHandle_t h; vec3_t mins, maxs; Com_Memset( sv_worldSectors, 0, sizeof(sv_worldSectors) ); sv_numworldSectors = 0; // get world map bounds h = CM_InlineModel( 0 ); CM_ModelBounds( h, mins, maxs ); SV_CreateworldSector( 0, mins, maxs );}
开发者ID:Aravind7z,项目名称:zeq2lite,代码行数:18,
示例3: SV_ClipHandleForEntity/*================SV_ClipHandleForEntityReturns a headnode that can be used for testing or clipping to agiven entity. If the entity is a bsp model, the headnode willbe returned, otherwise a custom box tree will be constructed.================*/clipHandle_t SV_ClipHandleForEntity( const sharedEntity_t *ent ) { if ( ent->r.bmodel ) { // explicit hulls in the BSP model return CM_InlineModel( ent->s.modelindex ); } if ( ent->r.svFlags & SVF_CAPSULE ) { // create a temp capsule from bounding box sizes return CM_TempBoxModel( ent->r.mins, ent->r.maxs, qtrue ); } // create a temp tree from bounding box sizes return CM_TempBoxModel( ent->r.mins, ent->r.maxs, qfalse );}
开发者ID:Lrns123,项目名称:jkaq3,代码行数:22,
示例4: SV_ClipHandleForEntity/* * SV_ClipHandleForEntity * * Returns a headnode that can be used for testing or clipping to a * given entity. If the entity is a bsp model, the headnode will * be returned, otherwise a custom box tree will be constructed. */CliphandleSV_ClipHandleForEntity(const Sharedent *ent){ if(ent->r.bmodel) /* explicit hulls in the BSP model */ return CM_InlineModel(ent->s.modelindex); if(ent->r.svFlags & SVF_CAPSULE) /* create a temp capsule from bounding box sizes */ return CM_TempBoxModel(ent->r.mins, ent->r.maxs, qtrue); /* create a temp tree from bounding box sizes */ return CM_TempBoxModel(ent->r.mins, ent->r.maxs, qfalse);}
开发者ID:icanhas,项目名称:yantar,代码行数:20,
示例5: SV_ClearWorld/* * SV_ClearWorld * */voidSV_ClearWorld(void){ Cliphandle h; Vec3 mins, maxs; Q_Memset(sv_worldSectors, 0, sizeof(sv_worldSectors)); sv_numworldSectors = 0; /* get world map bounds */ h = CM_InlineModel(0); CM_ModelBounds(h, mins, maxs); SV_CreateworldSector(0, mins, maxs);}
开发者ID:icanhas,项目名称:yantar,代码行数:18,
示例6: SV_ClipHandleForEntity/*================SV_ClipHandleForEntityReturns a headnode that can be used for testing or clipping to agiven entity. If the entity is a bsp model, the headnode willbe returned, otherwise a custom box tree will be constructed.================*/clipHandle_t SV_ClipHandleForEntity( EntityBase* gameEnt ){ if ( gameEnt->r.bmodel ) { // explicit hulls in the BSP model return CM_InlineModel( gameEnt->s.modelindex ); } if ( gameEnt->r.svFlags & SVF_CAPSULE ) { // create a temp capsule from bounding box sizes return CM_TempBoxModel( gameEnt->r.mins, gameEnt->r.maxs, true ); } // create a temp tree from bounding box sizes return CM_TempBoxModel( gameEnt->r.mins, gameEnt->r.maxs, false );}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:25,
示例7: SV_SetModel/** * @note Also sets mins and maxs for inline bmodels * @sa CM_InlineModel */static void SV_SetModel (edict_t * ent, const char *name){ if (!name) Com_Error(ERR_DROP, "SV_SetModel: NULL"); ent->modelindex = SV_ModelIndex(name); /* if it is an inline model, get the size information for it */ if (name[0] == '*') { const cBspModel_t *mod = CM_InlineModel(&sv->mapTiles, name); /* Copy model mins and maxs to entity */ VectorCopy(mod->mins, ent->mins); VectorCopy(mod->maxs, ent->maxs); /* This is to help the entity collision code out */ /* Copy entity origin and angles to model*/ CM_SetInlineModelOrientation(&sv->mapTiles, name, ent->origin, ent->angles); }}
开发者ID:chrisglass,项目名称:ufoai,代码行数:22,
示例8: CL_GridRecalcRoutingstatic void CL_GridRecalcRouting (const le_t* le){ /* We ALWAYS check against a model, even if it isn't in use. * An unused model is NOT included in the inline list, so it doesn't get * traced against. */ if (!le->model1 || le->inlineModelName[0] != '*') return; if (Com_ServerState()) return; const cBspModel_t* model = CM_InlineModel(cl.mapTiles, le->inlineModelName); if (!model) { return; } AABB absBox(model->cbmBox); absBox.shift(model->origin); GridBox rerouteBox(absBox); Grid_RecalcRouting(cl.mapTiles, cl.mapData->routing, le->inlineModelName, rerouteBox, cl.leInlineModelList);}
开发者ID:yason,项目名称:ufoai,代码行数:21,
示例9: BotImport_BSPModelMinsMaxsOrigin/*==================BotImport_BSPModelMinsMaxsOrigin==================*/static void BotImport_BSPModelMinsMaxsOrigin(int modelnum, vec3_t angles, vec3_t outmins, vec3_t outmaxs, vec3_t origin) { clipHandle_t h; vec3_t mins, maxs; float max; int i; h = CM_InlineModel(modelnum); CM_ModelBounds(h, mins, maxs); //if the model is rotated if ((angles[0] || angles[1] || angles[2])) { // expand for rotation max = RadiusFromBounds(mins, maxs); for (i = 0; i < 3; i++) { mins[i] = -max; maxs[i] = max; } } if (outmins) VectorCopy(mins, outmins); if (outmaxs) VectorCopy(maxs, outmaxs); if (origin) VectorClear(origin);}
开发者ID:baseas,项目名称:aftershock,代码行数:27,
示例10: BotImport_BSPModelMinsMaxsOriginstatic void BotImport_BSPModelMinsMaxsOrigin(int modelnum, vector3 *angles, vector3 *outmins, vector3 *outmaxs, vector3 *origin) { clipHandle_t h; vector3 mins, maxs; float max; int i; h = CM_InlineModel(modelnum); CM_ModelBounds(h, &mins, &maxs); //if the model is rotated if ((angles->pitch || angles->yaw || angles->roll)) { // expand for rotation max = RadiusFromBounds(&mins, &maxs); for (i = 0; i < 3; i++) { mins.data[i] = -max; maxs.data[i] = max; } } if (outmins) VectorCopy(&mins, outmins); if (outmaxs) VectorCopy(&maxs, outmaxs); if (origin) VectorClear(origin);}
开发者ID:Razish,项目名称:QtZ,代码行数:22,
示例11: AAS_CalcReachAndClustersvoid AAS_CalcReachAndClusters(struct quakefile_s *qf){ float time; Log_Print("loading collision map.../n"); // if (!qf->pakfile[0]) { strcpy(qf->pakfile, qf->filename); } //load the map CM_LoadMap((char *) qf, qfalse, &(*aasworld).bspchecksum); //get a handle to the world model worldmodel = CM_InlineModel(0); // 0 = world, 1 + are bmodels //initialize bot import structure AAS_InitBotImport(); //load the BSP entity string AAS_LoadBSPFile(); //init physics settings AAS_InitSettings(); //initialize AAS link heap AAS_InitAASLinkHeap(); //initialize the AAS linked entities for the new map AAS_InitAASLinkedEntities(); //reset all reachabilities and clusters (*aasworld).reachabilitysize = 0; (*aasworld).numclusters = 0; //set all view portals as cluster portals in case we re-calculate the reachabilities and clusters (with -reach) AAS_SetViewPortalsAsClusterPortals(); //calculate reachabilities AAS_InitReachability(); time = 0; while (AAS_ContinueInitReachability(time)) time++; //calculate clusters AAS_InitClustering();} //end of the function AAS_CalcReachAndClusters
开发者ID:morsik,项目名称:war-territory,代码行数:37,
示例12: SV_SetBrushModel/*=================SV_SetBrushModelsets mins and maxs for inline bmodels=================*/void SV_SetBrushModel(sharedEntity_t * ent, const char *name) { clipHandle_t h; vec3_t mins, maxs; if(!name) { Com_Error(ERR_DROP, "SV_SetBrushModel: NULL"); } if(name[0] != '*') { Com_Error(ERR_DROP, "SV_SetBrushModel: %s isn't a brush model", name); } ent->s.modelindex = atoi(name + 1); h = CM_InlineModel(ent->s.modelindex); CM_ModelBounds(h, mins, maxs); VectorCopy(mins, ent->r.mins); VectorCopy(maxs, ent->r.maxs); ent->r.bmodel = true; ent->r.contents = -1; // we don't know exactly what is in the brushes SV_LinkEntity(ent); // FIXME: remove}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:31,
示例13: CL_ParseConfigString/*================CL_ParseConfigString================*/void CL_ParseConfigString (void){ int32_t i; char *s; char olds[MAX_QPATH]; char scratch[1024]; i = MSG_ReadShort (&net_message); if (i < 0 || i >= MAX_CONFIGSTRINGS) Com_Error (ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); s = MSG_ReadString(&net_message); strncpy (olds, cl.configstrings[i], sizeof(olds)); olds[sizeof(olds) - 1] = 0; strcpy (cl.configstrings[i], s); // do something apropriate // Knightmare- 1/2/2002- BIG UGLY HACK for old demos or // connected to server using old protocol // Changed config strings require different parsing if ( LegacyProtocol()) { if (i >= OLD_CS_LIGHTS && i < OLD_CS_LIGHTS+MAX_LIGHTSTYLES) CL_SetLightstyle (i - OLD_CS_LIGHTS); else if (i == CS_CDTRACK) { if (cl.refresh_prepped) CL_PlayBackgroundTrack (); } else if (i >= CS_MODELS && i < CS_MODELS+OLD_MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i-CS_MODELS] = R_RegisterModel (cl.configstrings[i]); if (cl.configstrings[i][0] == '*') cl.model_clip[i-CS_MODELS] = CM_InlineModel (cl.configstrings[i]); else cl.model_clip[i-CS_MODELS] = NULL; } } else if (i >= OLD_CS_SOUNDS && i < OLD_CS_SOUNDS+OLD_MAX_SOUNDS) { if (cl.refresh_prepped) cl.sound_precache[i-OLD_CS_SOUNDS] = S_RegisterSound (cl.configstrings[i]); } else if (i >= OLD_CS_IMAGES && i < OLD_CS_IMAGES+OLD_MAX_IMAGES) { if (cl.refresh_prepped) cl.image_precache[i-OLD_CS_IMAGES] = R_DrawFindPic (cl.configstrings[i]); } else if (i >= OLD_CS_PLAYERSKINS && i < OLD_CS_PLAYERSKINS+MAX_CLIENTS) { if (cl.refresh_prepped && strcmp(olds, s)) CL_ParseClientinfo (i-OLD_CS_PLAYERSKINS); } else if (i >= OLD_CS_ITEMS && i < OLD_CS_ITEMS + MAX_ITEMS) { int j; int item = i - OLD_CS_ITEMS; int32_t token; Com_sprintf (scratch, sizeof(scratch), "use %s", cl.configstrings[i]); token = Q_STLookup(&key_table, scratch); cl.inventorykey[item] = -1; if (token >= 0) { for (j=0; j<MAX_KEYEVENTS; j++) { if (keytokens[j] == token) { cl.inventorykey[item] = j; break; } } } } } else // new configstring offsets { if (i >= CS_LIGHTS && i < CS_LIGHTS+MAX_LIGHTSTYLES) CL_SetLightstyle (i - CS_LIGHTS); else if (i == CS_CDTRACK) { if (cl.refresh_prepped) CL_PlayBackgroundTrack (); } else if (i >= CS_MODELS && i < CS_MODELS+MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i-CS_MODELS] = R_RegisterModel (cl.configstrings[i]); if (cl.configstrings[i][0] == '*') cl.model_clip[i-CS_MODELS] = CM_InlineModel (cl.configstrings[i]); else cl.model_clip[i-CS_MODELS] = NULL; }//.........这里部分代码省略.........
开发者ID:postfix,项目名称:quake2vr,代码行数:101,
示例14: CLWS_CgameSystemCalls// The cgame module is making a system callqintptr CLWS_CgameSystemCalls( qintptr* args ) { switch ( args[ 0 ] ) { case WSCG_PRINT: common->Printf( "%s", ( char* )VMA( 1 ) ); return 0; case WSCG_ERROR: common->Error( "%s", ( char* )VMA( 1 ) ); return 0; case WSCG_MILLISECONDS: return Sys_Milliseconds(); case WSCG_CVAR_REGISTER: Cvar_Register( ( vmCvar_t* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] ); return 0; case WSCG_CVAR_UPDATE: Cvar_Update( ( vmCvar_t* )VMA( 1 ) ); return 0; case WSCG_CVAR_SET: Cvar_Set( ( char* )VMA( 1 ), ( char* )VMA( 2 ) ); return 0; case WSCG_CVAR_VARIABLESTRINGBUFFER: Cvar_VariableStringBuffer( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] ); return 0; case WSCG_ARGC: return Cmd_Argc(); case WSCG_ARGV: Cmd_ArgvBuffer( args[ 1 ], ( char* )VMA( 2 ), args[ 3 ] ); return 0; case WSCG_ARGS: Cmd_ArgsBuffer( ( char* )VMA( 1 ), args[ 2 ] ); return 0; case WSCG_FS_FOPENFILE: return FS_FOpenFileByMode( ( char* )VMA( 1 ), ( fileHandle_t* )VMA( 2 ), ( fsMode_t )args[ 3 ] ); case WSCG_FS_READ: FS_Read( VMA( 1 ), args[ 2 ], args[ 3 ] ); return 0; case WSCG_FS_WRITE: return FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] ); case WSCG_FS_FCLOSEFILE: FS_FCloseFile( args[ 1 ] ); return 0; case WSCG_SENDCONSOLECOMMAND: Cbuf_AddText( ( char* )VMA( 1 ) ); return 0; case WSCG_ADDCOMMAND: CLT3_AddCgameCommand( ( char* )VMA( 1 ) ); return 0; case WSCG_REMOVECOMMAND: Cmd_RemoveCommand( ( char* )VMA( 1 ) ); return 0; case WSCG_SENDCLIENTCOMMAND: CL_AddReliableCommand( ( char* )VMA( 1 ) ); return 0; case WSCG_UPDATESCREEN: SCR_UpdateScreen(); return 0; case WSCG_CM_LOADMAP: CLT3_CM_LoadMap( ( char* )VMA( 1 ) ); return 0; case WSCG_CM_NUMINLINEMODELS: return CM_NumInlineModels(); case WSCG_CM_INLINEMODEL: return CM_InlineModel( args[ 1 ] ); case WSCG_CM_TEMPBOXMODEL: return CM_TempBoxModel( ( float* )VMA( 1 ), ( float* )VMA( 2 ), false ); case WSCG_CM_TEMPCAPSULEMODEL: return CM_TempBoxModel( ( float* )VMA( 1 ), ( float* )VMA( 2 ), true ); case WSCG_CM_POINTCONTENTS: return CM_PointContentsQ3( ( float* )VMA( 1 ), args[ 2 ] ); case WSCG_CM_TRANSFORMEDPOINTCONTENTS: return CM_TransformedPointContentsQ3( ( float* )VMA( 1 ), args[ 2 ], ( float* )VMA( 3 ), ( float* )VMA( 4 ) ); case WSCG_CM_BOXTRACE: CM_BoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], false ); return 0; case WSCG_CM_TRANSFORMEDBOXTRACE: CM_TransformedBoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], ( float* )VMA( 8 ), ( float* )VMA( 9 ), false ); return 0; case WSCG_CM_CAPSULETRACE: CM_BoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], true ); return 0; case WSCG_CM_TRANSFORMEDCAPSULETRACE: CM_TransformedBoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], ( float* )VMA( 8 ), ( float* )VMA( 9 ), true ); return 0; case WSCG_CM_MARKFRAGMENTS: return R_MarkFragmentsWolf( args[ 1 ], ( const vec3_t* )VMA( 2 ), ( float* )VMA( 3 ), args[ 4 ], ( float* )VMA( 5 ), args[ 6 ], ( markFragment_t* )VMA( 7 ) ); case WSCG_S_STARTSOUND: S_StartSound( ( float* )VMA( 1 ), args[ 2 ], args[ 3 ], args[ 4 ], 0.5 ); return 0; case WSCG_S_STARTSOUNDEX: S_StartSoundEx( ( float* )VMA( 1 ), args[ 2 ], args[ 3 ], args[ 4 ], args[ 5 ], 127 ); return 0; case WSCG_S_STARTLOCALSOUND: S_StartLocalSound( args[ 1 ], args[ 2 ], 127 ); return 0; case WSCG_S_CLEARLOOPINGSOUNDS: CLWS_ClearLoopingSounds( args[ 1 ] ); return 0; case WSCG_S_ADDLOOPINGSOUND: // FIXME MrE: handling of looping sounds changed S_AddLoopingSound( args[ 1 ], ( float* )VMA( 2 ), ( float* )VMA( 3 ), args[ 4 ], args[ 5 ], args[ 6 ], 0 );//.........这里部分代码省略.........
开发者ID:janisl,项目名称:jlquake,代码行数:101,
示例15: SV_SpawnServer/* * Change the server to a new map, taking all connected * clients along with it. */void SV_SpawnServer(char *server, char *spawnpoint, server_state_t serverstate, qboolean attractloop, qboolean loadgame){ int i; unsigned checksum; if (attractloop) { Cvar_Set("paused", "0"); } Com_Printf("Server init/n"); Com_DPrintf("SpawnServer: %s/n", server); svs.spawncount++; /* any partially connected client will be restarted */ sv.state = ss_dead; Com_SetServerState(sv.state); /* wipe the entire per-level structure */ memset(&sv, 0, sizeof(sv)); svs.realtime = 0; sv.loadgame = loadgame; sv.attractloop = attractloop; /* save name for levels that don't set message */ strcpy(sv.configstrings[CS_NAME], server); if (Cvar_VariableValue("deathmatch")) { sprintf(sv.configstrings[CS_AIRACCEL], "%g", sv_airaccelerate->value); pm_airaccelerate = sv_airaccelerate->value; } else { strcpy(sv.configstrings[CS_AIRACCEL], "0"); pm_airaccelerate = 0; } SZ_Init(&sv.multicast, sv.multicast_buf, sizeof(sv.multicast_buf)); strcpy(sv.name, server); /* leave slots at start for clients only */ for (i = 0; i < maxclients->value; i++) { /* needs to reconnect */ if (svs.clients[i].state > cs_connected) { svs.clients[i].state = cs_connected; } svs.clients[i].lastframe = -1; } sv.time = 1000; strcpy(sv.name, server); strcpy(sv.configstrings[CS_NAME], server); if (serverstate != ss_game) { sv.models[1] = CM_LoadMap("", false, &checksum); /* no real map */ } else { Com_sprintf(sv.configstrings[CS_MODELS + 1], sizeof(sv.configstrings[CS_MODELS + 1]), "maps/%s.bsp", server); sv.models[1] = CM_LoadMap(sv.configstrings[CS_MODELS + 1], false, &checksum); } Com_sprintf(sv.configstrings[CS_MAPCHECKSUM], sizeof(sv.configstrings[CS_MAPCHECKSUM]), "%i", checksum); /* clear physics interaction links */ SV_ClearWorld(); for (i = 1; i < CM_NumInlineModels(); i++) { Com_sprintf(sv.configstrings[CS_MODELS + 1 + i], sizeof(sv.configstrings[CS_MODELS + 1 + i]), "*%i", i); sv.models[i + 1] = CM_InlineModel(sv.configstrings[CS_MODELS + 1 + i]); } /* spawn the rest of the entities on the map */ sv.state = ss_loading; Com_SetServerState(sv.state); /* load and spawn all other entities */ SpawnEntities(sv.name, CM_EntityString(), spawnpoint); /* run two frames to allow everything to settle */ G_RunFrame(); G_RunFrame(); /* verify game didn't clobber important stuff */ if ((int) checksum != (int) strtol(sv.configstrings[CS_MAPCHECKSUM], (char **) NULL, 10)) { Com_Error(ERR_DROP, "Game DLL corrupted server configstrings"); } /* all precaches are complete */ sv.state = serverstate; Com_SetServerState(sv.state); /* create a baseline for more efficient communications */ SV_CreateBaseline(); /* set serverinfo variable */ Cvar_FullSet("mapname", sv.name, CVAR_SERVERINFO | CVAR_NOSET);}
开发者ID:greck2908,项目名称:qengine,代码行数:99,
示例16: CM_InlineModelstatic inline struct cmodel_s *CL_GameModule_CM_InlineModel( int num ) { return CM_InlineModel( cl.cms, num );}
开发者ID:tenght,项目名称:qfusion,代码行数:3,
示例17: CL_CgameSystemCalls/*====================CL_CgameSystemCallsThe cgame module is making a system call====================*/intptr_t CL_CgameSystemCalls( intptr_t *args ) { switch( args[0] ) { case CG_PRINT: Com_Printf( "%s", (const char*)VMA(1) ); return 0; case CG_ERROR: Com_Error( ERR_DROP, "%s", (const char*)VMA(1) ); return 0; case CG_MILLISECONDS: return Sys_Milliseconds(); case CG_CVAR_REGISTER: Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] ); return 0; case CG_CVAR_UPDATE: Cvar_Update( VMA(1) ); return 0; case CG_CVAR_SET: Cvar_Set( VMA(1), VMA(2) ); return 0; case CG_CVAR_VARIABLESTRINGBUFFER: Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] ); return 0; case CG_ARGC: return Cmd_Argc(); case CG_ARGV: Cmd_ArgvBuffer( args[1], VMA(2), args[3] ); return 0; case CG_ARGS: Cmd_ArgsBuffer( VMA(1), args[2] ); return 0; case CG_FS_FOPENFILE: return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] ); case CG_FS_READ: FS_Read2( VMA(1), args[2], args[3] ); return 0; case CG_FS_WRITE: FS_Write( VMA(1), args[2], args[3] ); return 0; case CG_FS_FCLOSEFILE: FS_FCloseFile( args[1] ); return 0; case CG_FS_SEEK: return FS_Seek( args[1], args[2], args[3] ); case CG_SENDCONSOLECOMMAND: Cbuf_AddText( VMA(1) ); return 0; case CG_ADDCOMMAND: CL_AddCgameCommand( VMA(1) ); return 0; case CG_REMOVECOMMAND: Cmd_RemoveCommand( VMA(1) ); return 0; case CG_SENDCLIENTCOMMAND: CL_AddReliableCommand( VMA(1) ); return 0; case CG_UPDATESCREEN: // this is used during lengthy level loading, so pump message loop// Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!// We can't call Com_EventLoop here, a restart will crash and this _does_ happen// if there is a map change while we are downloading at pk3.// ZOID SCR_UpdateScreen(); return 0; case CG_CM_LOADMAP: CL_CM_LoadMap( VMA(1) ); return 0; case CG_CM_NUMINLINEMODELS: return CM_NumInlineModels(); case CG_CM_INLINEMODEL: return CM_InlineModel( args[1] ); case CG_CM_TEMPBOXMODEL: return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qfalse ); case CG_CM_TEMPCAPSULEMODEL: return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qtrue ); case CG_CM_POINTCONTENTS: return CM_PointContents( VMA(1), args[2] ); case CG_CM_TRANSFORMEDPOINTCONTENTS: return CM_TransformedPointContents( VMA(1), args[2], VMA(3), VMA(4) ); case CG_CM_BOXTRACE: CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse ); return 0; case CG_CM_CAPSULETRACE: CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue ); return 0; case CG_CM_TRANSFORMEDBOXTRACE: CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse ); return 0; case CG_CM_TRANSFORMEDCAPSULETRACE: CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue ); return 0; case CG_CM_MARKFRAGMENTS: return re.MarkFragments( args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7) ); case CG_S_STARTSOUND://.........这里部分代码省略.........
开发者ID:BruceJohnJennerLawso,项目名称:quake3,代码行数:101,
示例18: SV_SpawnServer/*================SV_SpawnServerChange the server to a new map, taking all connectedclients along with it.================*/void SV_SpawnServer (char *server, char *spawnpoint, server_state_t serverstate, qboolean attractloop, qboolean loadgame){ int i; unsigned checksum; if (attractloop) Cvar_Set ("paused", "0"); Com_Printf ("------- Server Initialization -------/n"); Com_DPrintf ("SpawnServer: %s/n",server); if (sv.demofile) fclose (sv.demofile); svs.spawncount++; // any partially connected client will be // restarted sv.state = ss_dead; Com_SetServerState (sv.state); // wipe the entire per-level structure memset (&sv, 0, sizeof(sv)); svs.realtime = 0; sv.loadgame = loadgame; sv.attractloop = attractloop; // save name for levels that don't set message strcpy (sv.configstrings[CS_NAME], server); if (Cvar_VariableValue ("deathmatch")) { sprintf(sv.configstrings[CS_AIRACCEL], "%g", sv_airaccelerate->value); pm_airaccelerate = sv_airaccelerate->value; } else { strcpy(sv.configstrings[CS_AIRACCEL], "0"); pm_airaccelerate = 0; } SZ_Init (&sv.multicast, sv.multicast_buf, sizeof(sv.multicast_buf)); strcpy (sv.name, server); // leave slots at start for clients only for (i=0 ; i<maxclients->value ; i++) { // needs to reconnect if (svs.clients[i].state > cs_connected) svs.clients[i].state = cs_connected; svs.clients[i].lastframe = -1; } sv.time = 1000; strcpy (sv.name, server); strcpy (sv.configstrings[CS_NAME], server); if (serverstate != ss_game) { sv.models[1] = CM_LoadMap ("", false, &checksum); // no real map } else { Com_sprintf (sv.configstrings[CS_MODELS+1],sizeof(sv.configstrings[CS_MODELS+1]), "maps/%s.bsp", server); sv.models[1] = CM_LoadMap (sv.configstrings[CS_MODELS+1], false, &checksum); } Com_sprintf (sv.configstrings[CS_MAPCHECKSUM],sizeof(sv.configstrings[CS_MAPCHECKSUM]), "%i", checksum); // // clear physics interaction links // SV_ClearWorld (); for (i=1 ; i< CM_NumInlineModels() ; i++) { Com_sprintf (sv.configstrings[CS_MODELS+1+i], sizeof(sv.configstrings[CS_MODELS+1+i]), "*%i", i); sv.models[i+1] = CM_InlineModel (sv.configstrings[CS_MODELS+1+i]); } // // spawn the rest of the entities on the map // // precache and static commands can be issued during // map initialization sv.state = ss_loading; Com_SetServerState (sv.state); // load and spawn all other entities//.........这里部分代码省略.........
开发者ID:1vanK,项目名称:Urho3DQuake2,代码行数:101,
示例19: CL_CgameSystemCallsintptr_t CL_CgameSystemCalls(intptr_t *args){ switch (args[0]) { case CG_PRINT: Com_Printf("%s", (char *)VMA(1)); return 0; case CG_ERROR: Com_Error(ERR_DROP, "%s", (char *)VMA(1)); return 0; case CG_MILLISECONDS: return Sys_Milliseconds(); case CG_CVAR_REGISTER: Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]); return 0; case CG_CVAR_UPDATE: Cvar_Update(VMA(1)); return 0; case CG_CVAR_SET: Cvar_SetSafe(VMA(1), VMA(2)); return 0; case CG_CVAR_VARIABLESTRINGBUFFER: Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]); return 0; case CG_CVAR_LATCHEDVARIABLESTRINGBUFFER: Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]); return 0; case CG_ARGC: return Cmd_Argc(); case CG_ARGV: Cmd_ArgvBuffer(args[1], VMA(2), args[3]); return 0; case CG_ARGS: Cmd_ArgsBuffer(VMA(1), args[2]); return 0; case CG_FS_FOPENFILE: return FS_FOpenFileByMode(VMA(1), VMA(2), args[3]); case CG_FS_READ: FS_Read(VMA(1), args[2], args[3]); return 0; case CG_FS_WRITE: return FS_Write(VMA(1), args[2], args[3]); case CG_FS_FCLOSEFILE: FS_FCloseFile(args[1]); return 0; case CG_FS_GETFILELIST: return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]); case CG_FS_DELETEFILE: return FS_Delete(VMA(1)); case CG_SENDCONSOLECOMMAND: Cbuf_AddText(VMA(1)); return 0; case CG_ADDCOMMAND: CL_AddCgameCommand(VMA(1)); return 0; case CG_REMOVECOMMAND: Cmd_RemoveCommandSafe(VMA(1)); return 0; case CG_SENDCLIENTCOMMAND: CL_AddReliableCommand(VMA(1)); return 0; case CG_UPDATESCREEN: SCR_UpdateScreen(); return 0; case CG_CM_LOADMAP: CL_CM_LoadMap(VMA(1)); return 0; case CG_CM_NUMINLINEMODELS: return CM_NumInlineModels(); case CG_CM_INLINEMODEL: return CM_InlineModel(args[1]); case CG_CM_TEMPBOXMODEL: return CM_TempBoxModel(VMA(1), VMA(2), qfalse); case CG_CM_TEMPCAPSULEMODEL: return CM_TempBoxModel(VMA(1), VMA(2), qtrue); case CG_CM_POINTCONTENTS: return CM_PointContents(VMA(1), args[2]); case CG_CM_TRANSFORMEDPOINTCONTENTS: return CM_TransformedPointContents(VMA(1), args[2], VMA(3), VMA(4)); case CG_CM_BOXTRACE: CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse); return 0; case CG_CM_CAPSULETRACE: CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue); return 0; case CG_CM_TRANSFORMEDBOXTRACE: CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse); return 0; case CG_CM_TRANSFORMEDCAPSULETRACE: CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue); return 0; case CG_CM_MARKFRAGMENTS: return re.MarkFragments(args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7)); case CG_R_PROJECTDECAL: re.ProjectDecal(args[1], args[2], VMA(3), VMA(4), VMA(5), args[6], args[7]); return 0; case CG_R_CLEARDECALS: re.ClearDecals(); return 0;//.........这里部分代码省略.........
开发者ID:Mailaender,项目名称:etlegacy,代码行数:101,
示例20: Grid_RecalcRouting/** * @brief This function recalculates the routing surrounding the entity name. * @sa CM_InlineModel * @sa CM_CheckUnit * @sa CM_UpdateConnection * @sa CMod_LoadSubmodels * @sa Grid_RecalcBoxRouting * @param[in] mapTiles List of tiles the current (RMA-)map is composed of * @param[in] map The routing map (either server or client map) * @param[in] name Name of the inline model to compute the mins/maxs for * @param[in] list The local models list (a local model has a name starting with * followed by the model number) */void Grid_RecalcRouting (mapTiles_t *mapTiles, routing_t *map, const char *name, const char **list){ const cBspModel_t *model; pos3_t min, max; unsigned int i; double start, end; start = time(NULL); /* get inline model, if it is one */ if (*name != '*') { Com_Printf("Called Grid_RecalcRouting with no inline model/n"); return; } model = CM_InlineModel(mapTiles, name); if (!model) { Com_Printf("Called Grid_RecalcRouting with invalid inline model name '%s'/n", name); return; } Com_DPrintf(DEBUG_PATHING, "Model:%s origin(%f,%f,%f) angles(%f,%f,%f) mins(%f,%f,%f) maxs(%f,%f,%f)/n", name, model->origin[0], model->origin[1], model->origin[2], model->angles[0], model->angles[1], model->angles[2], model->mins[0], model->mins[1], model->mins[2], model->maxs[0], model->maxs[1], model->maxs[2]); /* get the target model's dimensions */ if (VectorNotEmpty(model->angles)) { vec3_t minVec, maxVec; vec3_t centerVec, halfVec, newCenterVec; vec3_t m[3]; /* Find the center of the extents. */ VectorCenterFromMinsMaxs(model->mins, model->maxs, centerVec); /* Find the half height and half width of the extents. */ VectorSubtract(model->maxs, centerVec, halfVec); /* Rotate the center about the origin. */ VectorCreateRotationMatrix(model->angles, m); VectorRotate(m, centerVec, newCenterVec); /* Set minVec and maxVec to bound around newCenterVec at halfVec size. */ VectorSubtract(newCenterVec, halfVec, minVec); VectorAdd(newCenterVec, halfVec, maxVec); /* Now offset by origin then convert to position (Doors do not have 0 origins) */ VectorAdd(minVec, model->origin, minVec); VecToPos(minVec, min); VectorAdd(maxVec, model->origin, maxVec); VecToPos(maxVec, max); } else { /* normal */ vec3_t temp; /* Now offset by origin then convert to position (Doors do not have 0 origins) */ VectorAdd(model->mins, model->origin, temp); VecToPos(temp, min); VectorAdd(model->maxs, model->origin, temp); VecToPos(temp, max); } /* fit min/max into the world size */ max[0] = min(max[0] + 1, PATHFINDING_WIDTH - 1); max[1] = min(max[1] + 1, PATHFINDING_WIDTH - 1); max[2] = min(max[2] + 1, PATHFINDING_HEIGHT - 1); for (i = 0; i < 3; i++) min[i] = max(min[i] - 1, 0); /* We now have the dimensions, call the generic rerouting function. */ Grid_RecalcBoxRouting(mapTiles, map, min, max, list); end = time(NULL); Com_DPrintf(DEBUG_ROUTING, "Retracing for model %s between (%i, %i, %i) and (%i, %i %i) in %5.1fs/n", name, min[0], min[1], min[2], max[0], max[1], max[2], end - start);}
开发者ID:chrisglass,项目名称:ufoai,代码行数:86,
示例21: CLQ2_PrepRefresh// Call before entering a new level, or after changing dllsvoid CLQ2_PrepRefresh() { if ( !cl.q2_configstrings[ Q2CS_MODELS + 1 ][ 0 ] ) { return; // no map loaded } // let the render dll load the map char mapname[ 32 ]; String::Cpy( mapname, cl.q2_configstrings[ Q2CS_MODELS + 1 ] + 5 ); // skip "maps/" mapname[ String::Length( mapname ) - 4 ] = 0; // cut off ".bsp" // register models, pics, and skins common->Printf( "Map: %s/r", mapname ); SCR_UpdateScreen(); R_BeginRegistrationAndLoadWorld( mapname ); common->Printf( " /r" ); // precache status bar pics common->Printf( "pics/r" ); SCR_UpdateScreen(); SCRQ2_InitHudShaders(); SCR_TouchPics(); common->Printf( " /r" ); CLQ2_RegisterTEntModels(); clq2_num_weaponmodels = 1; String::Cpy( clq2_weaponmodels[ 0 ], "weapon.md2" ); for ( int i = 1; i < MAX_MODELS_Q2 && cl.q2_configstrings[ Q2CS_MODELS + i ][ 0 ]; i++ ) { char name[ MAX_QPATH ]; String::Cpy( name, cl.q2_configstrings[ Q2CS_MODELS + i ] ); name[ 37 ] = 0; // never go beyond one line if ( name[ 0 ] != '*' ) { common->Printf( "%s/r", name ); } SCR_UpdateScreen(); if ( name[ 0 ] == '#' ) { // special player weapon model if ( clq2_num_weaponmodels < MAX_CLIENTWEAPONMODELS_Q2 ) { String::NCpy( clq2_weaponmodels[ clq2_num_weaponmodels ], cl.q2_configstrings[ Q2CS_MODELS + i ] + 1, sizeof ( clq2_weaponmodels[ clq2_num_weaponmodels ] ) - 1 ); clq2_num_weaponmodels++; } } else { cl.model_draw[ i ] = R_RegisterModel( cl.q2_configstrings[ Q2CS_MODELS + i ] ); if ( name[ 0 ] == '*' ) { cl.model_clip[ i ] = CM_InlineModel( String::Atoi( cl.q2_configstrings[ Q2CS_MODELS + i ] + 1 ) ); } else { cl.model_clip[ i ] = 0; } } if ( name[ 0 ] != '*' ) { common->Printf( " /r" ); } } common->Printf( "images/r" ); SCR_UpdateScreen(); for ( int i = 1; i < MAX_IMAGES_Q2 && cl.q2_configstrings[ Q2CS_IMAGES + i ][ 0 ]; i++ ) { cl.q2_image_precache[ i ] = CLQ2_RegisterPicShader( cl.q2_configstrings[ Q2CS_IMAGES + i ] ); } common->Printf( " /r" ); for ( int i = 0; i < MAX_CLIENTS_Q2; i++ ) { if ( !cl.q2_configstrings[ Q2CS_PLAYERSKINS + i ][ 0 ] ) { continue; } common->Printf( "client %i/r", i ); SCR_UpdateScreen(); CLQ2_ParseClientinfo( i ); common->Printf( " /r" ); } CLQ2_LoadClientinfo( &cl.q2_baseclientinfo, "unnamed//male/grunt" ); // set sky textures and speed common->Printf( "sky/r" ); SCR_UpdateScreen(); float rotate = String::Atof( cl.q2_configstrings[ Q2CS_SKYROTATE ] ); vec3_t axis; sscanf( cl.q2_configstrings[ Q2CS_SKYAXIS ], "%f %f %f", &axis[ 0 ], &axis[ 1 ], &axis[ 2 ] ); R_SetSky( cl.q2_configstrings[ Q2CS_SKY ], rotate, axis ); common->Printf( " /r" ); R_EndRegistration(); // clear any lines of console text Con_ClearNotify(); SCR_UpdateScreen(); cl.q2_refresh_prepped = true; // start the cd track CDAudio_Play( String::Atoi( cl.q2_configstrings[ Q2CS_CDTRACK ] ), true );}
开发者ID:janisl,项目名称:jlquake,代码行数:97,
示例22: CL_CgameSystemCalls/*====================CL_CgameSystemCallsThe cgame module is making a system call====================*/intptr_t CL_CgameSystemCalls( intptr_t *args ) { switch ( args[0] ) { case CG_PRINT: Com_Printf( "%s", (const char*)VMA(1) ); return 0; case CG_ERROR: Com_Error( ERR_DROP, "%s", (const char*)VMA(1) ); return 0; case CG_MILLISECONDS: return Sys_Milliseconds(); case CG_CVAR_REGISTER: Cvar_Register( VMA( 1 ), VMA( 2 ), VMA( 3 ), args[4] ); return 0; case CG_CVAR_UPDATE: Cvar_Update( VMA( 1 ) ); return 0; case CG_CVAR_SET: Cvar_SetSafe( VMA(1), VMA(2) ); return 0; case CG_CVAR_VARIABLESTRINGBUFFER: Cvar_VariableStringBuffer( VMA( 1 ), VMA( 2 ), args[3] ); return 0; case CG_ARGC: return Cmd_Argc(); case CG_ARGV: Cmd_ArgvBuffer( args[1], VMA( 2 ), args[3] ); return 0; case CG_ARGS: Cmd_ArgsBuffer( VMA( 1 ), args[2] ); return 0; case CG_FS_FOPENFILE: return FS_FOpenFileByMode( VMA( 1 ), VMA( 2 ), args[3] ); case CG_FS_READ: FS_Read( VMA( 1 ), args[2], args[3] ); return 0; case CG_FS_WRITE: return FS_Write( VMA( 1 ), args[2], args[3] ); case CG_FS_FCLOSEFILE: FS_FCloseFile( args[1] ); return 0; case CG_SENDCONSOLECOMMAND: Cbuf_AddText( VMA( 1 ) ); return 0; case CG_ADDCOMMAND: CL_AddCgameCommand( VMA( 1 ) ); return 0; case CG_REMOVECOMMAND: Cmd_RemoveCommandSafe( VMA(1) ); return 0; case CG_SENDCLIENTCOMMAND: CL_AddReliableCommand(VMA(1), qfalse); return 0; case CG_UPDATESCREEN: // this is used during lengthy level loading, so pump message loop// Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!// We can't call Com_EventLoop here, a restart will crash and this _does_ happen// if there is a map change while we are downloading at pk3.// ZOID SCR_UpdateScreen(); return 0; case CG_CM_LOADMAP: CL_CM_LoadMap( VMA( 1 ) ); return 0; case CG_CM_NUMINLINEMODELS: return CM_NumInlineModels(); case CG_CM_INLINEMODEL: return CM_InlineModel( args[1] ); case CG_CM_TEMPBOXMODEL: return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qfalse ); case CG_CM_TEMPCAPSULEMODEL: return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qtrue ); case CG_CM_POINTCONTENTS: return CM_PointContents( VMA( 1 ), args[2] ); case CG_CM_TRANSFORMEDPOINTCONTENTS: return CM_TransformedPointContents( VMA( 1 ), args[2], VMA( 3 ), VMA( 4 ) ); case CG_CM_BOXTRACE: CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], /*int capsule*/ qfalse ); return 0; case CG_CM_TRANSFORMEDBOXTRACE: CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], VMA( 8 ), VMA( 9 ), /*int capsule*/ qfalse ); return 0; case CG_CM_CAPSULETRACE: CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], /*int capsule*/ qtrue ); return 0; case CG_CM_TRANSFORMEDCAPSULETRACE: CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], VMA( 8 ), VMA( 9 ), /*int capsule*/ qtrue ); return 0; case CG_CM_MARKFRAGMENTS: return re.MarkFragments( args[1], VMA( 2 ), VMA( 3 ), args[4], VMA( 5 ), args[6], VMA( 7 ) ); case CG_S_STARTSOUND: S_StartSound( VMA( 1 ), args[2], args[3], args[4] ); return 0;//----(SA) added//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,
示例23: Grid_RecalcRouting/** * @brief This function recalculates the routing surrounding the entity name. * @sa CM_InlineModel * @sa CM_CheckUnit * @sa CM_UpdateConnection * @sa CMod_LoadSubmodels * @sa Grid_RecalcBoxRouting * @param[in] mapTiles List of tiles the current (RMA-)map is composed of * @param[in] routing The routing map (either server or client map) * @param[in] name Name of the inline model to compute the mins/maxs for * @param[in] box The box around the inline model (alternative to name) * @param[in] list The local models list (a local model has a name starting with * followed by the model number) */void Grid_RecalcRouting (mapTiles_t *mapTiles, Routing &routing, const char *name, const GridBox &box, const char **list){ if (box.isZero()) { pos3_t min, max; vec3_t absmin, absmax; const cBspModel_t *model; unsigned int i; /* get inline model, if it is one */ if (*name != '*') { Com_Printf("Called Grid_RecalcRouting with no inline model/n"); return; } model = CM_InlineModel(mapTiles, name); if (!model) { Com_Printf("Called Grid_RecalcRouting with invalid inline model name '%s'/n", name); return; }#if 1 /* An attempt to fix the 'doors starting opened' bug (# 3456). * The main difference is the (missing) rotation of the halfVec. * The results are better, but do not fix the problem. */ CalculateMinsMaxs(model->angles, model->mins, model->maxs, model->origin, absmin, absmax);#else /* get the target model's dimensions */ if (VectorNotEmpty(model->angles)) { vec3_t minVec, maxVec; vec3_t centerVec, halfVec, newCenterVec; vec3_t m[3]; /* Find the center of the extents. */ VectorCenterFromMinsMaxs(model->mins, model->maxs, centerVec); /* Find the half height and half width of the extents. */ VectorSubtract(model->maxs, centerVec, halfVec); /* Rotate the center about the origin. */ VectorCreateRotationMatrix(model->angles, m); VectorRotate(m, centerVec, newCenterVec); /* Set minVec and maxVec to bound around newCenterVec at halfVec size. */ VectorSubtract(newCenterVec, halfVec, minVec); VectorAdd(newCenterVec, halfVec, maxVec); /* Now offset by origin then convert to position (Doors do not have 0 origins) */ VectorAdd(minVec, model->origin, absmin); VectorAdd(maxVec, model->origin, absmax); } else { /* normal */ /* Now offset by origin then convert to position (Doors do not have 0 origins) */ VectorAdd(model->mins, model->origin, absmin); VectorAdd(model->maxs, model->origin, absmax); }#endif VecToPos(absmin, min); VecToPos(absmax, max); /* fit min/max into the world size */ max[0] = std::min(max[0], (pos_t)(PATHFINDING_WIDTH - 1)); max[1] = std::min(max[1], (pos_t)(PATHFINDING_WIDTH - 1)); max[2] = std::min(max[2], (pos_t)(PATHFINDING_HEIGHT - 1)); for (i = 0; i < 3; i++) min[i] = std::max(min[i], (pos_t)0); /* We now have the dimensions, call the generic rerouting function. */ GridBox rerouteBox(min, max); Grid_RecalcBoxRouting(mapTiles, routing, rerouteBox, list); } else { /* use the passed box */ Grid_RecalcBoxRouting(mapTiles, routing, box, list); }}
开发者ID:ibrahimmusba,项目名称:ufoai,代码行数:84,
示例24: NQD_ParseServerData/*==================NQD_ParseServerData==================*/static void NQD_ParseServerData (void){ char *str; int i; int nummodels, numsounds; char mapname[MAX_QPATH]; int cs2; qbool gpl_map;#ifdef GLQUAKE extern qbool r_gpl_map;#endif Com_DPrintf ("Serverdata packet received./n");//// wipe the client_state_t struct// CL_ClearState ();// parse protocol version number i = MSG_ReadLong (); if (i != NQ_PROTOCOL_VERSION) Host_Error ("Server returned version %i, not %i", i, NQ_PROTOCOL_VERSION);// parse maxclients nq_maxclients = MSG_ReadByte (); if (nq_maxclients < 1 || nq_maxclients > NQ_MAX_CLIENTS) Host_Error ("Bad maxclients (%u) from server", nq_maxclients);// parse gametype cl.gametype = MSG_ReadByte() ? GAME_DEATHMATCH : GAME_COOP;// parse signon message str = MSG_ReadString (); strlcpy (cl.levelname, str, sizeof(cl.levelname));// separate the printfs so the server message can have a color Com_Printf("/n/n/35/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/37/n/n"); Com_Printf ("%c%s/n", 2, str);//// first we go through and touch all of the precache data that still// happens to be in the cache, so precaching something else doesn't// needlessly purge it//// precache models for (nummodels=1 ; ; nummodels++) { str = MSG_ReadString (); if (!str[0]) break; if (nummodels == MAX_MODELS) Host_Error ("Server sent too many model precaches"); strlcpy (cl.model_name[nummodels], str, sizeof(cl.model_name[0])); Mod_TouchModel (str); }// precache sounds for (numsounds=1 ; ; numsounds++) { str = MSG_ReadString (); if (!str[0]) break; if (numsounds == MAX_SOUNDS) Host_Error ("Server sent too many sound precaches"); strlcpy (cl.sound_name[numsounds], str, sizeof(cl.sound_name[0])); S_TouchSound (str); }//// now we try to load everything else until a cache allocation fails// cl.clipmodels[1] = CM_LoadMap (cl.model_name[1], true, NULL, &cl.map_checksum2); COM_StripExtension (COM_SkipPath(cl.model_name[1]), mapname); cs2 = Com_TranslateMapChecksum (mapname, cl.map_checksum2); gpl_map = (cl.map_checksum2 != cs2); cl.map_checksum2 = cs2;#ifdef GLQUAKE r_gpl_map = gpl_map;#endif for (i = 1; i < nummodels; i++) { cl.model_precache[i] = Mod_ForName (cl.model_name[i], false, i == 1); if (cl.model_precache[i] == NULL) Host_Error ("Model %s not found", cl.model_name[i]); if (cl.model_name[i][0] == '*') cl.clipmodels[i] = CM_InlineModel(cl.model_name[i]); } for (i=1 ; i<numsounds ; i++) { cl.sound_precache[i] = S_PrecacheSound (cl.sound_name[i]); }//.........这里部分代码省略.........
开发者ID:luaman,项目名称:zq,代码行数:101,
示例25: SV_Map/** * @brief Change the server to a new map, taking all connected clients along with it. * @note the full syntax is: @code map [day|night] [+]<map> [<assembly>] @endcode * @sa SV_AssembleMap * @sa CM_LoadMap * @sa Com_SetServerState */void SV_Map (qboolean day, const char *levelstring, const char *assembly){ int i; unsigned checksum = 0; char * map = SV_GetConfigString(CS_TILES); char * pos = SV_GetConfigString(CS_POSITIONS); mapInfo_t *randomMap = NULL; client_t *cl; /* any partially connected client will be restarted */ Com_SetServerState(ss_restart); /* the game is just starting */ SV_InitGame(); if (!svs.initialized) { Com_Printf("Could not spawn the server/n"); return; } assert(levelstring[0] != '/0'); Com_DPrintf(DEBUG_SERVER, "SpawnServer: %s/n", levelstring); /* save name for levels that don't set message */ SV_SetConfigString(CS_NAME, levelstring); SV_SetConfigString(CS_LIGHTMAP, day); Q_strncpyz(sv->name, levelstring, sizeof(sv->name)); /* set serverinfo variable */ sv_mapname = Cvar_FullSet("sv_mapname", sv->name, CVAR_SERVERINFO | CVAR_NOSET); /* notify the client in case of a listening server */ SCR_BeginLoadingPlaque(); if (assembly) Q_strncpyz(sv->assembly, assembly, sizeof(sv->assembly)); else sv->assembly[0] = '/0'; /* leave slots at start for clients only */ cl = NULL; while ((cl = SV_GetNextClient(cl)) != NULL) { /* needs to reconnect */ if (cl->state >= cs_spawning) SV_SetClientState(cl, cs_connected); } /* assemble and load the map */ if (levelstring[0] == '+') { randomMap = SV_AssembleMap(levelstring + 1, assembly, map, pos, 0); if (!randomMap) { Com_Printf("Could not load assembly for map '%s'/n", levelstring); return; } } else { SV_SetConfigString(CS_TILES, levelstring); SV_SetConfigString(CS_POSITIONS, assembly ? assembly : ""); } CM_LoadMap(map, day, pos, &sv->mapData, &sv->mapTiles); Com_Printf("checksum for the map '%s': %u/n", levelstring, sv->mapData.mapChecksum); SV_SetConfigString(CS_MAPCHECKSUM, sv->mapData.mapChecksum); checksum = Com_GetScriptChecksum(); Com_Printf("ufo script checksum %u/n", checksum); SV_SetConfigString(CS_UFOCHECKSUM, checksum); SV_SetConfigString(CS_OBJECTAMOUNT, csi.numODs); SV_SetConfigString(CS_VERSION, UFO_VERSION); SV_SetConfigString(CS_MAPTITLE, SV_GetMapTitle(randomMap, levelstring)); if (Q_strstart(SV_GetConfigString(CS_MAPTITLE), "b/")) { /* For base attack, CS_MAPTITLE contains too many chars */ SV_SetConfigString(CS_MAPTITLE, "Base attack"); SV_SetConfigString(CS_NAME, ".baseattack"); } /* clear random-map assembly data */ Mem_Free(randomMap); randomMap = NULL; /* clear physics interaction links */ SV_ClearWorld(); /* fix this! */ for (i = 1; i <= sv->mapData.numInline; i++) sv->models[i] = CM_InlineModel(&sv->mapTiles, va("*%i", i)); /* precache and static commands can be issued during map initialization */ Com_SetServerState(ss_loading);//.........这里部分代码省略.........
开发者ID:kevlund,项目名称:ufoai,代码行数:101,
示例26: CL_CgameSystemCalls//.........这里部分代码省略......... case CG_ADDCOMMAND: CL_AddCgameCommand( VMA( 1 ) ); return 0; case CG_REMOVECOMMAND: Cmd_RemoveCommand( VMA( 1 ) ); return 0; case CG_COMPLETE_CALLBACK: if ( completer ) { completer( VMA( 1 ) ); } return 0; case CG_SENDCLIENTCOMMAND: CL_AddReliableCommand( VMA( 1 ) ); return 0; case CG_UPDATESCREEN: SCR_UpdateScreen(); return 0; case CG_CM_LOADMAP: CL_CM_LoadMap( VMA( 1 ) ); return 0; case CG_CM_NUMINLINEMODELS: return CM_NumInlineModels(); case CG_CM_INLINEMODEL: return CM_InlineModel( args[ 1 ] ); case CG_CM_TEMPBOXMODEL: return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qfalse ); case CG_CM_TEMPCAPSULEMODEL: return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qtrue ); case CG_CM_POINTCONTENTS: return CM_PointContents( VMA( 1 ), args[ 2 ] ); case CG_CM_TRANSFORMEDPOINTCONTENTS: return CM_TransformedPointContents( VMA( 1 ), args[ 2 ], VMA( 3 ), VMA( 4 ) ); case CG_CM_BOXTRACE: CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], TT_AABB ); return 0; case CG_CM_TRANSFORMEDBOXTRACE: CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], VMA( 8 ), VMA( 9 ), TT_AABB ); return 0; case CG_CM_CAPSULETRACE: CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], TT_CAPSULE ); return 0; case CG_CM_TRANSFORMEDCAPSULETRACE: CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], VMA( 8 ), VMA( 9 ), TT_CAPSULE ); return 0; case CG_CM_BISPHERETRACE: CM_BiSphereTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMF( 4 ), VMF( 5 ), args[ 6 ], args[ 7 ] ); return 0;
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:67,
示例27: CL_ParseConfigString/*================CL_ParseConfigString================*/void CL_ParseConfigString (void){ size_t length; int i; char *s; char olds[MAX_QPATH]; i = MSG_ReadShort (&net_message); if (i < 0 || i >= MAX_CONFIGSTRINGS) Com_Error (ERR_DROP, "CL_ParseConfigString: configstring %d >= MAX_CONFIGSTRINGS", i); s = MSG_ReadString(&net_message); Q_strncpy (olds, cl.configstrings[i], sizeof(olds)-1); //Com_Printf ("cs: %i=%s/n", LOG_GENERAL, i, MakePrintable (s)); //r1ch: only allow statusbar to overflow /*if (i >= CS_STATUSBAR && i < CS_AIRACCEL) strncpy (cl.configstrings[i], s, (sizeof(cl.configstrings[i]) * (CS_AIRACCEL - i))-1); else Q_strncpy (cl.configstrings[i], s, sizeof(cl.configstrings[i])-1);*/ //r1: overflow may be desired by some mods in stats programs for example. who knows. length = strlen(s); if (length >= (sizeof(cl.configstrings[0]) * (MAX_CONFIGSTRINGS-i)) - 1) Com_Error (ERR_DROP, "CL_ParseConfigString: configstring %d exceeds available space", i); //r1: don't allow basic things to overflow if (i != CS_NAME && i < CS_GENERAL) { if (i >= CS_STATUSBAR && i < CS_AIRACCEL) { strncpy (cl.configstrings[i], s, (sizeof(cl.configstrings[i]) * (CS_AIRACCEL - i))-1); } else { if (length >= MAX_QPATH) Com_Printf ("WARNING: Configstring %d of length %d exceeds MAX_QPATH./n", LOG_CLIENT|LOG_WARNING, i, (int)length); Q_strncpy (cl.configstrings[i], s, sizeof(cl.configstrings[i])-1); } } else { strcpy (cl.configstrings[i], s); } // do something apropriate if (i == CS_AIRACCEL) { pm_airaccelerate = (qboolean)atoi(cl.configstrings[CS_AIRACCEL]); } else if (i >= CS_LIGHTS && i < CS_LIGHTS+MAX_LIGHTSTYLES) { CL_SetLightstyle (i - CS_LIGHTS); }#ifdef CD_AUDIO else if (i == CS_CDTRACK) { if (cl.refresh_prepped) CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true); }#endif else if (i >= CS_MODELS && i < CS_MODELS+MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i-CS_MODELS] = re.RegisterModel (cl.configstrings[i]); if (cl.configstrings[i][0] == '*') cl.model_clip[i-CS_MODELS] = CM_InlineModel (cl.configstrings[i]); else cl.model_clip[i-CS_MODELS] = NULL; } //r1: load map whilst connecting to save a bit of time /*if (i == CS_MODELS + 1) { CM_LoadMap (cl.configstrings[CS_MODELS+1], true, &i); if (i && i != atoi(cl.configstrings[CS_MAPCHECKSUM])) Com_Error (ERR_DROP, "Local map version differs from server: 0x%.8x != 0x%.8x/n", i, atoi(cl.configstrings[CS_MAPCHECKSUM])); }*/ } else if (i >= CS_SOUNDS && i < CS_SOUNDS+MAX_MODELS) { if (cl.refresh_prepped) cl.sound_precache[i-CS_SOUNDS] = S_RegisterSound (cl.configstrings[i]); } else if (i >= CS_IMAGES && i < CS_IMAGES+MAX_MODELS) { if (cl.refresh_prepped) re.RegisterPic (cl.configstrings[i]); } else if (i == CS_MAXCLIENTS) {//.........这里部分代码省略.........
开发者ID:Slipyx,项目名称:r1q2,代码行数:101,
示例28: SV_LinkEdictvoid SV_LinkEdict(edict_t *ent){ guard(SV_LinkEdict); int i, j, k; //!! HOOK - move outside ? if (bspfile.type != map_q2) { if (ent->s.modelindex >= 0 && ent->s.modelindex < MAX_MODELS) { // link model hook const char *modelName = sv.configstrings[CS_MODELS + ent->s.modelindex]; if (!strcmp(modelName, "models/objects/dmspot/tris.md2")) { // teleporter (source+target) was found// appPrintf(S_CYAN"teleport: %g %g %g/n", VECTOR_ARG(ent->s.origin)); return; // simply do not link model; trigger entity will be added anyway } } } if (ent->area.prev) SV_UnlinkEdict(ent); // unlink from old position (i.e. relink edict) if (ent == ge->edicts) return; // don't add the world if (!ent->inuse) return; entityHull_t &ex = ents[NUM_FOR_EDICT(ent)]; memset(&ex, 0, sizeof(entityHull_t)); ex.owner = ent; ex.axis.FromEuler(ent->s.angles); // set the size VectorSubtract(ent->bounds.maxs, ent->bounds.mins, ent->size); // encode the size into the entity_state for client prediction if (ent->solid == SOLID_BBOX) { // assume that x/y are equal and symetric i = appRound(ent->bounds.maxs[0] / 8); // z is not symetric j = appRound(-ent->bounds.mins[2] / 8); // and z maxs can be negative... k = appRound((ent->bounds.maxs[2] + 32) / 8); // original Q2 have bounded i/j/k/ with lower margin==1 (for client prediction only); this will // produce incorrect collision test when bbox mins/maxs is (0,0,0) i = bound(i, 0, 31); // mins/maxs[0,1] range is -248..0/0..248 j = bound(j, 0, 31); // mins[2] range is [-248..0] k = bound(k, 0, 63); // maxs[2] range is [-32..472] // if SVF_DEADMONSTER, s.solid should be 0 ent->s.solid = (ent->svflags & SVF_DEADMONSTER) ? 0 : (k<<10) | (j<<5) | i; i *= 8; j *= 8; k *= 8; ex.bounds.mins.Set(-i, -i, -j); ex.bounds.maxs.Set(i, i, k - 32); ex.bounds.GetCenter(ex.center); ex.center.Add(ent->s.origin); ex.model = NULL; ex.radius = VectorDistance(ex.bounds.maxs, ex.bounds.mins) / 2; } else if (ent->solid == SOLID_BSP) { ex.model = sv.models[ent->s.modelindex]; if (!ex.model) Com_DropError("MOVETYPE_PUSH with a non bsp model"); CVec3 v; ex.model->bounds.GetCenter(v); UnTransformPoint(ent->s.origin, ex.axis, v, ex.center); ex.radius = ex.model->radius; ent->s.solid = 31; // a SOLID_BBOX will never create this value (mins=(-248,-248,0) maxs=(248,248,-32)) } else if (ent->solid == SOLID_TRIGGER) { ent->s.solid = 0; // check for model link ex.model = sv.models[ent->s.modelindex]; if (!ex.model) { // model not attached by game, check entstring //?? can optimize: add 'bool spawningEnts', set to 'true' before SpawnEntities() //?? and 'false' after; skip code below when 'false' for (triggerModelLink_t *link = bspfile.modelLinks; link; link = link->next)#define CMP(n) (fabs(ent->s.origin[n] - link->origin[n]) < 0.5f) if (CMP(0) && CMP(1) && CMP(2)) { CBspModel *model = CM_InlineModel(link->modelIdx); VectorSubtract(model->bounds.maxs, ent->s.origin, ent->bounds.maxs); VectorSubtract(model->bounds.mins, ent->s.origin, ent->bounds.mins); break; }#undef CMP } }//.........这里部分代码省略.........
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:101,
注:本文中的CM_InlineModel函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CM_LoadMap函数代码示例 C++ CM_CBK_DEBUG_PRINT函数代码示例 |