mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
minor code cleanup
This commit is contained in:
parent
586e7c4830
commit
d90b06e6a8
@ -8,7 +8,6 @@
|
|||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include "Drawer.h"
|
#include "Drawer.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "BlockID.h"
|
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "TexturePack.h"
|
#include "TexturePack.h"
|
||||||
|
@ -178,7 +178,7 @@ CC_API void Gui_Remove(struct Screen* screen);
|
|||||||
CC_API void Gui_Add(struct Screen* screen, int priority);
|
CC_API void Gui_Add(struct Screen* screen, int priority);
|
||||||
|
|
||||||
/* Returns highest priority screen that has grabbed input. */
|
/* Returns highest priority screen that has grabbed input. */
|
||||||
struct Screen* Gui_GetInputGrab(void);
|
CC_API struct Screen* Gui_GetInputGrab(void);
|
||||||
/* Returns highest priority screen that blocks world rendering. */
|
/* Returns highest priority screen that blocks world rendering. */
|
||||||
struct Screen* Gui_GetBlocksWorld(void);
|
struct Screen* Gui_GetBlocksWorld(void);
|
||||||
/* Returns highest priority screen that is closable. */
|
/* Returns highest priority screen that is closable. */
|
||||||
|
@ -83,9 +83,6 @@ struct Model {
|
|||||||
float maxScale, shadowScale, nameScale;
|
float maxScale, shadowScale, nameScale;
|
||||||
struct Model* next;
|
struct Model* next;
|
||||||
};
|
};
|
||||||
#if 0
|
|
||||||
public CustomModel[] CustomModels = new CustomModel[256];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Shared data for models. */
|
/* Shared data for models. */
|
||||||
CC_VAR extern struct _ModelsData {
|
CC_VAR extern struct _ModelsData {
|
||||||
|
@ -536,6 +536,8 @@ void Particles_CustomEffect(int effectID, float x, float y, float z, float origi
|
|||||||
offset.Z = Random_Float(&rnd) - 0.5f;
|
offset.Z = Random_Float(&rnd) - 0.5f;
|
||||||
Vec3_Normalize(&offset, &offset);
|
Vec3_Normalize(&offset, &offset);
|
||||||
|
|
||||||
|
/* See https://karthikkaranth.me/blog/generating-random-points-in-a-sphere/ */
|
||||||
|
/* 'Using normally distributed random numbers' */
|
||||||
d = Random_Float(&rnd);
|
d = Random_Float(&rnd);
|
||||||
d = Math_Exp(Math_Log(d) / 3.0); /* d^1/3 for better distribution */
|
d = Math_Exp(Math_Log(d) / 3.0); /* d^1/3 for better distribution */
|
||||||
d *= e->spread;
|
d *= e->spread;
|
||||||
|
@ -1466,22 +1466,15 @@ static void CPE_DefineModel(cc_uint8* data) {
|
|||||||
|
|
||||||
static void CPE_DefineModelPart(cc_uint8* data) {
|
static void CPE_DefineModelPart(cc_uint8* data) {
|
||||||
/* 103 = 1 + 3*4 + 3*4 + 6*(2*2 + 2*2) + 3*4 + 3*4 + 1 + 4 + 1 */
|
/* 103 = 1 + 3*4 + 3*4 + 6*(2*2 + 2*2) + 3*4 + 3*4 + 1 + 4 + 1 */
|
||||||
cc_uint8 modelId = *data++;
|
cc_uint8 id = *data++;
|
||||||
struct CustomModel* customModel = &custom_models[modelId];
|
struct CustomModel* m = &custom_models[id];
|
||||||
struct CustomModelPart* part;
|
struct CustomModelPart* part;
|
||||||
cc_uint8 flags;
|
cc_uint8 flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (
|
if (id >= MAX_CUSTOM_MODELS || !m->defined || m->curPartIndex >= m->numParts) return;
|
||||||
modelId >= MAX_CUSTOM_MODELS ||
|
part = &m->parts[m->curPartIndex];
|
||||||
!customModel->defined ||
|
m->curPartIndex++;
|
||||||
customModel->curPartIndex >= customModel->numParts
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
part = &customModel->parts[customModel->curPartIndex];
|
|
||||||
customModel->curPartIndex++;
|
|
||||||
|
|
||||||
/* read min, max vec3 coords */
|
/* read min, max vec3 coords */
|
||||||
part->min.X = GetFloat(data);
|
part->min.X = GetFloat(data);
|
||||||
@ -1550,12 +1543,12 @@ static void CPE_DefineModelPart(cc_uint8* data) {
|
|||||||
|
|
||||||
/* read bool flags */
|
/* read bool flags */
|
||||||
flags = *data++;
|
flags = *data++;
|
||||||
part->fullbright = (flags >> 0) & 1;
|
part->fullbright = (flags >> 0) & 1;
|
||||||
part->firstPersonArm = (flags >> 1) & 1;
|
part->firstPersonArm = (flags >> 1) & 1;
|
||||||
|
|
||||||
if (customModel->curPartIndex == customModel->numParts) {
|
if (m->curPartIndex == m->numParts) {
|
||||||
/* we're the last part, so register our model */
|
/* we're the last part, so register our model */
|
||||||
CustomModel_Register(customModel);
|
CustomModel_Register(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user