move skybox

This commit is contained in:
Nishi 2026-01-12 09:10:17 +09:00
commit 6e7ba8658b
Signed by: nishi
GPG key ID: 27EF69B208EB9343
16 changed files with 22 additions and 110 deletions

View file

@ -1,6 +0,0 @@
<?xml version="1.0"?>
<manifest>
<sfx base="sfx">
<sfx name="bang">bang.ogg</sfx>
</sfx>
</manifest>

View file

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<manifest>
<skybox base="skybox">
<left>left.png</left>
<right>right.png</right>
<front>front.png</front>
<back>back.png</back>
<up>up.png</up>
<down>down.png</down>
</skybox>
</manifest>

View file

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 231 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 249 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Before After
Before After

View file

@ -15,6 +15,5 @@
#include <GearSrc/Resource.h>
#include <GearSrc/Endian.h>
#include <GearSrc/SkyBox.h>
#include <GearSrc/XML.h>
#endif

View file

@ -9,6 +9,7 @@ extern "C" {
#endif
GSDECL GSSkyBox GSSkyBoxOpen(GSClient client, const char* base);
GSDECL GSSkyBox GSSkyBoxTry(GSClient client, const char* name);
GSDECL void GSSkyBoxDraw(GSSkyBox skybox);
GSDECL void GSSkyBoxClose(GSSkyBox skybox);

View file

@ -74,7 +74,6 @@ typedef void (*GSSleepCallback)(int ms);
struct _GSResourceKV {
char* key;
GSResource value;
GSXML xml;
};
#ifdef _GEARSRC

View file

@ -1,18 +0,0 @@
#ifndef __GEARSRC_XML_H__
#define __GEARSRC_XML_H__
#include <GearSrc/MachDep.h>
#include <GearSrc/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
GSDECL GSXML GSXMLOpen(GSEngine engine, const char* path);
GSDECL void GSXMLClose(GSXML xml);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -27,7 +27,7 @@ GSClient GSClientCreate(GSEngine engine) {
client->gl = GSGLCreate(client);
client->skybox = GSSkyBoxOpen(client, "base:/skybox");
client->skybox = GSSkyBoxTry(client, "default");
GSLog(GSLogInfo, "Created client");

View file

@ -5,7 +5,6 @@
#include <GearSrc/Client.h>
#include <GearSrc/Server.h>
#include <GearSrc/Resource.h>
#include <GearSrc/XML.h>
#include <GearSrc/String.h>
#include <stb_ds.h>
@ -21,26 +20,8 @@ void GSInit(void) {
int GSEngineRegisterResource(GSEngine engine, const char* name, const char* path) {
GSResource resource;
if((resource = GSResourceOpen(engine, path)) != NULL) {
GSXML xl;
char* s = GSStringConcat(name, ":/manifest.xml");
int ind;
shput(engine->resource, name, resource);
if((xl = GSXMLOpen(engine, s)) == NULL) {
free(s);
GSResourceClose(resource);
shdel(engine->resource, name);
return 0;
}
free(s);
ind = shgeti(engine->resource, name);
engine->resource[ind].xml = xl;
return 1;
}
@ -95,7 +76,6 @@ GSEngine GSEngineCreate(GSEngineParam* param) {
void GSEngineDestroy(GSEngine engine) {
int i;
for(i = 0; i < shlen(engine->resource); i++) {
GSXMLClose(engine->resource[i].xml);
GSResourceClose(engine->resource[i].value);
}
shfree(engine->resource);

View file

@ -39,6 +39,26 @@ GSSkyBox GSSkyBoxOpen(GSClient client, const char* base) {
return skybox;
}
GSSkyBox GSSkyBoxTry(GSClient client, const char* name){
const char* ns[] = {"game", "base"};
int i;
GSSkyBox sb = NULL;
for(i = 0; i < 2; i++){
char* b = GSStringConcat(ns[i], ":/skybox/");
char* s = GSStringConcat(b, name);
sb = GSSkyBoxOpen(client, s);
free(s);
free(b);
if(sb != NULL) break;
}
return sb;
}
void GSSkyBoxDraw(GSSkyBox skybox) {
GSGL gl = skybox->engine->client->gl;
int i;

View file

@ -1,52 +0,0 @@
#include <GearSrc/XML.h>
#include <GearSrc/File.h>
typedef struct arg {
GSEngine engine;
const char* path;
} arg_t;
static int driver_open(xemil_t* handle) {
arg_t* arg = handle->drv_arg;
if((handle->drv_opaque = GSFileOpen(arg->engine, arg->path)) == NULL) return 0;
return 1;
}
static int driver_read(xemil_t* handle, void* data, int size) {
return GSFileRead(handle->drv_opaque, data, size);
}
static void driver_close(xemil_t* handle) {
GSFileClose(handle->drv_opaque);
}
static xl_driver_t driver_rec = {
driver_open,
driver_read,
driver_close};
static xl_driver_t* driver = &driver_rec;
GSXML GSXMLOpen(GSEngine engine, const char* path) {
arg_t arg;
xemil_t* xl;
arg.engine = engine;
arg.path = path;
xl = xl_open(driver, &arg);
if(xl == NULL) return NULL;
if(!xl_parse(xl)) {
xl_close(xl);
return NULL;
}
return xl;
}
void GSXMLClose(GSXML xml) {
xl_close(xml);
}