minor code cleanup

This commit is contained in:
UnknownShadow200 2020-07-24 19:36:03 +10:00
parent 586e7c4830
commit d90b06e6a8
5 changed files with 11 additions and 20 deletions

View File

@ -8,7 +8,6 @@
#include "Graphics.h"
#include "Drawer.h"
#include "ExtMath.h"
#include "BlockID.h"
#include "Block.h"
#include "PackedCol.h"
#include "TexturePack.h"

View File

@ -178,7 +178,7 @@ CC_API void Gui_Remove(struct Screen* screen);
CC_API void Gui_Add(struct Screen* screen, int priority);
/* 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. */
struct Screen* Gui_GetBlocksWorld(void);
/* Returns highest priority screen that is closable. */

View File

@ -83,9 +83,6 @@ struct Model {
float maxScale, shadowScale, nameScale;
struct Model* next;
};
#if 0
public CustomModel[] CustomModels = new CustomModel[256];
#endif
/* Shared data for models. */
CC_VAR extern struct _ModelsData {

View File

@ -536,6 +536,8 @@ void Particles_CustomEffect(int effectID, float x, float y, float z, float origi
offset.Z = Random_Float(&rnd) - 0.5f;
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 = Math_Exp(Math_Log(d) / 3.0); /* d^1/3 for better distribution */
d *= e->spread;

View File

@ -1466,22 +1466,15 @@ static void CPE_DefineModel(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 */
cc_uint8 modelId = *data++;
struct CustomModel* customModel = &custom_models[modelId];
cc_uint8 id = *data++;
struct CustomModel* m = &custom_models[id];
struct CustomModelPart* part;
cc_uint8 flags;
int i;
if (
modelId >= MAX_CUSTOM_MODELS ||
!customModel->defined ||
customModel->curPartIndex >= customModel->numParts
) {
return;
}
part = &customModel->parts[customModel->curPartIndex];
customModel->curPartIndex++;
if (id >= MAX_CUSTOM_MODELS || !m->defined || m->curPartIndex >= m->numParts) return;
part = &m->parts[m->curPartIndex];
m->curPartIndex++;
/* read min, max vec3 coords */
part->min.X = GetFloat(data);
@ -1550,12 +1543,12 @@ static void CPE_DefineModelPart(cc_uint8* data) {
/* read bool flags */
flags = *data++;
part->fullbright = (flags >> 0) & 1;
part->fullbright = (flags >> 0) & 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 */
CustomModel_Register(customModel);
CustomModel_Register(m);
}
}