Convert case switch to block_class_is_subset
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool block_class_is_subset(
|
extern inline bool block_class_is_subset(
|
||||||
mc_block_t block,
|
mc_block_t block,
|
||||||
const mc_block_t block_class[],
|
const mc_block_t block_class[],
|
||||||
size_t block_class_len
|
size_t block_class_len
|
||||||
|
|||||||
@@ -1,50 +1,50 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Minecraft Overviewer.
|
* This file is part of the Minecraft Overviewer.
|
||||||
*
|
*
|
||||||
* Minecraft Overviewer is free software: you can redistribute it and/or
|
* Minecraft Overviewer is free software: you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as published
|
* modify it under the terms of the GNU General Public License as published
|
||||||
* by the Free Software Foundation, either version 3 of the License, or (at
|
* by the Free Software Foundation, either version 3 of the License, or (at
|
||||||
* your option) any later version.
|
* your option) any later version.
|
||||||
*
|
*
|
||||||
* Minecraft Overviewer is distributed in the hope that it will be useful,
|
* Minecraft Overviewer is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
* Public License for more details.
|
* Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with the Overviewer. If not, see <http://www.gnu.org/licenses/>.
|
* with the Overviewer. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BLOCK_CLASS_H_INCLUDED__
|
#ifndef __BLOCK_CLASS_H_INCLUDED__
|
||||||
#define __BLOCK_CLASS_H_INCLUDED__
|
#define __BLOCK_CLASS_H_INCLUDED__
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "mc_id.h"
|
#include "mc_id.h"
|
||||||
|
|
||||||
bool block_class_is_subset(
|
bool block_class_is_subset(
|
||||||
mc_block_t block,
|
mc_block_t block,
|
||||||
const mc_block_t block_class[],
|
const mc_block_t block_class[],
|
||||||
size_t block_class_len
|
size_t block_class_len
|
||||||
);
|
);
|
||||||
|
|
||||||
extern const mc_block_t block_class_stair[];
|
extern const mc_block_t block_class_stair[];
|
||||||
extern const size_t block_class_stair_len;
|
extern const size_t block_class_stair_len;
|
||||||
|
|
||||||
extern const mc_block_t block_class_door[];
|
extern const mc_block_t block_class_door[];
|
||||||
extern const size_t block_class_door_len;
|
extern const size_t block_class_door_len;
|
||||||
|
|
||||||
extern const mc_block_t block_class_fence[];
|
extern const mc_block_t block_class_fence[];
|
||||||
extern const size_t block_class_fence_len;
|
extern const size_t block_class_fence_len;
|
||||||
|
|
||||||
extern const mc_block_t block_class_fence_gate[];
|
extern const mc_block_t block_class_fence_gate[];
|
||||||
extern const size_t block_class_fence_gate_len;
|
extern const size_t block_class_fence_gate_len;
|
||||||
|
|
||||||
extern const mc_block_t block_class_ancil[];
|
extern const mc_block_t block_class_ancil[];
|
||||||
extern const size_t block_class_ancil_len;
|
extern const size_t block_class_ancil_len;
|
||||||
|
|
||||||
extern const mc_block_t block_class_alt_height[];
|
extern const mc_block_t block_class_alt_height[];
|
||||||
extern const size_t block_class_alt_height_len;
|
extern const size_t block_class_alt_height_len;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -125,23 +125,25 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
|||||||
/* grass needs a special facemask */
|
/* grass needs a special facemask */
|
||||||
facemask = self->grass_texture;
|
facemask = self->grass_texture;
|
||||||
}
|
}
|
||||||
|
if(block_class_is_subset(state->block,(mc_block_t[]){
|
||||||
switch (state->block) {
|
block_grass,
|
||||||
case block_grass:
|
block_tallgrass,
|
||||||
case block_tallgrass:
|
block_pumpkin_stem,
|
||||||
case block_pumpkin_stem:
|
block_melon_stem,
|
||||||
case block_melon_stem:
|
block_vine,
|
||||||
case block_vine:
|
block_waterlily,
|
||||||
case block_waterlily:
|
block_double_plant
|
||||||
case block_double_plant:
|
},7)) {
|
||||||
color_table = self->grasscolor;
|
color_table = self->grasscolor;
|
||||||
break;
|
}
|
||||||
case block_flowing_water:
|
else if(block_class_is_subset(state->block,(mc_block_t[]){
|
||||||
case block_water:
|
block_flowing_water,block_water
|
||||||
|
},2)) {
|
||||||
color_table = self->watercolor;
|
color_table = self->watercolor;
|
||||||
break;
|
}
|
||||||
case block_leaves:
|
else if(block_class_is_subset(state->block,(mc_block_t[]){
|
||||||
case block_leaves2:
|
block_leaves,block_leaves2
|
||||||
|
},2)) {
|
||||||
color_table = self->foliagecolor;
|
color_table = self->foliagecolor;
|
||||||
if (state->block_data == 2)
|
if (state->block_data == 2)
|
||||||
{
|
{
|
||||||
@@ -149,10 +151,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
|||||||
birch foliage color is flipped XY-ways */
|
birch foliage color is flipped XY-ways */
|
||||||
flip_xy = 1;
|
flip_xy = 1;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (color_table) {
|
if (color_table) {
|
||||||
unsigned char biome;
|
unsigned char biome;
|
||||||
|
|||||||
Reference in New Issue
Block a user