コード例 #1
0
ファイル: e_shader.cpp プロジェクト: OpenParsec/openparsec
// update instance data of face anims -----------------------------------------
//
PRIVATE
void UpdateFaceAnimInstances( GenObject *gobj )
{
	ASSERT( gobj != NULL );

	if ( gobj->FaceAnimStates == NULL )
		return;

	// determine corresponding list
	GenObject *objlist = NULL;
	switch ( gobj->ObjectType & TYPELISTMASK ) {

		case PSHIP_LIST_NO:
			objlist = FetchFirstShip();
			break;
		case LASER_LIST_NO:
			objlist = FetchFirstLaser();
			break;
		case MISSL_LIST_NO:
			objlist = FetchFirstMissile();
			break;
		case EXTRA_LIST_NO:
			objlist = FetchFirstExtra();
			break;
		case CUSTM_LIST_NO:
			objlist = FetchFirstCustom();
			break;
	}

	// scan entire list
	for ( ; objlist != NULL; objlist = objlist->NextObj ) {

		if ( objlist->ObjectClass == gobj->ObjectClass ) {

			// copy instance data
			objlist->ActiveFaceAnims = gobj->ActiveFaceAnims;
			ASSERT( objlist->FaceAnimStates != NULL );
			memcpy( objlist->FaceAnimStates, gobj->FaceAnimStates,
				sizeof( FaceAnimState ) * gobj->ActiveFaceAnims );
		}
	}

	// check for local ship update
	if ( MyShip->ObjectClass == gobj->ObjectClass ) {

		// copy instance data
		MyShip->ActiveFaceAnims = gobj->ActiveFaceAnims;
		ASSERT( MyShip->FaceAnimStates != NULL );
		memcpy( MyShip->FaceAnimStates, gobj->FaceAnimStates,
			sizeof( FaceAnimState ) * gobj->ActiveFaceAnims );
	}
}
コード例 #2
0
ファイル: h_radar.cpp プロジェクト: ppiecuch/openparsec
// scan missile objects for radar ---------------------------------------------
//
INLINE
void RadarScanMissileObjects()
{
	GenObject *walkobjs = FetchFirstMissile();
	for ( ; walkobjs; walkobjs = walkobjs->NextObj ) {

		// set color for missile objects
		int rocolor = MISSILE_RADAR_OBJ_COL;

		// depict missile's position on radar
		if ( AUX_ENABLE_ELITE_RADAR ) {
			CalcDrawEliteRadarObj( walkobjs, rocolor );
		} else {
			CalcDrawRadarObj( walkobjs, rocolor );
		}
	}
}
コード例 #3
0
ファイル: e_level.cpp プロジェクト: ppiecuch/openparsec
// save a level to a console script -------------------------------------------
//
int LVL_SaveLevel( const char* levelname )
{
	ASSERT( levelname != NULL );
	
	int savecount = 0;
	
	// write console script containing summon commands for all teleporters found
	FILE *fp = fopen( levelname, "w" );
	if ( fp != NULL ) {
		
		fprintf( fp, "; parsec level script -----------------------------------\n" );
		fprintf( fp, "; automatically generated on %s;\n", SYS_SystemTime() );
		
		for( int objclassnameindex = 0; level_objclasses[ objclassnameindex ].classname != NULL; objclassnameindex++ ) {
			
			// determine, whether we want to save this object class
			if ( level_objclasses[ objclassnameindex ].flags & LEVEL_OBJCLASS_SAVE ) {

				dword objclassid = OBJ_FetchObjectClassId( level_objclasses[ objclassnameindex ].classname );
				if ( ( objclassid != CLASS_ID_INVALID ) && ( objclassid < (dword)NumObjClasses ) ) {
					savecount =  LVL_SaveObjectsFromList( fp, FetchFirstShip(),		objclassid );
					savecount += LVL_SaveObjectsFromList( fp, FetchFirstLaser(),	objclassid );
					savecount += LVL_SaveObjectsFromList( fp, FetchFirstMissile(),	objclassid );
					savecount += LVL_SaveObjectsFromList( fp, FetchFirstExtra(),	objclassid );
					savecount += LVL_SaveObjectsFromList( fp, FetchFirstCustom(),	objclassid );
				}
			}
		}
		
		fclose( fp );
		
		CON_AddLine( "levelfile sucessfully written" );
	} else {
		CON_AddLine( "could not open levelfile for writing" );
	}

	return savecount; 
}
コード例 #4
0
ファイル: con_com.cpp プロジェクト: ppiecuch/openparsec
// print object counts for all object lists (command "objectcount") -----------
//
PRIVATE
void Cmd_OBJECTCOUNT()
{
	GenObject *walklist;
	int 	  listlength;

	listlength = 0;
	for ( walklist = FetchFirstShip(); walklist; walklist = walklist->NextObj )
		listlength++;
	sprintf( paste_str, "ships   :%3d", listlength );
	CON_AddLine( paste_str );

	listlength = 0;
	for ( walklist = FetchFirstLaser(); walklist; walklist = walklist->NextObj )
		listlength++;
	sprintf( paste_str, "lasers  :%3d", listlength );
	CON_AddLine( paste_str );

	listlength = 0;
	for ( walklist = FetchFirstMissile(); walklist; walklist = walklist->NextObj )
		listlength++;
	sprintf( paste_str, "missiles:%3d", listlength );
	CON_AddLine( paste_str );

	listlength = 0;
	for ( walklist = FetchFirstExtra(); walklist; walklist = walklist->NextObj )
		listlength++;
	sprintf( paste_str, "extras  :%3d (obj, counted %d) and %d particle",
		listlength, CurrentNumExtras, CurrentNumPrtExtras );
	CON_AddLine( paste_str );

	listlength = 0;
	for ( walklist = FetchFirstCustom(); walklist; walklist = walklist->NextObj )
		listlength++;
	sprintf( paste_str, "customs :%3d", listlength );
	CON_AddLine( paste_str );
}