mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Convert bm_SaveFileBitmap() and SaveVClip() to std::fs::path
This commit is contained in:
parent
5222bb28f3
commit
41ec941b50
@ -154,8 +154,11 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
|
||||
#include "pstypes.h"
|
||||
#include "pserror.h"
|
||||
#include "bitmap.h"
|
||||
@ -164,9 +167,6 @@
|
||||
#include "mono.h"
|
||||
#include "ddio.h"
|
||||
#include "gametexture.h"
|
||||
#include "texture.h"
|
||||
#include <string.h>
|
||||
#include "ctype.h"
|
||||
#include "mem.h"
|
||||
#include "game.h"
|
||||
|
||||
@ -239,18 +239,18 @@ void FreeVClip(int num) {
|
||||
// Saves a given video clip to a file
|
||||
// Returns 1 if everything ok, 0 otherwise
|
||||
// "num" is index into GameVClip array
|
||||
int SaveVClip(const char *filename, int num) {
|
||||
int SaveVClip(const std::filesystem::path& filename, int num) {
|
||||
CFILE *outfile;
|
||||
vclip *vc = &GameVClips[num];
|
||||
|
||||
ASSERT(vc->used);
|
||||
ASSERT(filename != NULL);
|
||||
ASSERT(!filename.empty());
|
||||
|
||||
PageInVClip(num);
|
||||
|
||||
outfile = (CFILE *)cfopen(filename, "wb");
|
||||
if (!outfile) {
|
||||
mprintf(0, "Couldn't save vclip %s!\n", filename);
|
||||
mprintf(0, "Couldn't save vclip %s!\n", filename.u8string().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ int SaveVClip(const char *filename, int num) {
|
||||
// Now save each frame of this vclip
|
||||
for (int i = 0; i < vc->num_frames; i++) {
|
||||
if (bm_SaveBitmap(outfile, vc->frames[i]) != 1) {
|
||||
mprintf(0, "Couldn't save frame %d of vclip %s!\n", i, filename);
|
||||
mprintf(0, "Couldn't save frame %d of vclip %s!\n", i, filename.u8string().c_str());
|
||||
Int3();
|
||||
cfclose(outfile);
|
||||
return 0;
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
#define VCLIP_H
|
||||
|
||||
#include "pstypes.h"
|
||||
#include <filesystem>
|
||||
|
||||
#include "fix.h"
|
||||
#include "manage.h"
|
||||
|
||||
@ -56,7 +57,7 @@ void FreeVClip(int num);
|
||||
// Saves a given video clip to a file
|
||||
// Returns 1 if everything ok, 0 otherwise
|
||||
// "num" is index into GameVClip array
|
||||
int SaveVClip(const char *filename, int num);
|
||||
int SaveVClip(const std::filesystem::path& filename, int num);
|
||||
|
||||
// Allocs and loads a vclip from the file named "filename"
|
||||
// Returns -1 on error, index into GameVClip array on success
|
||||
|
@ -297,9 +297,13 @@
|
||||
*
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <filesystem>
|
||||
|
||||
#include "cfile.h"
|
||||
#include "texture.h"
|
||||
#include "bitmap.h"
|
||||
@ -313,10 +317,6 @@
|
||||
#include "mem.h"
|
||||
#include "psrand.h"
|
||||
|
||||
#include "Macros.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define BM_FILETYPE_TGA 1
|
||||
#define BM_FILETYPE_PCX 2
|
||||
#define BM_FILETYPE_IFF 3
|
||||
@ -1080,7 +1080,7 @@ int bm_MakeBitmapResident(int handle) {
|
||||
}
|
||||
// Saves a bitmap to a file. Saves the bitmap as an OUTRAGE_COMPRESSED_OGF.
|
||||
// Returns -1 if something is wrong.
|
||||
int bm_SaveFileBitmap(const char *filename, int handle) {
|
||||
int bm_SaveFileBitmap(const std::filesystem::path& filename, int handle) {
|
||||
int ret;
|
||||
CFILE *fp;
|
||||
if (!GameBitmaps[handle].used) {
|
||||
|
@ -19,7 +19,8 @@
|
||||
#ifndef PSBITMAP_H
|
||||
#define PSBITMAP_H
|
||||
|
||||
#include "pstypes.h"
|
||||
#include <filesystem>
|
||||
|
||||
#include "cfile.h"
|
||||
|
||||
#ifdef __LINUX__
|
||||
@ -107,7 +108,7 @@ int bm_FindBitmapName(const char *name);
|
||||
int bm_SaveBitmap(CFILE *fp, int handle);
|
||||
// Saves a bitmap to a file. Saves the bitmap as an OUTRAGE_TGA_TYPE.
|
||||
// Returns -1 if something is wrong.
|
||||
int bm_SaveFileBitmap(const char *filename, int handle);
|
||||
int bm_SaveFileBitmap(const std::filesystem::path& filename, int handle);
|
||||
// given a handle to a bitmap, returns its width, or -1 if handle is invalid
|
||||
int bm_w(int handle, int miplevel);
|
||||
// given a handle to a bitmap, returns its height, or -1 if handle is invalid
|
||||
|
Loading…
Reference in New Issue
Block a user