static OSErr send_frame_to_local_hub(DDPFramePtr frame, NetAddrBlock *address, short protocolType, short port) { sLocalOutgoingBuffer.datagramSize = frame->data_size; memcpy(sLocalOutgoingBuffer.datagramData, frame->data, frame->data_size); sLocalOutgoingBuffer.protocolType = protocolType; // An all-0 sourceAddress is the cue for "local spoke" currently. obj_clear(sLocalOutgoingBuffer.sourceAddress); sNeedToSendLocalOutgoingBuffer = true; return noErr; }
void set_recording_header_data( short number_of_players, short level_number, uint32 map_checksum, short version, struct player_start_data *starts, struct game_data *game_information) { assert(!replay.valid); obj_clear(replay.header); replay.header.num_players= number_of_players; replay.header.level_number= level_number; replay.header.map_checksum= map_checksum; replay.header.version= version; objlist_copy(replay.header.starts, starts, MAXIMUM_NUMBER_OF_PLAYERS); obj_copy(replay.header.game_information, *game_information); // Use the packed size here!!! replay.header.length= SIZEOF_recording_header; }
/* ---------- code */ void initialize_keyboard_controller( void) { ActionQueue *queue; short player_index; // vassert(NUMBER_OF_KEYS == NUMBER_OF_STANDARD_KEY_DEFINITIONS, // csprintf(temporary, "NUMBER_OF_KEYS == %d, NUMBER_OF_KEY_DEFS = %d. Not Equal!", NUMBER_OF_KEYS, NUMBER_OF_STANDARD_KEY_DEFINITIONS)); assert(NUMBER_OF_STANDARD_KEY_DEFINITIONS==NUMBER_OF_LEFT_HANDED_KEY_DEFINITIONS); assert(NUMBER_OF_LEFT_HANDED_KEY_DEFINITIONS==NUMBER_OF_POWERBOOK_KEY_DEFINITIONS); // get globals initialized heartbeat_count= 0; input_task_active= false; obj_clear(replay); input_task= install_timer_task(TICKS_PER_SECOND, input_controller); assert(input_task); atexit(remove_input_controller); set_keys_to_match_preferences(); /* Allocate the recording queues */ replay.recording_queues = new ActionQueue[MAXIMUM_NUMBER_OF_PLAYERS]; assert(replay.recording_queues); if(!replay.recording_queues) alert_user(fatalError, strERRORS, outOfMemory, memory_error()); /* Allocate the individual ones */ for (player_index= 0; player_index<MAXIMUM_NUMBER_OF_PLAYERS; player_index++) { queue= get_player_recording_queue(player_index); queue->read_index= queue->write_index = 0; queue->buffer= new uint32[MAXIMUM_QUEUE_SIZE]; if(!queue->buffer) alert_user(fatalError, strERRORS, outOfMemory, memory_error()); } enter_mouse(0); }
void Model3D_Transform::Identity() { obj_clear(*this); M[0][0] = M[1][1] = M[2][2] = 1; }
/* --------- Local Code --------- */ // static OSErr enumerate_files( // struct find_file_pb *param_block, // long directory_id) /* Because it is recursive.. */ bool FileFinder::Enumerate(DirectorySpecifier& Dir) { // Set up the temporary file TempFile.FromDirectory(Dir); // Kludge to make the FSSpec always available FSSpec& temp_file = TempFile.GetSpec(); // Local variable short index; obj_clear(pb); pb.hFileInfo.ioVRefNum= Dir.Get_vRefNum(); pb.hFileInfo.ioNamePtr= temp_file.name; // ZZZ addition bool KeepGoing = true; for(Err= noErr, index=1; count<max && Err==noErr && KeepGoing; index++) { pb.hFileInfo.ioDirID= Dir.Get_parID(); pb.hFileInfo.ioFDirIndex= index; Err= PBGetCatInfo( &pb, false); if(Err == noErr) { if ((pb.hFileInfo.ioFlAttrib & 16) && (flags & _ff_recurse)) { /* Recurse, if you really want to... */ // ZZZ addition: callback on directory change if desired if(directory_change_callback != NULL) KeepGoing = directory_change_callback(TempFile, true, (flags & _ff_callback_with_catinfo) ? &pb : user_data); if(KeepGoing) { // Set up volume info DirectorySpecifier SubDir = Dir; // Change the directory SubDir.Set_parID(pb.dirInfo.ioDrDirID); // Go! Enumerate(SubDir); // Reset the temporary file's directory to what's appropriate here // (it's global to this object) TempFile.FromDirectory(Dir); // ZZZ addition: callback on directory change if desired if(directory_change_callback != NULL) KeepGoing = directory_change_callback(TempFile, false, (flags & _ff_callback_with_catinfo) ? &pb : user_data); } } else { /* Add.. */ if(Type==WILDCARD_TYPE || Type == TempFile.GetType()) { /* Only add if there isn't a callback or it returns true */ switch(search_type) { case _fill_buffer: if(!callback || callback(TempFile, user_data)) { /* Copy it in.. */ buffer[count++] = TempFile; } break; case _callback_only: assert(callback); KeepGoing = callback(TempFile, (flags & _ff_callback_with_catinfo) ? &pb : user_data); break; default: assert(false); break; } } } } else { /* We ran out of files.. */ } } /* If we got a fnfErr, it was because we indexed too far. */ if (Err == fnfErr) Err = noErr; return (Err == noErr); }
void FileFinder::Clear() { obj_clear(*this); }
TQ3Status TriangulatorGeometry_Triangle(TQ3ViewObject View, void *PrivateData, TQ3GeometryObject Triangle, const TQ3TriangleData *TriangleData) { // Just in case... if (!TriangleData) return kQ3Success; // Get the overall normal and color (DiffuseColor) TQ3Boolean OverallColorPresent = Q3AttributeSet_Contains(TriangleData->triangleAttributeSet,kQ3AttributeTypeDiffuseColor); TQ3ColorRGB OverallColor; if (OverallColorPresent); Q3AttributeSet_Get(TriangleData->triangleAttributeSet,kQ3AttributeTypeDiffuseColor,&OverallColor); // Load the triangle's contents into a vertex object for (int k=0; k<3; k++) { FullVertexData FullVertex; obj_clear(FullVertex); const TQ3Vertex3D& Vertex = TriangleData->vertices[k]; GLfloat *FV_Pos = FullVertex.Data + FullVertexData::POS_BASE; FV_Pos[0] = Vertex.point.x; FV_Pos[1] = Vertex.point.y; FV_Pos[2] = Vertex.point.z; TQ3Param2D TxtrCoord; TQ3Boolean TxtrCoord_Present = Q3AttributeSet_Contains(Vertex.attributeSet,kQ3AttributeTypeShadingUV); if (TxtrCoord_Present) Q3AttributeSet_Get(Vertex.attributeSet,kQ3AttributeTypeShadingUV,&TxtrCoord); else { TxtrCoord_Present = Q3AttributeSet_Contains(Vertex.attributeSet,kQ3AttributeTypeSurfaceUV); if (TxtrCoord_Present) Q3AttributeSet_Get(Vertex.attributeSet,kQ3AttributeTypeSurfaceUV,&TxtrCoord); else TxtrCoordsPresent = false; } if (TxtrCoordsPresent) { GLfloat *FV_TC = FullVertex.Data + FullVertexData::TC_BASE; FV_TC[0] = TxtrCoord.u; FV_TC[1] = TxtrCoord.v; } TQ3Vector3D Normal; TQ3Boolean Normal_Present = Q3AttributeSet_Contains(Vertex.attributeSet,kQ3AttributeTypeNormal); if (Normal_Present) Q3AttributeSet_Get(Vertex.attributeSet,kQ3AttributeTypeNormal,&Normal); else NormalsPresent = false; if (NormalsPresent) { GLfloat *FV_Norm = FullVertex.Data + FullVertexData::NORM_BASE; FV_Norm[0] = Normal.x; FV_Norm[1] = Normal.y; FV_Norm[2] = Normal.z; } TQ3ColorRGB Color; TQ3Boolean Color_Present = Q3AttributeSet_Contains(Vertex.attributeSet,kQ3AttributeTypeDiffuseColor); if (Color_Present) Q3AttributeSet_Get(Vertex.attributeSet,kQ3AttributeTypeDiffuseColor,&Color); else if (OverallColorPresent) Color = OverallColor; else ColorsPresent = false; if (ColorsPresent) { GLfloat *FV_Color = FullVertex.Data + FullVertexData::COLOR_BASE; FV_Color[0] = Color.r; FV_Color[1] = Color.g; FV_Color[2] = Color.b; } FullVertexList.push_back(FullVertex); } return kQ3Success; }