windows build

This commit is contained in:
Alexander Zhirov 2023-05-05 15:14:13 +03:00
parent 04d7285299
commit fd284fa5dd
16 changed files with 360 additions and 222 deletions

View File

@ -10,10 +10,16 @@ This game is under development. Currently, the repository has been suspended sin
## Build
To build, you need to download the [Allegro static](https://github.com/liballeg/allegro5/releases) libraries and [static dependencies](https://github.com/liballeg/allegro_winpkg/releases). A pre-installed static [Enet](http://enet.bespin.org/) library is required to support the network ([package for MSYS2](https://packages.msys2.org/package/mingw-w64-x86_64-enet?repo=mingw64)).
Also, an installed g++ compiler and cmake build system are required for the assembly.
The working compilation of the project was carried out in [MSYS2](https://www.msys2.org/).
```sh
mkdir build
cd build
cmake -B . -S ../game
cmake -G "Unix Makefiles" -B . -S ../game -D PATH_ALLEGRO_STATIC="C:\<path-to-allegro-static-libs>" -D PATH_DEPS_STATIC="C:\<path-to-deps-static-libs>"
make
```

View File

@ -1,8 +1,72 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.25)
project(spaceshooter)
set(STDCPP_LIB stdc++ -static)
set(PATH_ALLEGRO_STATIC "" CACHE PATH "Path to allegro static libs")
set(PATH_DEPS_STATIC "" CACHE PATH "Path to dependencies static libs")
include_directories("lib/" "network/" "objects/")
# STATIC LIBRARY ALLEGRO 5
# https://github.com/liballeg/allegro5/releases
add_library(allegro STATIC IMPORTED)
set_property(TARGET allegro PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro-static.a")
add_library(allegro_primitives STATIC IMPORTED)
set_property(TARGET allegro_primitives PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_primitives-static.a")
add_library(allegro_dialog STATIC IMPORTED)
set_property(TARGET allegro_dialog PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_dialog-static.a")
add_library(allegro_image STATIC IMPORTED)
set_property(TARGET allegro_image PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_image-static.a")
add_library(allegro_font STATIC IMPORTED)
set_property(TARGET allegro_font PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_font-static.a")
add_library(allegro_ttf STATIC IMPORTED)
set_property(TARGET allegro_ttf PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_ttf-static.a")
add_library(allegro_audio STATIC IMPORTED)
set_property(TARGET allegro_audio PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_audio-static.a")
add_library(allegro_acodec STATIC IMPORTED)
set_property(TARGET allegro_acodec PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_acodec-static.a")
# DEPENDENCIES
# https://github.com/liballeg/allegro_winpkg/releases
add_library(dumb STATIC IMPORTED)
set_property(TARGET dumb PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libdumb.a")
add_library(FLAC STATIC IMPORTED)
set_property(TARGET FLAC PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libFLAC.a")
add_library(freetype STATIC IMPORTED)
set_property(TARGET freetype PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libfreetype.a")
add_library(jpeg STATIC IMPORTED)
set_property(TARGET jpeg PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libjpeg.a")
add_library(ogg STATIC IMPORTED)
set_property(TARGET ogg PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libogg.a")
add_library(opus STATIC IMPORTED)
set_property(TARGET opus PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libopus.a")
add_library(opusfile STATIC IMPORTED)
set_property(TARGET opusfile PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libopusfile.a")
add_library(physfs STATIC IMPORTED)
set_property(TARGET physfs PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libphysfs.a")
add_library(png16 STATIC IMPORTED)
set_property(TARGET png16 PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libpng16.a")
add_library(theoradec STATIC IMPORTED)
set_property(TARGET theoradec PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libtheoradec.a")
add_library(vorbis STATIC IMPORTED)
set_property(TARGET vorbis PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libvorbis.a")
add_library(vorbisfile STATIC IMPORTED)
set_property(TARGET vorbisfile PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libvorbisfile.a")
add_library(webp STATIC IMPORTED)
set_property(TARGET webp PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libwebp.a")
add_library(webpdecoder STATIC IMPORTED)
set_property(TARGET webpdecoder PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libwebpdecoder.a")
add_library(webpdemux STATIC IMPORTED)
set_property(TARGET webpdemux PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libwebpdemux.a")
add_library(zlib STATIC IMPORTED)
set_property(TARGET zlib PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libzlib.a")
# add_library(enet STATIC IMPORTED)
# set_property(TARGET enet PROPERTY IMPORTED_LOCATION "C:/msys64/mingw64/lib/libenet.a")
set(SRC_GAME
autors.c
common.c
@ -34,26 +98,94 @@ set(SRC_NETWORK network/network.c)
set(SRC_OBJECTS objects/objects.c)
find_library(ALLEGRO_LIB NAMES allegro)
find_library(ALLEGRO_PRIMITIVES_LIB NAMES allegro_primitives)
find_library(ALLEGRO_DIALOG_LIB NAMES allegro_dialog)
find_library(ALLEGRO_IMAGE_LIB allegro_image)
find_library(ALLEGRO_FONT_LIB allegro_font)
find_library(ALLEGRO_TTF_LIB allegro_ttf)
find_library(ALLEGRO_AUDIO_LIB allegro_audio)
find_library(ALLEGRO_ACODEC_LIB allegro_acodec)
find_library(ENET_LIB enet)
set(ALLEGRO_LIB allegro)
set(ALLEGRO_PRIMITIVES_LIB allegro_primitives)
set(ALLEGRO_DIALOG_LIB allegro_dialog)
set(ALLEGRO_IMAGE_LIB allegro_image)
set(ALLEGRO_FONT_LIB allegro_font)
set(ALLEGRO_TTF_LIB allegro_ttf)
set(ALLEGRO_AUDIO_LIB allegro_audio)
set(ALLEGRO_ACODEC_LIB allegro_acodec)
add_executable(${PROJECT_NAME} ${SRC_OBJECTS} ${SRC_LIB} ${SRC_NETWORK} ${SRC_GAME})
# https://packages.msys2.org/package/mingw-w64-x86_64-enet?repo=mingw64
set(ENET_LIB enet)
find_library(WINMM_LIB winmm)
find_library(OPENGL32_LIB opengl32)
find_library(GDI32_LIB gdi32)
find_library(OLE32_LIB ole32)
find_library(SHLWAPI_LIB shlwapi)
find_library(DSOUND_LIB dsound)
find_library(WS2_32_LIB ws2_32)
set(FLAC_LIB FLAC)
set(OGG_LIB ogg)
set(VORBIS_LIB vorbis)
set(OPUS_LIB opus)
set(PNG16_LIB png16)
set(FREETYPE_LIB freetype)
set(JPEG_LIB jpeg)
set(WEBP_LIB webp)
set(DUMB_LIB dumb)
set(VORBISFILE_LIB vorbisfile)
set(OPUSFILE_LIB opusfile)
set(Z_LIB zlib)
set(PHYSFS_LIB physfs)
find_library(GDIPLUS_32_LIB gdiplus)
find_library(UUID_LIB uuid)
find_library(KERNEL32_LIB kernel32)
find_library(PSAPI_32_LIB psapi)
find_library(GLU32_32_LIB glu32)
find_library(USER32_LIB user32)
find_library(COMDLG32_LIB Comdlg32)
find_library(SHELL32_LIB shell32)
find_library(ADVAPI32_LIB advapi32)
add_executable(${PROJECT_NAME} WIN32 ${SRC_OBJECTS} ${SRC_LIB} ${SRC_NETWORK} ${SRC_GAME})
target_link_libraries(${PROJECT_NAME}
${ALLEGRO_LIB}
${ALLEGRO_PRIMITIVES_LIB}
${ALLEGRO_DIALOG_LIB}
${ALLEGRO_IMAGE_LIB}
${ALLEGRO_COLOR_LIB}
${ALLEGRO_FONT_LIB}
${ALLEGRO_TTF_LIB}
${ALLEGRO_AUDIO_LIB}
${ALLEGRO_ACODEC_LIB}
${ENET_LIB})
${ALLEGRO_LIB}
${ENET_LIB}
${JPEG_LIB}
${DUMB_LIB}
${WEBP_LIB}
${FLAC_LIB}
${VORBISFILE_LIB}
${VORBIS_LIB}
${OGG_LIB}
${FREETYPE_LIB}
${PNG16_LIB}
${DSOUND_LIB}
${WINMM_LIB}
${OPENGL32_LIB}
${GDI32_LIB}
${OLE32_LIB}
${SHLWAPI_LIB}
${STDCPP_LIB}
${Z_LIB}
${OPUSFILE_LIB}
${OPUS_LIB}
${WS2_32_LIB}
# ${PHYSFS_LIB}
# ${GDIPLUS_32_LIB}
# ${UUID_LIB}
# ${KERNEL32_LIB}
# ${PSAPI_32_LIB}
# ${GLU32_32_LIB}
# ${USER32_LIB}
# ${COMDLG32_LIB}
# ${SHELL32_LIB}
# ${ADVAPI32_LIB}
)

View File

@ -106,13 +106,13 @@ void autors_draw(CLIENT_DATA* data)
void autors_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[AUTORS]->button_size > key_button)
if(data->pairing.intface[AUTORS]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[AUTORS]->button[key_button],
data->pairing.intface[AUTORS]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 6)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -124,17 +124,17 @@ void autors_init_button(CLIENT_DATA* data, int key_button, int key_font, const c
static void autors_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font && interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font && intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
switch(i)
{
case BUTTON_AUTORS_OUT:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, MENU);
break;
}

View File

@ -17,19 +17,19 @@
void cl_init_interfaces(CLIENT_PAIRING* pairing)
{
pairing->interface[MENU] = cl_create_interface(2, 5, 0);
pairing->interface[SINGLE] = cl_create_interface(3, 0, 0);
pairing->interface[NETWORKMODE] = cl_create_interface(0, 3, 0);
pairing->interface[NETWORKCREATE] = cl_create_interface(0, 2, 2);
pairing->interface[NETWORKJOIN] = cl_create_interface(0, 2, 1);
pairing->interface[NETWORKLIST] = cl_create_interface(0, 1, 0);
pairing->interface[NETWORKPARTY] = cl_create_interface(0, 4, 0);
pairing->interface[NETWORKGAME] = cl_create_interface(3, 0, 0);
pairing->interface[NETWORKOUT] = cl_create_interface(0, 2, 0);
pairing->interface[SETTINGS] = cl_create_interface(0, 0, 0);
pairing->interface[AUTORS] = cl_create_interface(0, 1, 0); // 0 background size (background copies)
pairing->interface[PAUSE] = cl_create_interface(0, 2, 0); // 0 background size (background copies)
pairing->interface[GAMEOVER] = cl_create_interface(0, 1, 0); // 0 background size (background copies)
pairing->intface[MENU] = cl_create_interface(2, 5, 0);
pairing->intface[SINGLE] = cl_create_interface(3, 0, 0);
pairing->intface[NETWORKMODE] = cl_create_interface(0, 3, 0);
pairing->intface[NETWORKCREATE] = cl_create_interface(0, 2, 2);
pairing->intface[NETWORKJOIN] = cl_create_interface(0, 2, 1);
pairing->intface[NETWORKLIST] = cl_create_interface(0, 1, 0);
pairing->intface[NETWORKPARTY] = cl_create_interface(0, 4, 0);
pairing->intface[NETWORKGAME] = cl_create_interface(3, 0, 0);
pairing->intface[NETWORKOUT] = cl_create_interface(0, 2, 0);
pairing->intface[SETTINGS] = cl_create_interface(0, 0, 0);
pairing->intface[AUTORS] = cl_create_interface(0, 1, 0); // 0 background size (background copies)
pairing->intface[PAUSE] = cl_create_interface(0, 2, 0); // 0 background size (background copies)
pairing->intface[GAMEOVER] = cl_create_interface(0, 1, 0); // 0 background size (background copies)
}
void cl_load_media(CLIENT_MEDIA* media)
@ -260,21 +260,21 @@ void cl_play_sound(CLIENT_DATA* data, int key_sample)
static void cl_init_background(CLIENT_DATA* data, int key_state, int key_bitmap, float x, float y, float vel_x, float vel_y, int dir_x, int dir_y)
{
if(data->pairing.interface[key_state]->background_size > key_bitmap)
if(data->pairing.intface[key_state]->background_size > key_bitmap)
cl_add_interface_background(
data->pairing.interface[key_state]->background[key_bitmap],
data->pairing.intface[key_state]->background[key_bitmap],
data->media.bitmaps[key_bitmap],
dir_x, dir_y, vel_x, vel_y, x, y);
}
static void cl_copy_background(CLIENT_DATA* data, int dir_key_state, int src_key_state)
{
data->pairing.interface[dir_key_state]->background = data->pairing.interface[src_key_state]->background;
data->pairing.intface[dir_key_state]->background = data->pairing.intface[src_key_state]->background;
}
void cl_draw_background(CLIENT_DATA* data, int key_bitmap)
{
CLIENT_BACKGROUND_PAGE* bg = data->pairing.interface[data->state]->background[key_bitmap];
CLIENT_BACKGROUND_PAGE* bg = data->pairing.intface[data->state]->background[key_bitmap];
al_draw_bitmap(bg->bitmap->al_bitmap, bg->x, bg->y, 0);
al_draw_bitmap(bg->bitmap->al_bitmap, bg->x + bg->bitmap->width, bg->y, 0);
@ -285,7 +285,7 @@ void cl_draw_background(CLIENT_DATA* data, int key_bitmap)
void cl_update_background(CLIENT_DATA* data, int key_bitmap)
{
CLIENT_BACKGROUND_PAGE* bg = data->pairing.interface[data->state]->background[key_bitmap];
CLIENT_BACKGROUND_PAGE* bg = data->pairing.intface[data->state]->background[key_bitmap];
bg->x += bg->vel_x * bg->dir_x;
if(bg->x + bg->bitmap->width < 0)
@ -301,7 +301,7 @@ static void cl_init_header(CLIENT_DATA* data, int key_state, int key_font, const
int block_size = data->screen.height / 8;
cl_add_interface_header(
&data->pairing.interface[key_state]->header,
&data->pairing.intface[key_state]->header,
data->media.fonts[key_font]->al_font,
data->screen.width / 2,
block_size - data->media.fonts[key_font]->size / 2,
@ -310,7 +310,7 @@ static void cl_init_header(CLIENT_DATA* data, int key_state, int key_font, const
void cl_draw_header(CLIENT_DATA* data)
{
CLIENT_HEADER header = data->pairing.interface[data->state]->header;
CLIENT_HEADER header = data->pairing.intface[data->state]->header;
al_draw_text(header.al_font, al_map_rgb(255, 255, 255), header.x, header.y, ALLEGRO_ALIGN_CENTRE, header.text);
}
@ -321,7 +321,7 @@ void cl_draw_header(CLIENT_DATA* data)
// use with mouse event
void cl_update_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
int mx, my;
if(data->screen.fullscreen)
@ -335,9 +335,9 @@ void cl_update_button(CLIENT_DATA* data)
my = data->event.current.mouse.y;
}
for(int i = 0; i < interface->button_size; i++)
for(int i = 0; i < intface->button_size; i++)
{
CLIENT_BUTTON* btn = interface->button[i];
CLIENT_BUTTON* btn = intface->button[i];
if(!btn->active) continue;
@ -347,7 +347,7 @@ void cl_update_button(CLIENT_DATA* data)
cl_play_sound(data, SAMPLE_BUTTON);
btn->selected = true;
interface->selected = SELECTED_BUTTON;
intface->selected = SELECTED_BUTTON;
}
else
btn->selected = false;
@ -356,15 +356,15 @@ void cl_update_button(CLIENT_DATA* data)
// use with key
void cl_select_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
bool is_selected = false;
if(interface->selected == SELECTED_BUTTON)
if(intface->selected == SELECTED_BUTTON)
{
int count_active_button = 0;
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->active)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->active)
count_active_button++;
if(count_active_button)
@ -372,9 +372,9 @@ void cl_select_button(CLIENT_DATA* data)
CLIENT_BUTTON* button[count_active_button];
int iterator = 0;
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->active)
button[iterator++] = interface->button[i];
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->active)
button[iterator++] = intface->button[i];
for(int i = 0; i < count_active_button; i++)
if(button[i]->selected)
@ -411,30 +411,30 @@ void cl_select_button(CLIENT_DATA* data)
cl_play_sound(data, SAMPLE_BUTTON);
}
}
else if(interface->selected == SELECTED_FIELD)
else if(intface->selected == SELECTED_FIELD)
{
for(int i = 0; i < interface->field_size; i++)
if(interface->field[i]->selected)
for(int i = 0; i < intface->field_size; i++)
if(intface->field[i]->selected)
{
interface->field[i]->enter = false;
intface->field[i]->enter = false;
if(data->keys[UP] && !data->keys[DOWN])
{
interface->field[i]->selected = false;
intface->field[i]->selected = false;
if(i != 0)
interface->field[i - 1]->selected = true;
intface->field[i - 1]->selected = true;
else
interface->field[interface->field_size - 1]->selected = true;
intface->field[intface->field_size - 1]->selected = true;
}
else if(data->keys[DOWN] && !data->keys[UP])
{
interface->field[i]->selected = false;
intface->field[i]->selected = false;
if(i == interface->field_size - 1)
interface->field[0]->selected = true;
if(i == intface->field_size - 1)
intface->field[0]->selected = true;
else
interface->field[i + 1]->selected = true;
intface->field[i + 1]->selected = true;
}
is_selected = true;
@ -443,18 +443,18 @@ void cl_select_button(CLIENT_DATA* data)
if(!is_selected)
if(data->keys[UP] && !data->keys[DOWN])
interface->field[interface->field_size - 1]->selected = true;
intface->field[intface->field_size - 1]->selected = true;
else if(data->keys[DOWN] && !data->keys[UP])
interface->field[0]->selected = true;
intface->field[0]->selected = true;
cl_play_sound(data, SAMPLE_BUTTON);
}
else if(interface->selected == SELECTED_LIST)
else if(intface->selected == SELECTED_LIST)
{
int count_active_item = 0;
for(int i = 0; i < 3; i++)
if(interface->list.item[i].active)
if(intface->list.item[i].active)
count_active_item++;
if(count_active_item)
@ -463,8 +463,8 @@ void cl_select_button(CLIENT_DATA* data)
int iterator = 0;
for(int i = 0; i < 3; i++)
if(interface->list.item[i].active)
item[iterator++] = &interface->list.item[i];
if(intface->list.item[i].active)
item[iterator++] = &intface->list.item[i];
for(int i = 0; i < count_active_item; i++)
if(item[i]->selected)
@ -505,12 +505,12 @@ void cl_select_button(CLIENT_DATA* data)
void cl_draw_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font)
{
CLIENT_BUTTON* btn = interface->button[i];
CLIENT_BUTTON* btn = intface->button[i];
ALLEGRO_COLOR clr;
btn->active = true;
@ -531,11 +531,11 @@ void cl_draw_button(CLIENT_DATA* data)
void cl_draw_field(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->field_size; i++)
for(int i = 0; i < intface->field_size; i++)
{
CLIENT_FIELD* field = interface->field[i];
CLIENT_FIELD* field = intface->field[i];
ALLEGRO_COLOR clr;
if(field->selected)
@ -554,7 +554,7 @@ void cl_draw_field(CLIENT_DATA* data)
void cl_update_field(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
int mx, my;
if(data->screen.fullscreen)
@ -568,9 +568,9 @@ void cl_update_field(CLIENT_DATA* data)
my = data->event.current.mouse.y;
}
for(int i = 0; i < interface->field_size; i++)
for(int i = 0; i < intface->field_size; i++)
{
CLIENT_FIELD* field = interface->field[i];
CLIENT_FIELD* field = intface->field[i];
if(field->f_sx < mx && field->f_dx > mx && field->f_sy < my && field->f_dy > my)
{
@ -578,7 +578,7 @@ void cl_update_field(CLIENT_DATA* data)
cl_play_sound(data, SAMPLE_BUTTON);
field->selected = true;
interface->selected = SELECTED_FIELD;
intface->selected = SELECTED_FIELD;
}
else if(field->enter)
field->selected = true;
@ -589,7 +589,7 @@ void cl_update_field(CLIENT_DATA* data)
void cl_enter_field(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
int mx, my;
if(data->screen.fullscreen)
@ -603,9 +603,9 @@ void cl_enter_field(CLIENT_DATA* data)
my = data->event.current.mouse.y;
}
for(int i = 0; i < interface->field_size; i++)
for(int i = 0; i < intface->field_size; i++)
{
CLIENT_FIELD* field = interface->field[i];
CLIENT_FIELD* field = intface->field[i];
if(field->f_sx < mx && field->f_dx > mx && field->f_sy < my && field->f_dy > my)
field->enter = true;
@ -709,11 +709,11 @@ void cl_print_field(CLIENT_DATA* data)
if(symbol != '\0')
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->field_size; i++)
for(int i = 0; i < intface->field_size; i++)
{
CLIENT_FIELD* field = interface->field[i];
CLIENT_FIELD* field = intface->field[i];
if(field->enter && field->char_number < 18)
{
@ -726,11 +726,11 @@ void cl_print_field(CLIENT_DATA* data)
}
else if(backspace)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->field_size; i++)
for(int i = 0; i < intface->field_size; i++)
{
CLIENT_FIELD* field = interface->field[i];
CLIENT_FIELD* field = intface->field[i];
if(field->enter && field->char_number > 0)
{
@ -748,7 +748,7 @@ void cl_print_field(CLIENT_DATA* data)
void cl_draw_list(CLIENT_DATA* data)
{
CLIENT_LIST* list = &data->pairing.interface[data->state]->list;
CLIENT_LIST* list = &data->pairing.intface[data->state]->list;
// if(btn->selected)
// clr = al_map_rgba_f(0.4, 0.4, 0.0, 0.2);
@ -760,7 +760,7 @@ void cl_draw_list(CLIENT_DATA* data)
void cl_update_list(CLIENT_DATA* data)
{
CLIENT_LIST* list = &data->pairing.interface[data->state]->list;
CLIENT_LIST* list = &data->pairing.intface[data->state]->list;
int mx, my;
if(data->screen.fullscreen)
@ -783,7 +783,7 @@ void cl_update_list(CLIENT_DATA* data)
if(item->sx_item < mx && item->dx_item > mx && item->sy_item < my && item->dy_item > my)
{
item->selected = true;
data->pairing.interface[data->state]->selected = SELECTED_LIST;
data->pairing.intface[data->state]->selected = SELECTED_LIST;
}
else
item->selected = false;
@ -798,7 +798,7 @@ void cl_send_message_create(CLIENT_DATA* data)
{
CLIENT_MESSAGE_NONE message;
CLIENT_FIELD** field = data->pairing.interface[data->state]->field;
CLIENT_FIELD** field = data->pairing.intface[data->state]->field;
message.display_height = data->screen.display_height;
message.display_width = data->screen.display_width;
@ -818,7 +818,7 @@ void cl_send_message_join(CLIENT_DATA* data)
{
CLIENT_MESSAGE_NONE message;
CLIENT_FIELD** field = data->pairing.interface[data->state]->field;
CLIENT_FIELD** field = data->pairing.intface[data->state]->field;
message.display_height = data->screen.display_height;
message.display_width = data->screen.display_width;

View File

@ -87,13 +87,13 @@ void gameover_draw(CLIENT_DATA* data)
void gameover_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[GAMEOVER]->button_size > key_button)
if(data->pairing.intface[GAMEOVER]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[GAMEOVER]->button[key_button],
data->pairing.intface[GAMEOVER]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 6)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -105,17 +105,17 @@ void gameover_init_button(CLIENT_DATA* data, int key_button, int key_font, const
static void gameover_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font && interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font && intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
switch(i)
{
case BUTTON_GAMEOVER_OUT:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, MENU);
break;
}

View File

@ -13,14 +13,14 @@ CLIENT_PAIRING* cl_create_pairing(CLIENT_PAIRING* pairing, int interface_size)
if(interface_size)
{
pairing->interface = (CLIENT_INTERFACE**)malloc(sizeof(CLIENT_INTERFACE*) * interface_size);
show_message_error(pairing->interface, "Failed to allocate space for CLIENT_INTERFACE collection");
pairing->intface = (CLIENT_INTERFACE**)malloc(sizeof(CLIENT_INTERFACE*) * interface_size);
show_message_error(pairing->intface, "Failed to allocate space for CLIENT_INTERFACE collection");
for(int i = 0; i < interface_size; i++)
pairing->interface[i] = NULL;
pairing->intface[i] = NULL;
}
else
pairing->interface = NULL;
pairing->intface = NULL;
return pairing;
}
@ -130,13 +130,13 @@ void cl_destroy_pairing(CLIENT_PAIRING* pairing)
{
for(int i = 0; i < pairing->interface_size; i++)
{
if(pairing->interface[i])
if(pairing->intface[i])
{
cl_destroy_interface(pairing->interface[i]);
cl_destroy_interface(pairing->intface[i]);
}
}
free(pairing->interface);
free(pairing->intface);
}
static void cl_destroy_interface(CLIENT_INTERFACE* interface)

View File

@ -114,7 +114,7 @@ typedef struct cl_interface
typedef struct cl_pairing
{
CLIENT_INTERFACE** interface;
CLIENT_INTERFACE** intface;
int interface_size;
} CLIENT_PAIRING;

View File

@ -24,7 +24,7 @@ int main(int argc, char** argv)
.sound_size = 2,
// network
.enet_port = 9234,
.enet_host = "127.0.0.1",
.enet_host = "10.100.0.11",
// settings
.effects_gain = 0.1,
.music_gain = 0.1

View File

@ -106,13 +106,13 @@ void menu_draw(CLIENT_DATA* data)
void menu_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[MENU]->button_size > key_button)
if(data->pairing.intface[MENU]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[MENU]->button[key_button],
data->pairing.intface[MENU]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 2)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -124,10 +124,10 @@ void menu_init_button(CLIENT_DATA* data, int key_button, int key_font, const cha
static void menu_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
@ -135,14 +135,14 @@ static void menu_push_button(CLIENT_DATA* data)
{
case BUTTON_MENU_SINGLE:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
al_hide_mouse_cursor(data->screen.display);
cl_change_state(data, SINGLE);
break;
}
case BUTTON_MENU_NETWORK:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKMODE);
break;
}
@ -150,7 +150,7 @@ static void menu_push_button(CLIENT_DATA* data)
break;
case BUTTON_MENU_AUTORS:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, AUTORS);
break;
}

View File

@ -118,13 +118,13 @@ void networkcreate_draw(CLIENT_DATA* data)
void networkcreate_init_field(CLIENT_DATA* data, int key_field, int key_font, const char* description)
{
if(data->pairing.interface[NETWORKCREATE]->field_size > key_field)
if(data->pairing.intface[NETWORKCREATE]->field_size > key_field)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_field(
data->pairing.interface[NETWORKCREATE]->field[key_field],
data->pairing.intface[NETWORKCREATE]->field[key_field],
font->al_font, font->size, description,
(data->screen.width / 2) - al_get_text_width(font->al_font, description),
(block_size * (key_field + 3) - font->size / 2),
@ -142,13 +142,13 @@ void networkcreate_init_field(CLIENT_DATA* data, int key_field, int key_font, co
void networkcreate_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[NETWORKCREATE]->button_size > key_button)
if(data->pairing.intface[NETWORKCREATE]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[NETWORKCREATE]->button[key_button],
data->pairing.intface[NETWORKCREATE]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 5)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -160,40 +160,40 @@ void networkcreate_init_button(CLIENT_DATA* data, int key_button, int key_font,
static void networkcreate_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
if(interface->selected == SELECTED_BUTTON)
if(intface->selected == SELECTED_BUTTON)
{
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font && interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font && intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
switch(i)
{
case BUTTON_NETWORKCREATE_CREATE:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
if(networkcreate_check_field(data))
cl_change_state(data, NETWORKPARTY);
break;
case BUTTON_NETWORKCREATE_OUT:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKMODE);
break;
}
}
}
else if(interface->selected == SELECTED_FIELD)
else if(intface->selected == SELECTED_FIELD)
{
for(int i = 0; i < interface->field_size; i++)
if(interface->field[i]->selected)
for(int i = 0; i < intface->field_size; i++)
if(intface->field[i]->selected)
switch(i)
{
case FIELD_NETWORKCREATE_NICKNAME:
interface->field[i]->enter = true;
intface->field[i]->enter = true;
break;
case FIELD_NETWORKCREATE_GAMENAME:
interface->field[i]->enter = true;
intface->field[i]->enter = true;
break;
}
}
@ -201,17 +201,17 @@ static void networkcreate_push_button(CLIENT_DATA* data)
static void networkcreate_change_selected(CLIENT_DATA* data)
{
cl_change_selected(data->pairing.interface[data->state]);
cl_change_selected(data->pairing.intface[data->state]);
}
static bool networkcreate_check_field(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
int field_size = interface->field_size;
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
int field_size = intface->field_size;
int field_filled_size = 0;
for(int i = 0; i < field_size; i++)
if(interface->field[i]->char_number > 0)
if(intface->field[i]->char_number > 0)
field_filled_size++;
return field_size == field_filled_size;

View File

@ -115,13 +115,13 @@ void networkjoin_draw(CLIENT_DATA* data)
void networkjoin_init_field(CLIENT_DATA* data, int key_field, int key_font, const char* description)
{
if(data->pairing.interface[NETWORKJOIN]->field_size > key_field)
if(data->pairing.intface[NETWORKJOIN]->field_size > key_field)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_field(
data->pairing.interface[NETWORKJOIN]->field[key_field],
data->pairing.intface[NETWORKJOIN]->field[key_field],
font->al_font, font->size, description,
(data->screen.width / 2) - al_get_text_width(font->al_font, description),
(block_size * (key_field + 3) - font->size / 2),
@ -139,13 +139,13 @@ void networkjoin_init_field(CLIENT_DATA* data, int key_field, int key_font, cons
void networkjoin_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[NETWORKJOIN]->button_size > key_button)
if(data->pairing.intface[NETWORKJOIN]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[NETWORKJOIN]->button[key_button],
data->pairing.intface[NETWORKJOIN]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 5)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -157,37 +157,37 @@ void networkjoin_init_button(CLIENT_DATA* data, int key_button, int key_font, co
static void networkjoin_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
if(interface->selected == SELECTED_BUTTON)
if(intface->selected == SELECTED_BUTTON)
{
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font && interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font && intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
switch(i)
{
case BUTTON_NETWORKJOIN_CREATE:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
if(networkjoin_check_field(data))
cl_change_state(data, NETWORKLIST);
break;
case BUTTON_NETWORKJOIN_OUT:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKMODE);
break;
}
}
}
else if(interface->selected == SELECTED_FIELD)
else if(intface->selected == SELECTED_FIELD)
{
for(int i = 0; i < interface->field_size; i++)
if(interface->field[i]->selected)
for(int i = 0; i < intface->field_size; i++)
if(intface->field[i]->selected)
switch(i)
{
case FIELD_NETWORKJOIN_NICKNAME:
interface->field[i]->enter = true;
intface->field[i]->enter = true;
break;
}
}
@ -195,17 +195,17 @@ static void networkjoin_push_button(CLIENT_DATA* data)
static void networkjoin_change_selected(CLIENT_DATA* data)
{
cl_change_selected(data->pairing.interface[data->state]);
cl_change_selected(data->pairing.intface[data->state]);
}
static bool networkjoin_check_field(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
int field_size = interface->field_size;
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
int field_size = intface->field_size;
int field_filled_size = 0;
for(int i = 0; i < field_size; i++)
if(interface->field[i]->char_number > 0)
if(intface->field[i]->char_number > 0)
field_filled_size++;
return field_size == field_filled_size;

View File

@ -116,14 +116,14 @@ void networklist_draw(CLIENT_DATA* data)
void networklist_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[NETWORKLIST]->button_size > key_button)
if(data->pairing.intface[NETWORKLIST]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
int index = 0;
cl_add_interface_button(
data->pairing.interface[NETWORKLIST]->button[key_button],
data->pairing.intface[NETWORKLIST]->button[key_button],
font->al_font, text,
data->screen.width - (750 * data->screen.scale_factor + 60) / 2,
block_size * (index + 6) + (block_size / 4) + (block_size / 2) - font->size,
@ -140,7 +140,7 @@ void networklist_init_button(CLIENT_DATA* data, int key_button, int key_font, co
void networklist_init_list(CLIENT_DATA* data, int key_font)
{
CLIENT_LIST* list = &data->pairing.interface[NETWORKLIST]->list;
CLIENT_LIST* list = &data->pairing.intface[NETWORKLIST]->list;
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
@ -168,7 +168,7 @@ void networklist_init_list(CLIENT_DATA* data, int key_font)
static void networklist_draw_list(CLIENT_DATA* data)
{
CLIENT_LIST* list = &data->pairing.interface[NETWORKLIST]->list;
CLIENT_LIST* list = &data->pairing.intface[NETWORKLIST]->list;
ALLEGRO_COLOR clr;
al_draw_rectangle(list->sx, list->sy, list->dx, list->dy, al_map_rgba_f(0.2, 0.2, 0.2, 0.2), 3);
@ -241,14 +241,14 @@ static void networklist_enet_receive(CLIENT_DATA* data)
static void networklist_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[NETWORKLIST];
CLIENT_INTERFACE* intface = data->pairing.intface[NETWORKLIST];
ENetPacket *packet;
CLIENT_MESSAGE_JOINGAME message;
if(interface->selected == SELECTED_LIST)
if(intface->selected == SELECTED_LIST)
{
CLIENT_LIST* list = &interface->list;
CLIENT_LIST* list = &intface->list;
for(int i = 0; i < 3; i++)
if(list->item[i].selected && data->network.games[i].count_connected < 3)
@ -263,17 +263,17 @@ static void networklist_push_button(CLIENT_DATA* data)
break;
}
}
else if(interface->selected == SELECTED_BUTTON)
else if(intface->selected == SELECTED_BUTTON)
{
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font && interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font && intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
switch(i)
{
case BUTTON_NETWORKLIST_OUT:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKMODE);
break;
}
@ -283,21 +283,21 @@ static void networklist_push_button(CLIENT_DATA* data)
void networklist_change_selected(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[NETWORKLIST];
CLIENT_INTERFACE* intface = data->pairing.intface[NETWORKLIST];
if(interface->selected == SELECTED_BUTTON)
if(intface->selected == SELECTED_BUTTON)
{
interface->selected = SELECTED_LIST;
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->selected)
interface->button[i]->selected = false;
intface->selected = SELECTED_LIST;
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->selected)
intface->button[i]->selected = false;
}
else if(interface->selected == SELECTED_LIST)
else if(intface->selected == SELECTED_LIST)
{
interface->selected = SELECTED_BUTTON;
intface->selected = SELECTED_BUTTON;
for(int i = 0; i < 3; i++)
if(interface->list.item[i].selected)
interface->list.item[i].selected = false;
if(intface->list.item[i].selected)
intface->list.item[i].selected = false;
}
}

View File

@ -106,13 +106,13 @@ void networkmode_draw(CLIENT_DATA* data)
void networkmode_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[NETWORKMODE]->button_size > key_button)
if(data->pairing.intface[NETWORKMODE]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[NETWORKMODE]->button[key_button],
data->pairing.intface[NETWORKMODE]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 3)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -124,25 +124,25 @@ void networkmode_init_button(CLIENT_DATA* data, int key_button, int key_font, co
static void networkmode_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font && interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font && intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
switch(i)
{
case BUTTON_NETWORKMODE_CREATE:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKCREATE);
break;
case BUTTON_NETWORKMODE_JOIN:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKJOIN);
break;
case BUTTON_NETWORKMODE_OUT:
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, MENU);
break;
}

View File

@ -115,13 +115,13 @@ void networkout_draw(CLIENT_DATA* data)
void networkout_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[NETWORKOUT]->button_size > key_button)
if(data->pairing.intface[NETWORKOUT]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[NETWORKOUT]->button[key_button],
data->pairing.intface[NETWORKOUT]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 3)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -133,10 +133,10 @@ void networkout_init_button(CLIENT_DATA* data, int key_button, int key_font, con
static void networkout_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
@ -144,14 +144,14 @@ static void networkout_push_button(CLIENT_DATA* data)
{
case BUTTON_NETWORKOUT_BACK:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
al_hide_mouse_cursor(data->screen.display);
cl_change_state(data, NETWORKGAME);
break;
}
case BUTTON_NETWORKOUT_MENU:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, NETWORKMODE);
break;
}

View File

@ -120,7 +120,7 @@ void networkparty_draw(CLIENT_DATA* data)
void networkparty_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[NETWORKPARTY]->button_size > key_button)
if(data->pairing.intface[NETWORKPARTY]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
@ -130,7 +130,7 @@ void networkparty_init_button(CLIENT_DATA* data, int key_button, int key_font, c
index = 1;
cl_add_interface_button(
data->pairing.interface[NETWORKPARTY]->button[key_button],
data->pairing.intface[NETWORKPARTY]->button[key_button],
font->al_font, text,
data->screen.width - (750 * data->screen.scale_factor + 60) / 2,
block_size * (index + 5) + (block_size / 4) + (block_size / 2) - font->size,
@ -143,12 +143,12 @@ void networkparty_init_button(CLIENT_DATA* data, int key_button, int key_font, c
static void networkparty_draw_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[NETWORKPARTY];
CLIENT_INTERFACE* intface = data->pairing.intface[NETWORKPARTY];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->al_font)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->al_font)
{
CLIENT_BUTTON* btn = interface->button[i];
CLIENT_BUTTON* btn = intface->button[i];
if(data->network.is_creator)
{
@ -195,7 +195,7 @@ static void networkparty_draw_button(CLIENT_DATA* data)
void networkparty_init_list(CLIENT_DATA* data, int key_font)
{
CLIENT_LIST* list = &data->pairing.interface[NETWORKPARTY]->list;
CLIENT_LIST* list = &data->pairing.intface[NETWORKPARTY]->list;
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
@ -223,7 +223,7 @@ void networkparty_init_list(CLIENT_DATA* data, int key_font)
static void networkparty_draw_list(CLIENT_DATA* data)
{
CLIENT_LIST* list = &data->pairing.interface[NETWORKPARTY]->list;
CLIENT_LIST* list = &data->pairing.intface[NETWORKPARTY]->list;
ALLEGRO_COLOR clr;
al_draw_rectangle(list->sx, list->sy, list->dx, list->dy, al_map_rgba_f(0.2, 0.2, 0.2, 0.2), 3);
@ -305,16 +305,16 @@ static void networkparty_enet_receive(CLIENT_DATA* data)
static void networkparty_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[NETWORKPARTY];
CLIENT_INTERFACE* intface = data->pairing.intface[NETWORKPARTY];
if(interface->selected == SELECTED_BUTTON)
if(intface->selected == SELECTED_BUTTON)
{
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
interface->button[i]->selected = false;
intface->button[i]->selected = false;
switch(i)
{
@ -335,11 +335,11 @@ static void networkparty_push_button(CLIENT_DATA* data)
}
}
}
else if(interface->selected == SELECTED_LIST)
else if(intface->selected == SELECTED_LIST)
{
if(data->network.is_creator)
{
CLIENT_LIST* list = &interface->list;
CLIENT_LIST* list = &intface->list;
for(int i = 0; i < 3; i++)
if(list->item[i].selected && data->network.users[i].id != data->network.user_id)
@ -356,21 +356,21 @@ static void networkparty_push_button(CLIENT_DATA* data)
static void networkparty_change_selected(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[NETWORKPARTY];
CLIENT_INTERFACE* intface = data->pairing.intface[NETWORKPARTY];
if(interface->selected == SELECTED_BUTTON)
if(intface->selected == SELECTED_BUTTON)
{
interface->selected = SELECTED_LIST;
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->selected)
interface->button[i]->selected = false;
intface->selected = SELECTED_LIST;
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->selected)
intface->button[i]->selected = false;
}
else if(interface->selected == SELECTED_LIST)
else if(intface->selected == SELECTED_LIST)
{
interface->selected = SELECTED_BUTTON;
intface->selected = SELECTED_BUTTON;
for(int i = 0; i < 3; i++)
if(interface->list.item[i].selected)
interface->list.item[i].selected = false;
if(intface->list.item[i].selected)
intface->list.item[i].selected = false;
}
}

View File

@ -87,13 +87,13 @@ void pause_draw(CLIENT_DATA* data)
void pause_init_button(CLIENT_DATA* data, int key_button, int key_font, const char* text)
{
if(data->pairing.interface[PAUSE]->button_size > key_button)
if(data->pairing.intface[PAUSE]->button_size > key_button)
{
CLIENT_FONT* font = data->media.fonts[key_font];
int block_size = data->screen.height / 8;
cl_add_interface_button(
data->pairing.interface[PAUSE]->button[key_button],
data->pairing.intface[PAUSE]->button[key_button],
font->al_font, text, data->screen.width / 2,
(block_size * (key_button + 3)) + (block_size / 4) + (block_size / 2) - font->size,
(data->screen.width / 2) - (750 * data->screen.scale_factor) / 2,
@ -105,10 +105,10 @@ void pause_init_button(CLIENT_DATA* data, int key_button, int key_font, const ch
static void pause_push_button(CLIENT_DATA* data)
{
CLIENT_INTERFACE* interface = data->pairing.interface[data->state];
CLIENT_INTERFACE* intface = data->pairing.intface[data->state];
for(int i = 0; i < interface->button_size; i++)
if(interface->button[i]->selected)
for(int i = 0; i < intface->button_size; i++)
if(intface->button[i]->selected)
{
cl_play_sound(data, SAMPLE_ENTER);
@ -116,14 +116,14 @@ static void pause_push_button(CLIENT_DATA* data)
{
case BUTTON_PAUSE_BACK:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
al_hide_mouse_cursor(data->screen.display);
cl_change_state(data, SINGLE);
break;
}
case BUTTON_PAUSE_MENU:
{
interface->button[i]->selected = false;
intface->button[i]->selected = false;
cl_change_state(data, MENU);
break;
}