mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
N64: Reduce default view distance, add Z and cpad bindings, increase analog controller responsiveness
This commit is contained in:
parent
258413124e
commit
67adc43433
10
src/Entity.c
10
src/Entity.c
@ -500,8 +500,8 @@ void Entities_Remove(EntityID id) {
|
||||
EntityID Entities_GetClosest(struct Entity* src) {
|
||||
Vec3 eyePos = Entity_GetEyePosition(src);
|
||||
Vec3 dir = Vec3_GetDirVector(src->Yaw * MATH_DEG2RAD, src->Pitch * MATH_DEG2RAD);
|
||||
float closestDist = -200.5f; /* NOTE: was previously positive infinity */
|
||||
EntityID targetId = ENTITIES_SELF_ID;
|
||||
float closestDist = -200; /* NOTE: was previously positive infinity */
|
||||
EntityID targetID = ENTITIES_SELF_ID;
|
||||
|
||||
float t0, t1;
|
||||
int i;
|
||||
@ -512,12 +512,12 @@ EntityID Entities_GetClosest(struct Entity* src) {
|
||||
if (!entity) continue;
|
||||
if (!Intersection_RayIntersectsRotatedBox(eyePos, dir, entity, &t0, &t1)) continue;
|
||||
|
||||
if (closestDist < -200 || t0 < closestDist) {
|
||||
if (targetID == ENTITIES_SELF_ID || t0 < closestDist) {
|
||||
closestDist = t0;
|
||||
targetId = (EntityID)i;
|
||||
targetID = (EntityID)i;
|
||||
}
|
||||
}
|
||||
return targetId;
|
||||
return targetID;
|
||||
}
|
||||
|
||||
static void Player_Despawn(struct Entity* e) {
|
||||
|
17
src/Game.c
17
src/Game.c
@ -46,8 +46,9 @@ cc_uint64 Game_FrameStart;
|
||||
cc_bool Game_UseCPEBlocks;
|
||||
|
||||
struct RayTracer Game_SelectedPos;
|
||||
int Game_ViewDistance = 512, Game_UserViewDistance = 512;
|
||||
int Game_MaxViewDistance = DEFAULT_MAX_VIEWDIST;
|
||||
int Game_ViewDistance = DEFAULT_VIEWDIST;
|
||||
int Game_UserViewDistance = DEFAULT_VIEWDIST;
|
||||
int Game_MaxViewDistance = DEFAULT_MAX_VIEWDIST;
|
||||
|
||||
int Game_FpsLimit, Game_Vertices;
|
||||
cc_bool Game_SimpleArmsAnim;
|
||||
@ -134,16 +135,16 @@ static void CycleViewDistanceBackwards(const short* viewDists, int count) {
|
||||
Game_UserSetViewDistance(viewDists[count - 1]);
|
||||
}
|
||||
|
||||
static const short normDists[10] = { 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };
|
||||
static const short classicDists[4] = { 8, 32, 128, 512 };
|
||||
static const short normalDists[] = { 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };
|
||||
static const short classicDists[] = { 8, 32, 128, 512 };
|
||||
void Game_CycleViewDistance(void) {
|
||||
const short* dists = Gui.ClassicMenu ? classicDists : normDists;
|
||||
int count = Gui.ClassicMenu ? Array_Elems(classicDists) : Array_Elems(normDists);
|
||||
const short* dists = Gui.ClassicMenu ? classicDists : normalDists;
|
||||
int count = Gui.ClassicMenu ? Array_Elems(classicDists) : Array_Elems(normalDists);
|
||||
|
||||
if (Input_IsShiftPressed()) {
|
||||
CycleViewDistanceBackwards(dists, count);
|
||||
} else {
|
||||
CycleViewDistanceForwards(dists, count);
|
||||
CycleViewDistanceForwards(dists, count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,7 +328,7 @@ static void LoadOptions(void) {
|
||||
Game_SimpleArmsAnim = Options_GetBool(OPT_SIMPLE_ARMS_ANIM, false);
|
||||
Game_ViewBobbing = Options_GetBool(OPT_VIEW_BOBBING, true);
|
||||
|
||||
Game_ViewDistance = Options_GetInt(OPT_VIEW_DISTANCE, 8, 4096, 512);
|
||||
Game_ViewDistance = Options_GetInt(OPT_VIEW_DISTANCE, 8, 4096, DEFAULT_VIEWDIST);
|
||||
Game_UserViewDistance = Game_ViewDistance;
|
||||
Game_BreakableLiquids = !Game_ClassicMode && Options_GetBool(OPT_MODIFIABLE_LIQUIDS, false);
|
||||
Game_AllowServerTextures = Options_GetBool(OPT_SERVER_TEXTURES, true);
|
||||
|
@ -24,7 +24,13 @@ extern cc_bool Game_UseCPEBlocks;
|
||||
extern cc_string Game_Username;
|
||||
extern cc_string Game_Mppass;
|
||||
|
||||
#ifdef CC_BUILD_N64
|
||||
#define DEFAULT_VIEWDIST 20
|
||||
#else
|
||||
#define DEFAULT_VIEWDIST 512
|
||||
#endif
|
||||
#define DEFAULT_MAX_VIEWDIST 32768
|
||||
|
||||
extern int Game_ViewDistance;
|
||||
extern int Game_MaxViewDistance;
|
||||
extern int Game_UserViewDistance;
|
||||
|
@ -190,10 +190,11 @@ static void ClearTouches(void) { }
|
||||
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",\
|
||||
"U", "V", "W", "X", "Y", "Z"
|
||||
#define Pad_Names \
|
||||
"PAD_A", "PAD_B", "PAD_X", "PAD_Y", "PAD_L", "PAD_R", \
|
||||
"PAD_A", "PAD_B", "PAD_X", "PAD_Y", "PAD_L", "PAD_R", "PAD_Z", \
|
||||
"PAD_LEFT", "PAD_RIGHT", "PAD_UP", "PAD_DOWN", \
|
||||
"PAD_START", "PAD_SELECT", "PAD_ZL", "PAD_ZR", \
|
||||
"PAD_LSTICK", "PAD_RSTICK"
|
||||
"PAD_LSTICK", "PAD_RSTICK", \
|
||||
"PAD_CLEFT", "PAD_CRIGHT", "PAD_CUP", "PAD_CDOWN"
|
||||
|
||||
/* Names for each input button when stored to disc */
|
||||
static const char* const storageNames[INPUT_COUNT] = {
|
||||
|
@ -45,10 +45,11 @@ enum InputButtons {
|
||||
/* NOTE: RMOUSE must be before MMOUSE for PlayerClick compatibility */
|
||||
CCMOUSE_X1, CCMOUSE_X2, CCMOUSE_L, CCMOUSE_R, CCMOUSE_M,
|
||||
|
||||
CCPAD_A, CCPAD_B, CCPAD_X, CCPAD_Y, CCPAD_L, CCPAD_R,
|
||||
CCPAD_A, CCPAD_B, CCPAD_X, CCPAD_Y, CCPAD_L, CCPAD_R, CCPAD_Z,
|
||||
CCPAD_LEFT, CCPAD_RIGHT, CCPAD_UP, CCPAD_DOWN,
|
||||
CCPAD_START, CCPAD_SELECT, CCPAD_ZL, CCPAD_ZR,
|
||||
CCPAD_LSTICK, CCPAD_RSTICK,
|
||||
CCPAD_CLEFT, CCPAD_CRIGHT, CCPAD_CUP, CCPAD_CDOWN,
|
||||
|
||||
INPUT_COUNT,
|
||||
|
||||
|
@ -39,6 +39,10 @@ void Window_Init(void) {
|
||||
DisplayInfo.ContentOffsetX = 10;
|
||||
DisplayInfo.ContentOffsetY = 10;
|
||||
joypad_init();
|
||||
|
||||
// change defaults to make more sense for N64
|
||||
cc_uint8* binds = (cc_uint8*)KeyBind_GamepadDefaults;
|
||||
binds[KEYBIND_INVENTORY] = CCPAD_Z;
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
@ -72,7 +76,7 @@ static void HandleButtons(joypad_buttons_t btns) {
|
||||
|
||||
Input_SetNonRepeatable(CCPAD_A, btns.a);
|
||||
Input_SetNonRepeatable(CCPAD_B, btns.b);
|
||||
Input_SetNonRepeatable(CCPAD_X, btns.z); // TODO: Or Y?
|
||||
Input_SetNonRepeatable(CCPAD_Z, btns.z);
|
||||
|
||||
Input_SetNonRepeatable(CCPAD_START, btns.start);
|
||||
|
||||
@ -81,11 +85,14 @@ static void HandleButtons(joypad_buttons_t btns) {
|
||||
Input_SetNonRepeatable(CCPAD_UP, btns.d_up);
|
||||
Input_SetNonRepeatable(CCPAD_DOWN, btns.d_down);
|
||||
|
||||
// TODO: How to map the right digital buttons (c_left/c_down etc
|
||||
Input_SetNonRepeatable(CCPAD_CLEFT, btns.c_left);
|
||||
Input_SetNonRepeatable(CCPAD_CRIGHT, btns.c_right);
|
||||
Input_SetNonRepeatable(CCPAD_CUP, btns.c_up);
|
||||
Input_SetNonRepeatable(CCPAD_CDOWN, btns.c_down);
|
||||
}
|
||||
|
||||
static void ProcessAnalogInput(joypad_inputs_t* inputs, double delta) {
|
||||
float scale = (delta * 60.0) / 32.0f;
|
||||
float scale = (delta * 60.0) / 8.0f;
|
||||
int dx = inputs->stick_x;
|
||||
int dy = inputs->stick_y;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user