void weapon_molotov_kill(){ kill_all_molotovs(); if( molotovActor ){ geActor_DefDestroy( &molotovActor ); molotovActor = 0; } }
void weapon_mini_rocket_kill(){ kill_all_miniRockets(); if( mini_rocketActor ){ geActor_DefDestroy( &mini_rocketActor ); mini_rocketActor = 0; } }
ReturnCode FmtActor_DoMake(FmtActor_Options* options, MkUtil_Printf Printf) { ReturnCode retValue = RETURN_SUCCESS; geVFile *sf; geVFile *df; geBoolean ok; geActor_Def* A = NULL; // Actor files must be specified if(options->SourceActorFile[0] == 0) { Printf("ERROR: Must specify a source actor file\n"); MkUtil_AdjustReturnCode(&retValue, RETURN_ERROR); return retValue; } if(options->DestinationActorFile[0] == 0) { Printf("ERROR: Must specify a destination actor file\n"); MkUtil_AdjustReturnCode(&retValue, RETURN_ERROR); return retValue; } if(options->OptimizationLevel<0) { options->OptimizationLevel = 0; } sf = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,options->SourceActorFile,NULL,GE_VFILE_OPEN_READONLY); if (sf==NULL) { Printf("ERROR: Could not open source actor file (%s).\n", options->SourceActorFile); MkUtil_AdjustReturnCode(&retValue, RETURN_ERROR); return retValue; } if (options->TextOutput) { df = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,options->DestinationActorFile,NULL,GE_VFILE_OPEN_CREATE); // df = fopen(options->DestinationActorFile,"w"); } else { df = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,options->DestinationActorFile,NULL,GE_VFILE_OPEN_CREATE); // df = fopen(options->DestinationActorFile,"wb"); } if (df==NULL) { Printf("ERROR: Could not open destination actor file (%s).\n", options->SourceActorFile); MkUtil_AdjustReturnCode(&retValue, RETURN_ERROR); geVFile_Close(sf); unlink(options->DestinationActorFile); return retValue; } A = geActor_DefCreateFromFile(sf); geVFile_Close(sf); if (A==NULL) { Printf("ERROR: Failed to create actor from source actor file (%s).\n", options->SourceActorFile); MkUtil_AdjustReturnCode(&retValue, RETURN_ERROR); geVFile_Close(df); unlink(options->DestinationActorFile); return retValue; } switch (options->OptimizationLevel) { case (0): break; default: break; } if (options->TextOutput) { ok = geActor_DefWriteToFile(A,df); } else { ok = geActor_DefWriteToBinaryFile(A,df); } if (ok == GE_TRUE) { ok = geVFile_Close(df); } if (options->SummaryFile[0]!=0) { FmtActor_Summary(A,options->SummaryFile,Printf); } geActor_DefDestroy(&A); if (ok == GE_FALSE) { Printf("ERROR: Failed to write destination actor file (%s).\n", options->DestinationActorFile); MkUtil_AdjustReturnCode(&retValue, RETURN_ERROR); unlink(options->DestinationActorFile); return retValue; } return retValue; }
ReturnCode MkActor_DoMake(MkActor_Options* options,MkUtil_Printf Printf) { ReturnCode retValue = RETURN_SUCCESS; geVFile *VF; //geActor* pActor = NULL; geActor_Def* pActorDef = NULL; // Actor file must be specified if(options->ActorFile[0] == 0) { Printf("ERROR: Must specify an actor file\n"); BAILOUT; } // Create the Actor from file or from scratch if(options->ConcatenateActor != MK_FALSE) { VF = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,options->ActorFile,NULL,GE_VFILE_OPEN_READONLY); if(VF == NULL) { Printf("ERROR: Could not open '%s' to concatenate\n", options->ActorFile); BAILOUT; } pActorDef = geActor_DefCreateFromFile(VF); geVFile_Close(VF); if(pActorDef == NULL) { Printf("ERROR: Could not create actor from file '%s'\n", options->ActorFile); BAILOUT; } } if(pActorDef == NULL) { pActorDef = geActor_DefCreate(); } if(pActorDef == NULL) { Printf("ERROR: Could not create Actor\n"); BAILOUT; } // Read the body file if(options->BodyFile[0] != 0) { geBody* pBody = NULL; VF = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,options->BodyFile,NULL,GE_VFILE_OPEN_READONLY); if(VF == NULL) { Printf("ERROR: Could not open '%s' body file\n", options->BodyFile); BAILOUT; } else { pBody = geBody_CreateFromFile(VF); geVFile_Close(VF); if(pBody == NULL) { Printf("ERROR: Could not create body from file '%s'\n", options->BodyFile); BAILOUT; } } if(geActor_GetBody(pActorDef) != NULL) { Printf("ERROR: An existing body is being replaced\n"); BAILOUT; } geActor_SetBody(pActorDef, pBody); } // Read the motions if(geStrBlock_GetCount(options->pMotionFileBlock) > 0) { int i, Count, Index; const char* filename; geMotion* pMotion; Count = geStrBlock_GetCount(options->pMotionFileBlock); for(i=0;i<Count;i++) { if (MkUtil_Interrupt()) { Printf("Interrupted\n"); BAILOUT; } filename = geStrBlock_GetString(options->pMotionFileBlock, i); VF = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,filename,NULL,GE_VFILE_OPEN_READONLY); if(VF == NULL) { Printf("ERROR: Could not open '%s' motion file\n", filename); BAILOUT; } else { pMotion = geMotion_CreateFromFile(VF); geVFile_Close(VF); if(pMotion == NULL) { Printf("ERROR: Could not create motion from file '%s'\n", filename); BAILOUT; } else { if(geActor_AddMotion(pActorDef, pMotion, &Index) == MK_FALSE) { Printf("ERROR: Motion file '%s' was not added\n", filename); geMotion_Destroy(&pMotion); BAILOUT; } } } } } // Rename any existing actor file { char bakname[_MAX_PATH]; strcpy(bakname, options->ActorFile); strcat(bakname, ".bak"); remove(bakname); rename(options->ActorFile, bakname); } // Write the actor VF = geVFile_OpenNewSystem(NULL,GE_VFILE_TYPE_DOS,options->ActorFile,NULL,GE_VFILE_OPEN_CREATE); if(VF == NULL) { Printf("ERROR: Could not create '%s' actor file\n", options->ActorFile); unlink(options->ActorFile); BAILOUT; } else { if(geActor_DefWriteToFile(pActorDef, VF) == GE_FALSE) { Printf("ERROR: Actor file '%s' was not written correctly\n", options->ActorFile); unlink(options->ActorFile); BAILOUT; } else { if (geVFile_Close(VF) == GE_FALSE) { Printf("ERROR: Actor file '%s' was not written correctly\n", options->ActorFile); unlink(options->ActorFile); BAILOUT; } else { Printf("SUCCESS: Actor file '%s' written successfully\n", options->ActorFile); } } } geActor_DefDestroy(&pActorDef); // cleans up all motions and body return retValue; }