mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 19:45:05 +08:00
Compare commits
4 Commits
continuous
...
16bit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70a3ff531c | ||
|
|
501ff944b9 | ||
|
|
f16641b606 | ||
|
|
f045103abb |
@@ -1,28 +0,0 @@
|
||||
image: alpine/latest
|
||||
packages:
|
||||
- build-base
|
||||
- sdl2-dev
|
||||
- freetype-dev
|
||||
- fontconfig-dev
|
||||
- opus-dev
|
||||
- bzip2-dev
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-alpine-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-alpine-amd64.tar.bz2
|
||||
@@ -1,31 +0,0 @@
|
||||
image: debian/sid
|
||||
arch: amd64
|
||||
packages:
|
||||
- build-essential
|
||||
- python-is-python3
|
||||
- libsdl2-dev
|
||||
- libfreetype-dev
|
||||
- libfontconfig-dev
|
||||
- libopus-dev
|
||||
- libbz2-dev
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-debian-arm64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-debian-arm64.tar.bz2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
image: debian/sid
|
||||
packages:
|
||||
- build-essential
|
||||
- python-is-python3
|
||||
- libsdl2-dev
|
||||
- libfreetype-dev
|
||||
- libfontconfig-dev
|
||||
- libopus-dev
|
||||
- libbz2-dev
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-debian-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-debian-amd64.tar.bz2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
image: freebsd/latest
|
||||
packages:
|
||||
- lang/python
|
||||
- devel/pkgconf
|
||||
- devel/sdl20
|
||||
- print/freetype2
|
||||
- x11-fonts/fontconfig
|
||||
- audio/opus
|
||||
- archivers/bzip2
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-freebsd-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-freebsd-amd64.tar.bz2
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
image: netbsd/latest
|
||||
packages:
|
||||
- python311
|
||||
- SDL2
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- libopus
|
||||
- pkgconf
|
||||
- bzip2
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
python3.11 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
python3.11 waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-netbsd-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-netbsd-amd64.tar.bz2
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
image: openbsd/latest
|
||||
packages:
|
||||
- python3
|
||||
- sdl2
|
||||
- opus
|
||||
- bzip2
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
python3 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
python3 waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-openbsd-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-openbsd-amd64.tar.bz2
|
||||
|
||||
24
.cirrus.yml
24
.cirrus.yml
@@ -1,22 +1,34 @@
|
||||
task:
|
||||
name: freebsd-14-amd64
|
||||
name: freebsd-11-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-14-0
|
||||
image_family: freebsd-11-4
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
- pkg install -y git sdl2 python
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
- ./scripts/cirrus/build_freebsd.sh full
|
||||
|
||||
task:
|
||||
name: freebsd-15-amd64
|
||||
name: freebsd-12-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-15-0-snap
|
||||
image_family: freebsd-12-2
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
- pkg install -y git sdl2 python
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
- ./scripts/cirrus/build_freebsd.sh full
|
||||
|
||||
task:
|
||||
name: freebsd-13-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-0-snap
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y git sdl2 python
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
|
||||
360
.editorconfig
360
.editorconfig
@@ -1,365 +1,9 @@
|
||||
# this file is just a suggestion, you might follow it, you might not
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
charset = latin1
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
ij_formatter_off_tag = @formatter:off
|
||||
ij_formatter_on_tag = @formatter:on
|
||||
|
||||
[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
|
||||
|
||||
# Visual C++ Formatting settings
|
||||
cpp_indent_braces = false
|
||||
cpp_indent_multi_line_relative_to = innermost_parenthesis
|
||||
cpp_indent_within_parentheses = indent
|
||||
cpp_indent_preserve_within_parentheses = true
|
||||
cpp_indent_case_contents = true
|
||||
cpp_indent_case_labels = false
|
||||
cpp_indent_case_contents_when_block = false
|
||||
cpp_indent_lambda_braces_when_parameter = true
|
||||
cpp_indent_goto_labels = one_left
|
||||
cpp_indent_preprocessor = leftmost_column
|
||||
cpp_indent_access_specifiers = false
|
||||
cpp_indent_namespace_contents = true
|
||||
cpp_indent_preserve_comments = false
|
||||
cpp_new_line_before_open_brace_namespace = new_line
|
||||
cpp_new_line_before_open_brace_type = new_line
|
||||
cpp_new_line_before_open_brace_function = new_line
|
||||
cpp_new_line_before_open_brace_block = new_line
|
||||
cpp_new_line_before_open_brace_lambda = new_line
|
||||
cpp_new_line_scope_braces_on_separate_lines = true
|
||||
cpp_new_line_close_brace_same_line_empty_type = false
|
||||
cpp_new_line_close_brace_same_line_empty_function = false
|
||||
cpp_new_line_before_catch = true
|
||||
cpp_new_line_before_else = true
|
||||
cpp_new_line_before_while_in_do_while = false
|
||||
cpp_space_before_function_open_parenthesis = remove
|
||||
cpp_space_within_parameter_list_parentheses = true
|
||||
cpp_space_between_empty_parameter_list_parentheses = true
|
||||
cpp_space_after_keywords_in_control_flow_statements = false
|
||||
cpp_space_within_control_flow_statement_parentheses = true
|
||||
cpp_space_before_lambda_open_parenthesis = false
|
||||
cpp_space_within_cast_parentheses = false
|
||||
cpp_space_after_cast_close_parenthesis = false
|
||||
cpp_space_within_expression_parentheses = true
|
||||
cpp_space_before_block_open_brace = true
|
||||
cpp_space_between_empty_braces = true
|
||||
cpp_space_before_initializer_list_open_brace = false
|
||||
cpp_space_within_initializer_list_braces = true
|
||||
cpp_space_preserve_in_initializer_list = true
|
||||
cpp_space_before_open_square_bracket = false
|
||||
cpp_space_within_square_brackets = false
|
||||
cpp_space_before_empty_square_brackets = false
|
||||
cpp_space_between_empty_square_brackets = false
|
||||
cpp_space_group_square_brackets = true
|
||||
cpp_space_within_lambda_brackets = false
|
||||
cpp_space_between_empty_lambda_brackets = false
|
||||
cpp_space_before_comma = false
|
||||
cpp_space_after_comma = true
|
||||
cpp_space_remove_around_member_operators = true
|
||||
cpp_space_before_inheritance_colon = true
|
||||
cpp_space_before_constructor_colon = true
|
||||
cpp_space_remove_before_semicolon = true
|
||||
cpp_space_after_semicolon = true
|
||||
cpp_space_remove_around_unary_operator = true
|
||||
cpp_space_around_binary_operator = insert
|
||||
cpp_space_around_assignment_operator = insert
|
||||
cpp_space_pointer_reference_alignment = right
|
||||
cpp_space_around_ternary_operator = insert
|
||||
cpp_use_unreal_engine_macro_formatting = true
|
||||
cpp_wrap_preserve_blocks = one_liners
|
||||
|
||||
# IDEA settings
|
||||
ij_c_add_brief_tag = false
|
||||
ij_c_add_getter_prefix = true
|
||||
ij_c_add_setter_prefix = true
|
||||
ij_c_align_dictionary_pair_values = false
|
||||
ij_c_align_group_field_declarations = false
|
||||
ij_c_align_init_list_in_columns = true
|
||||
ij_c_align_multiline_array_initializer_expression = false
|
||||
ij_c_align_multiline_assignment = false
|
||||
ij_c_align_multiline_binary_operation = false
|
||||
ij_c_align_multiline_chained_methods = false
|
||||
ij_c_align_multiline_for = true
|
||||
ij_c_align_multiline_ternary_operation = false
|
||||
ij_c_array_initializer_comma_on_next_line = false
|
||||
ij_c_array_initializer_new_line_after_left_brace = false
|
||||
ij_c_array_initializer_right_brace_on_new_line = false
|
||||
ij_c_array_initializer_wrap = off
|
||||
ij_c_assignment_wrap = off
|
||||
ij_c_binary_operation_sign_on_next_line = false
|
||||
ij_c_binary_operation_wrap = off
|
||||
ij_c_blank_lines_after_class_header = 0
|
||||
ij_c_blank_lines_after_imports = 1
|
||||
ij_c_blank_lines_around_class = 1
|
||||
ij_c_blank_lines_around_field = 0
|
||||
ij_c_blank_lines_around_field_in_interface = 0
|
||||
ij_c_blank_lines_around_method = 1
|
||||
ij_c_blank_lines_around_method_in_interface = 1
|
||||
ij_c_blank_lines_around_namespace = 0
|
||||
ij_c_blank_lines_around_properties_in_declaration = 0
|
||||
ij_c_blank_lines_around_properties_in_interface = 0
|
||||
ij_c_blank_lines_before_imports = 1
|
||||
ij_c_blank_lines_before_method_body = 0
|
||||
ij_c_block_brace_placement = next_line
|
||||
ij_c_block_brace_style = next_line
|
||||
ij_c_block_comment_at_first_column = true
|
||||
ij_c_catch_on_new_line = false
|
||||
ij_c_class_brace_style = next_line
|
||||
ij_c_class_constructor_init_list_align_multiline = true
|
||||
ij_c_class_constructor_init_list_comma_on_next_line = false
|
||||
ij_c_class_constructor_init_list_new_line_after_colon = never
|
||||
ij_c_class_constructor_init_list_new_line_before_colon = if_long
|
||||
ij_c_class_constructor_init_list_wrap = normal
|
||||
ij_c_copy_is_deep = false
|
||||
ij_c_create_interface_for_categories = true
|
||||
ij_c_declare_generated_methods = true
|
||||
ij_c_description_include_member_names = true
|
||||
ij_c_discharged_short_ternary_operator = false
|
||||
ij_c_do_not_add_breaks = false
|
||||
ij_c_do_while_brace_force = never
|
||||
ij_c_else_on_new_line = false
|
||||
ij_c_enum_constants_comma_on_next_line = false
|
||||
ij_c_enum_constants_wrap = off
|
||||
ij_c_for_brace_force = never
|
||||
ij_c_for_statement_new_line_after_left_paren = false
|
||||
ij_c_for_statement_right_paren_on_new_line = false
|
||||
ij_c_for_statement_wrap = off
|
||||
ij_c_function_brace_placement = next_line
|
||||
ij_c_function_call_arguments_align_multiline = true
|
||||
ij_c_function_call_arguments_align_multiline_pars = false
|
||||
ij_c_function_call_arguments_comma_on_next_line = false
|
||||
ij_c_function_call_arguments_new_line_after_lpar = false
|
||||
ij_c_function_call_arguments_new_line_before_rpar = false
|
||||
ij_c_function_call_arguments_wrap = normal
|
||||
ij_c_function_non_top_after_return_type_wrap = normal
|
||||
ij_c_function_parameters_align_multiline = true
|
||||
ij_c_function_parameters_align_multiline_pars = false
|
||||
ij_c_function_parameters_comma_on_next_line = false
|
||||
ij_c_function_parameters_new_line_after_lpar = false
|
||||
ij_c_function_parameters_new_line_before_rpar = false
|
||||
ij_c_function_parameters_wrap = normal
|
||||
ij_c_function_top_after_return_type_wrap = normal
|
||||
ij_c_generate_additional_eq_operators = true
|
||||
ij_c_generate_additional_rel_operators = true
|
||||
ij_c_generate_class_constructor = true
|
||||
ij_c_generate_comparison_operators_use_std_tie = false
|
||||
ij_c_generate_instance_variables_for_properties = ask
|
||||
ij_c_generate_operators_as_members = true
|
||||
ij_c_header_guard_style_pattern = ${PROJECT_NAME}_${FILE_NAME}_${EXT}
|
||||
ij_c_if_brace_force = never
|
||||
ij_c_in_line_short_ternary_operator = true
|
||||
ij_c_indent_block_comment = true
|
||||
ij_c_indent_c_struct_members = 4
|
||||
ij_c_indent_case_from_switch = true
|
||||
ij_c_indent_class_members = 4
|
||||
ij_c_indent_directive_as_code = false
|
||||
ij_c_indent_implementation_members = 0
|
||||
ij_c_indent_inside_code_block = 4
|
||||
ij_c_indent_interface_members = 0
|
||||
ij_c_indent_interface_members_except_ivars_block = false
|
||||
ij_c_indent_namespace_members = 4
|
||||
ij_c_indent_preprocessor_directive = 0
|
||||
ij_c_indent_visibility_keywords = 0
|
||||
ij_c_insert_override = true
|
||||
ij_c_insert_virtual_with_override = false
|
||||
ij_c_introduce_auto_consts = false
|
||||
ij_c_introduce_auto_vars = false
|
||||
ij_c_introduce_const_params = false
|
||||
ij_c_introduce_const_vars = false
|
||||
ij_c_introduce_constexpr_consts = false
|
||||
ij_c_introduce_generate_property = false
|
||||
ij_c_introduce_generate_synthesize = true
|
||||
ij_c_introduce_globals_to_header = true
|
||||
ij_c_introduce_prop_to_private_category = false
|
||||
ij_c_introduce_static_consts = true
|
||||
ij_c_introduce_use_ns_types = false
|
||||
ij_c_ivars_prefix = _
|
||||
ij_c_ivars_suffix =
|
||||
ij_c_keep_blank_lines_before_end = 2
|
||||
ij_c_keep_blank_lines_before_right_brace = 2
|
||||
ij_c_keep_blank_lines_in_code = 2
|
||||
ij_c_keep_blank_lines_in_declarations = 2
|
||||
ij_c_keep_case_expressions_in_one_line = false
|
||||
ij_c_keep_control_statement_in_one_line = false
|
||||
ij_c_keep_directive_at_first_column = true
|
||||
ij_c_keep_first_column_comment = false
|
||||
ij_c_keep_line_breaks = true
|
||||
ij_c_keep_nested_namespaces_in_one_line = false
|
||||
ij_c_keep_simple_blocks_in_one_line = false
|
||||
ij_c_keep_simple_methods_in_one_line = false
|
||||
ij_c_keep_structures_in_one_line = false
|
||||
ij_c_lambda_capture_list_align_multiline = false
|
||||
ij_c_lambda_capture_list_align_multiline_bracket = false
|
||||
ij_c_lambda_capture_list_comma_on_next_line = false
|
||||
ij_c_lambda_capture_list_new_line_after_lbracket = false
|
||||
ij_c_lambda_capture_list_new_line_before_rbracket = false
|
||||
ij_c_lambda_capture_list_wrap = off
|
||||
ij_c_line_comment_add_space = false
|
||||
ij_c_line_comment_at_first_column = true
|
||||
ij_c_method_brace_placement = end_of_line
|
||||
ij_c_method_call_arguments_align_by_colons = true
|
||||
ij_c_method_call_arguments_align_multiline = false
|
||||
ij_c_method_call_arguments_special_dictionary_pairs_treatment = true
|
||||
ij_c_method_call_arguments_wrap = off
|
||||
ij_c_method_call_chain_wrap = off
|
||||
ij_c_method_parameters_align_by_colons = true
|
||||
ij_c_method_parameters_align_multiline = false
|
||||
ij_c_method_parameters_wrap = off
|
||||
ij_c_namespace_brace_placement = next_line
|
||||
ij_c_parentheses_expression_new_line_after_left_paren = false
|
||||
ij_c_parentheses_expression_right_paren_on_new_line = false
|
||||
ij_c_place_assignment_sign_on_next_line = false
|
||||
ij_c_property_nonatomic = true
|
||||
ij_c_put_ivars_to_implementation = true
|
||||
ij_c_refactor_compatibility_aliases_and_classes = true
|
||||
ij_c_refactor_properties_and_ivars = true
|
||||
ij_c_release_style = ivar
|
||||
ij_c_retain_object_parameters_in_constructor = true
|
||||
ij_c_semicolon_after_method_signature = false
|
||||
ij_c_shift_operation_align_multiline = true
|
||||
ij_c_shift_operation_wrap = normal
|
||||
ij_c_show_non_virtual_functions = false
|
||||
ij_c_space_after_colon = true
|
||||
ij_c_space_after_colon_in_foreach = true
|
||||
ij_c_space_after_colon_in_selector = false
|
||||
ij_c_space_after_comma = true
|
||||
ij_c_space_after_cup_in_blocks = false
|
||||
ij_c_space_after_dictionary_literal_colon = true
|
||||
ij_c_space_after_for_semicolon = true
|
||||
ij_c_space_after_init_list_colon = true
|
||||
ij_c_space_after_method_parameter_type_parentheses = false
|
||||
ij_c_space_after_method_return_type_parentheses = false
|
||||
ij_c_space_after_pointer_in_declaration = false
|
||||
ij_c_space_after_quest = true
|
||||
ij_c_space_after_reference_in_declaration = false
|
||||
ij_c_space_after_reference_in_rvalue = false
|
||||
ij_c_space_after_structures_rbrace = true
|
||||
ij_c_space_after_superclass_colon = true
|
||||
ij_c_space_after_type_cast = false
|
||||
ij_c_space_after_visibility_sign_in_method_declaration = true
|
||||
ij_c_space_before_autorelease_pool_lbrace = true
|
||||
ij_c_space_before_catch_keyword = true
|
||||
ij_c_space_before_catch_left_brace = true
|
||||
ij_c_space_before_catch_parentheses = false
|
||||
ij_c_space_before_category_parentheses = true
|
||||
ij_c_space_before_chained_send_message = true
|
||||
ij_c_space_before_class_left_brace = true
|
||||
ij_c_space_before_colon = true
|
||||
ij_c_space_before_colon_in_foreach = true
|
||||
ij_c_space_before_comma = false
|
||||
ij_c_space_before_dictionary_literal_colon = true
|
||||
ij_c_space_before_do_left_brace = true
|
||||
ij_c_space_before_else_keyword = true
|
||||
ij_c_space_before_else_left_brace = true
|
||||
ij_c_space_before_export_lbrace = true
|
||||
ij_c_space_before_for_left_brace = true
|
||||
ij_c_space_before_for_parentheses = false
|
||||
ij_c_space_before_for_semicolon = false
|
||||
ij_c_space_before_if_left_brace = true
|
||||
ij_c_space_before_if_parentheses = false
|
||||
ij_c_space_before_init_list = false
|
||||
ij_c_space_before_init_list_colon = true
|
||||
ij_c_space_before_method_call_parentheses = false
|
||||
ij_c_space_before_method_left_brace = true
|
||||
ij_c_space_before_method_parentheses = false
|
||||
ij_c_space_before_namespace_lbrace = true
|
||||
ij_c_space_before_pointer_in_declaration = true
|
||||
ij_c_space_before_property_attributes_parentheses = false
|
||||
ij_c_space_before_protocols_brackets = true
|
||||
ij_c_space_before_quest = true
|
||||
ij_c_space_before_reference_in_declaration = true
|
||||
ij_c_space_before_superclass_colon = true
|
||||
ij_c_space_before_switch_left_brace = true
|
||||
ij_c_space_before_switch_parentheses = false
|
||||
ij_c_space_before_template_call_lt = false
|
||||
ij_c_space_before_template_declaration_lt = true
|
||||
ij_c_space_before_try_left_brace = true
|
||||
ij_c_space_before_while_keyword = true
|
||||
ij_c_space_before_while_left_brace = true
|
||||
ij_c_space_before_while_parentheses = false
|
||||
ij_c_space_between_adjacent_brackets = false
|
||||
ij_c_space_between_operator_and_punctuator = false
|
||||
ij_c_space_within_empty_array_initializer_braces = true
|
||||
ij_c_spaces_around_additive_operators = true
|
||||
ij_c_spaces_around_assignment_operators = true
|
||||
ij_c_spaces_around_bitwise_operators = true
|
||||
ij_c_spaces_around_equality_operators = true
|
||||
ij_c_spaces_around_lambda_arrow = true
|
||||
ij_c_spaces_around_logical_operators = true
|
||||
ij_c_spaces_around_multiplicative_operators = true
|
||||
ij_c_spaces_around_pm_operators = false
|
||||
ij_c_spaces_around_relational_operators = true
|
||||
ij_c_spaces_around_shift_operators = true
|
||||
ij_c_spaces_around_unary_operator = false
|
||||
ij_c_spaces_within_array_initializer_braces = true
|
||||
ij_c_spaces_within_braces = false
|
||||
ij_c_spaces_within_brackets = false
|
||||
ij_c_spaces_within_cast_parentheses = false
|
||||
ij_c_spaces_within_catch_parentheses = true
|
||||
ij_c_spaces_within_category_parentheses = false
|
||||
ij_c_spaces_within_empty_braces = false
|
||||
ij_c_spaces_within_empty_function_call_parentheses = true
|
||||
ij_c_spaces_within_empty_function_declaration_parentheses = true
|
||||
ij_c_spaces_within_empty_lambda_capture_list_bracket = false
|
||||
ij_c_spaces_within_empty_template_call_ltgt = false
|
||||
ij_c_spaces_within_empty_template_declaration_ltgt = false
|
||||
ij_c_spaces_within_for_parentheses = true
|
||||
ij_c_spaces_within_function_call_parentheses = true
|
||||
ij_c_spaces_within_function_declaration_parentheses = true
|
||||
ij_c_spaces_within_if_parentheses = true
|
||||
ij_c_spaces_within_lambda_capture_list_bracket = false
|
||||
ij_c_spaces_within_method_parameter_type_parentheses = false
|
||||
ij_c_spaces_within_method_return_type_parentheses = false
|
||||
ij_c_spaces_within_parentheses = true
|
||||
ij_c_spaces_within_property_attributes_parentheses = false
|
||||
ij_c_spaces_within_protocols_brackets = false
|
||||
ij_c_spaces_within_send_message_brackets = false
|
||||
ij_c_spaces_within_structured_binding_list_bracket = false
|
||||
ij_c_spaces_within_switch_parentheses = true
|
||||
ij_c_spaces_within_template_call_ltgt = false
|
||||
ij_c_spaces_within_template_declaration_ltgt = false
|
||||
ij_c_spaces_within_template_double_gt = false
|
||||
ij_c_spaces_within_while_parentheses = true
|
||||
ij_c_special_else_if_treatment = true
|
||||
ij_c_structured_binding_list_align_multiline = false
|
||||
ij_c_structured_binding_list_align_multiline_bracket = false
|
||||
ij_c_structured_binding_list_comma_on_next_line = false
|
||||
ij_c_structured_binding_list_new_line_after_lbracket = false
|
||||
ij_c_structured_binding_list_new_line_before_rbracket = false
|
||||
ij_c_structured_binding_list_wrap = off
|
||||
ij_c_superclass_list_after_colon = never
|
||||
ij_c_superclass_list_align_multiline = true
|
||||
ij_c_superclass_list_before_colon = if_long
|
||||
ij_c_superclass_list_comma_on_next_line = false
|
||||
ij_c_superclass_list_wrap = on_every_item
|
||||
ij_c_tag_prefix_of_block_comment = at
|
||||
ij_c_tag_prefix_of_line_comment = back_slash
|
||||
ij_c_template_call_arguments_align_multiline = false
|
||||
ij_c_template_call_arguments_align_multiline_pars = false
|
||||
ij_c_template_call_arguments_comma_on_next_line = false
|
||||
ij_c_template_call_arguments_new_line_after_lt = false
|
||||
ij_c_template_call_arguments_new_line_before_gt = false
|
||||
ij_c_template_call_arguments_wrap = off
|
||||
ij_c_template_declaration_function_body_indent = false
|
||||
ij_c_template_declaration_function_wrap = split_into_lines
|
||||
ij_c_template_declaration_struct_body_indent = false
|
||||
ij_c_template_declaration_struct_wrap = split_into_lines
|
||||
ij_c_template_parameters_align_multiline = false
|
||||
ij_c_template_parameters_align_multiline_pars = false
|
||||
ij_c_template_parameters_comma_on_next_line = false
|
||||
ij_c_template_parameters_new_line_after_lt = false
|
||||
ij_c_template_parameters_new_line_before_gt = false
|
||||
ij_c_template_parameters_wrap = off
|
||||
ij_c_ternary_operation_signs_on_next_line = false
|
||||
ij_c_ternary_operation_wrap = off
|
||||
ij_c_type_qualifiers_placement = before
|
||||
ij_c_use_modern_casts = true
|
||||
ij_c_use_setters_in_constructor = true
|
||||
ij_c_while_brace_force = never
|
||||
ij_c_while_on_new_line = false
|
||||
ij_c_wrap_property_declaration = off
|
||||
|
||||
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
||||
custom: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/donate.md
|
||||
134
.github/workflows/c-cpp.yml
vendored
134
.github/workflows/c-cpp.yml
vendored
@@ -1,11 +1,6 @@
|
||||
name: Build & Deploy Engine
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
# cleanup:
|
||||
# runs-on: self-hosted
|
||||
# steps:
|
||||
# - name: Cleanup
|
||||
# run: rm -rf .* || true
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
@@ -13,112 +8,63 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Linux build specifically want oldest Ubuntu as possible
|
||||
# to be crossdistribution compatible, otherwise use ubuntu-latest
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-18.04
|
||||
targetos: linux
|
||||
targetarch: amd64
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-18.04
|
||||
targetos: linux
|
||||
targetarch: i386
|
||||
# - os: ubuntu-aarch64-20.04
|
||||
# targetos: linux
|
||||
# targetarch: aarch64
|
||||
- os: ubuntu-20.04
|
||||
targetos: android
|
||||
targetarch: multiarch
|
||||
# - os: ubuntu-20.04
|
||||
# targetos: motomagx
|
||||
# targetarch: armv6
|
||||
|
||||
- os: ubuntu-latest
|
||||
targetos: nswitch
|
||||
targetarch: arm64
|
||||
- os: ubuntu-latest
|
||||
targetos: psvita
|
||||
targetarch: armv7hf
|
||||
- os: ubuntu-18.04
|
||||
targetos: android
|
||||
targetarch: 32
|
||||
- os: ubuntu-18.04
|
||||
targetos: android
|
||||
targetarch: 64
|
||||
|
||||
- os: ubuntu-18.04
|
||||
targetos: motomagx
|
||||
targetarch: armv6
|
||||
|
||||
- os: windows-latest
|
||||
targetos: win32
|
||||
targetarch: amd64
|
||||
- os: windows-2019 # always use the oldest possible for 32-bit because of older compilers, and better support of certain legacy OSes
|
||||
- os: windows-latest
|
||||
targetos: win32
|
||||
targetarch: i386
|
||||
- os: macos-14 # in GitHub documentation, it's an ARM64 machine
|
||||
targetos: apple
|
||||
targetarch: arm64
|
||||
- os: macos-12 # in GitHub documentation, it's an x86 machine
|
||||
targetos: apple
|
||||
targetarch: amd64
|
||||
env:
|
||||
SDL_VERSION: 2.30.3
|
||||
SDL_VERSION: 2.0.14
|
||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ANDROID_SDK_TOOLS_VER: 4333796
|
||||
ANDROID_NDK_VER: r10e
|
||||
UPLOADTOOL_ISPRERELEASE: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Checkout xash-extras
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: FWGS/xash-extras
|
||||
path: xash-extras
|
||||
|
||||
- name: Install dependencies
|
||||
run: bash scripts/gha/deps_${{ matrix.targetos }}.sh
|
||||
|
||||
- name: Build engine
|
||||
env:
|
||||
FWGS_PFX_PASSWORD: ${{ secrets.FWGS_PFX_PASSWORD }}
|
||||
run: bash scripts/gha/build_${{ matrix.targetos }}.sh
|
||||
- name: Upload engine (artifacts)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifact-${{ matrix.targetos }}-${{ matrix.targetarch }}
|
||||
path: artifacts/*
|
||||
flatpak:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- app: su.xash.Engine.Compat.i386
|
||||
container:
|
||||
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build flatpak (Compat.i386)
|
||||
uses: FWGS/flatpak-github-actions/flatpak-builder@v6.3
|
||||
with:
|
||||
bundle: ${{ matrix.app }}.flatpak
|
||||
manifest-path: scripts/flatpak/${{ matrix.app }}.yml
|
||||
release:
|
||||
name: "Upload releases"
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, flatpak]
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
steps:
|
||||
- name: Remove old release, fetch artifacts, repackage binaries and upload new release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RELEASE_TAG: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
|
||||
run: |
|
||||
gh release delete "$RELEASE_TAG" \
|
||||
--yes \
|
||||
--cleanup-tag \
|
||||
--repo "$GITHUB_REPOSITORY" || true
|
||||
sleep 20s
|
||||
gh run download "$GITHUB_RUN_ID" \
|
||||
--dir artifacts/ \
|
||||
--repo "$GITHUB_REPOSITORY"
|
||||
pushd artifacts/
|
||||
echo "Found artifacts:"
|
||||
ls
|
||||
for i in $(find -mindepth 1 -maxdepth 1 -type d); do
|
||||
mv "$i"/* .
|
||||
rm -rf "$i"
|
||||
done
|
||||
echo "Repackaged artifacts:"
|
||||
ls -R
|
||||
popd
|
||||
sleep 20s
|
||||
gh release create "$RELEASE_TAG" artifacts/* \
|
||||
--title "Xash3D FWGS Continuous ${{ github.ref_name }} Build" \
|
||||
--target $GITHUB_SHA \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--prerelease
|
||||
|
||||
- name: Upload engine (android)
|
||||
if: matrix.targetos == 'android'
|
||||
run: bash scripts/continious_upload.sh xashdroid-${{ matrix.targetarch }}.apk
|
||||
- name: Upload engine (motomagx)
|
||||
if: matrix.targetos == 'motomagx'
|
||||
run: bash scripts/continious_upload.sh xash3d-fwgs-magx.7z
|
||||
- name: Upload engine (linux)
|
||||
if: matrix.targetos == 'linux'
|
||||
run: bash scripts/continious_upload.sh xash3d-fwgs-${{ matrix.targetarch }}.AppImage xashds-linux-${{ matrix.targetarch }}
|
||||
- name: Upload engine (windows)
|
||||
if: matrix.targetos == 'win32'
|
||||
run: bash scripts/continious_upload.sh xash3d-fwgs-win32-${{ matrix.targetarch }}.7z
|
||||
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -54,18 +54,12 @@ CMakeFiles
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
CMakeLists.txt*
|
||||
CMakeScripts
|
||||
Testing
|
||||
compile_commands.json
|
||||
_deps
|
||||
# makedepend
|
||||
Makefile.dep
|
||||
*.bak
|
||||
ALL_BUILD.*
|
||||
INSTALL.*
|
||||
ZERO_CHECK.*
|
||||
CMakeLists.txt
|
||||
|
||||
# Visual Studio
|
||||
*.obj
|
||||
@@ -337,11 +331,4 @@ __pycache__
|
||||
.vscode/*
|
||||
*.code-workspace
|
||||
.history/*
|
||||
.cache/*
|
||||
enc_temp_folder/
|
||||
|
||||
# KDevelop4
|
||||
*.kdev4
|
||||
|
||||
# ccls langauge server
|
||||
.ccls-*
|
||||
.cache/*
|
||||
26
.gitmodules
vendored
26
.gitmodules
vendored
@@ -1,27 +1,15 @@
|
||||
[submodule "mainui"]
|
||||
path = 3rdparty/mainui
|
||||
path = mainui
|
||||
url = https://github.com/FWGS/mainui_cpp
|
||||
[submodule "ref_gl/nanogl"]
|
||||
path = 3rdparty/nanogl
|
||||
path = ref_gl/nanogl
|
||||
url = https://github.com/FWGS/nanogl
|
||||
[submodule "ref_gl/gl-wes-v2"]
|
||||
path = 3rdparty/gl-wes-v2
|
||||
path = ref_gl/gl-wes-v2
|
||||
url = https://github.com/FWGS/gl-wes-v2
|
||||
[submodule "vgui-dev"]
|
||||
path = vgui-dev
|
||||
url = https://github.com/FWGS/vgui-dev
|
||||
[submodule "ref_gl/gl4es"]
|
||||
path = 3rdparty/gl4es/gl4es
|
||||
path = ref_gl/gl4es
|
||||
url = https://github.com/ptitSeb/gl4es
|
||||
[submodule "vgui_support"]
|
||||
path = 3rdparty/vgui_support
|
||||
url = https://github.com/FWGS/vgui_support
|
||||
[submodule "opus"]
|
||||
path = 3rdparty/opus/opus
|
||||
url = https://github.com/xiph/opus
|
||||
[submodule "3rdparty/xash-extras"]
|
||||
path = 3rdparty/extras/xash-extras
|
||||
url = https://github.com/FWGS/xash-extras
|
||||
[submodule "3rdparty/bzip2/bzip2"]
|
||||
path = 3rdparty/bzip2/bzip2
|
||||
url = https://gitlab.com/bzip2/bzip2
|
||||
[submodule "3rdparty/MultiEmulator"]
|
||||
path = 3rdparty/MultiEmulator
|
||||
url = https://github.com/FWGS/MultiEmulator
|
||||
|
||||
35
.travis.yml
Normal file
35
.travis.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
language: c
|
||||
compiler: gcc
|
||||
sudo: false
|
||||
env:
|
||||
global:
|
||||
- SDL_VERSION=2.0.14
|
||||
git:
|
||||
depth: 50
|
||||
submodules: true
|
||||
|
||||
os: linux
|
||||
arch:
|
||||
- aarch64
|
||||
- ppc64le
|
||||
- s390x
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- libx11-dev
|
||||
- libxext-dev
|
||||
- x11-utils
|
||||
- libgl1-mesa-dev
|
||||
- libasound-dev
|
||||
- libstdc++6
|
||||
- libfuse2
|
||||
- unzip
|
||||
before_script:
|
||||
- sh scripts/travis/deps_common.sh
|
||||
- sh scripts/travis/deps_${TRAVIS_OS_NAME}.sh
|
||||
script:
|
||||
- sh scripts/travis/build_${TRAVIS_OS_NAME}.sh
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.tar.xz xashds-linux-${ARCH}
|
||||
1
3rdparty/MultiEmulator
vendored
1
3rdparty/MultiEmulator
vendored
Submodule 3rdparty/MultiEmulator deleted from 2f3c3a40cd
1
3rdparty/bzip2/bz_version.h
vendored
1
3rdparty/bzip2/bz_version.h
vendored
@@ -1 +0,0 @@
|
||||
#define BZ_VERSION "1.1.0-fwgs"
|
||||
1
3rdparty/bzip2/bzip2
vendored
1
3rdparty/bzip2/bzip2
vendored
Submodule 3rdparty/bzip2/bzip2 deleted from 66c46b8c94
34
3rdparty/bzip2/wscript
vendored
34
3rdparty/bzip2/wscript
vendored
@@ -1,34 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
def options(opt):
|
||||
pass
|
||||
|
||||
def configure(conf):
|
||||
conf.define('_GNU_SOURCE', 1)
|
||||
conf.define('BZ_NO_STDIO', 1)
|
||||
|
||||
if conf.env.DEST_OS == 'win32':
|
||||
conf.define('BZ_LCCWIN32', 1)
|
||||
else:
|
||||
conf.define('BZ_UNIX', 1)
|
||||
|
||||
def build(bld):
|
||||
# doesn't work with CMake generator
|
||||
# bld(
|
||||
# features = 'subst',
|
||||
# source = 'bzip2/bz_version.h.in',
|
||||
# target = 'bz_version.h',
|
||||
# BZ_VERSION='1.1.0-fwgs'
|
||||
# )
|
||||
|
||||
bz_sources = ['bzip2/blocksort.c', 'bzip2/huffman.c', 'bzip2/crctable.c', 'bzip2/randtable.c', 'bzip2/compress.c', 'bzip2/decompress.c', 'bzip2/bzlib.c']
|
||||
|
||||
bld.stlib(
|
||||
source = bz_sources,
|
||||
target = 'bzip2',
|
||||
# use = 'bz_version.h',
|
||||
includes = ['.', 'bzip2/'],
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
export_includes = ['bzip2/']
|
||||
)
|
||||
29
3rdparty/extras/wscript
vendored
29
3rdparty/extras/wscript
vendored
@@ -1,29 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import os
|
||||
|
||||
def options(opt):
|
||||
pass
|
||||
|
||||
def configure(conf):
|
||||
if not conf.path.find_dir('xash-extras'):
|
||||
conf.fatal('Can\'t find xash-extras submodule.')
|
||||
return
|
||||
|
||||
conf.load('zip')
|
||||
|
||||
def build(bld):
|
||||
srcdir = bld.path.find_dir('xash-extras')
|
||||
|
||||
if bld.env.DEST_OS in ['android']:
|
||||
install_path = bld.env.PREFIX
|
||||
else:
|
||||
install_path = os.path.join(bld.env.SHAREDIR, bld.env.GAMEDIR)
|
||||
|
||||
bld(features='zip',
|
||||
name = 'extras.pk3',
|
||||
files = srcdir.ant_glob('**/*'),
|
||||
relative_to = srcdir,
|
||||
compresslevel = 0,
|
||||
install_path = install_path)
|
||||
1
3rdparty/extras/xash-extras
vendored
1
3rdparty/extras/xash-extras
vendored
Submodule 3rdparty/extras/xash-extras deleted from 9050d05a7b
1
3rdparty/gl-wes-v2
vendored
1
3rdparty/gl-wes-v2
vendored
Submodule 3rdparty/gl-wes-v2 deleted from d4ed038d13
1
3rdparty/gl4es/gl4es
vendored
1
3rdparty/gl4es/gl4es
vendored
Submodule 3rdparty/gl4es/gl4es deleted from e39434a2b1
23
3rdparty/gl4es/wscript
vendored
23
3rdparty/gl4es/wscript
vendored
@@ -1,23 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import os
|
||||
|
||||
def options(opt):
|
||||
pass
|
||||
|
||||
def configure(conf):
|
||||
if not conf.path.find_dir('gl4es') or not conf.path.find_dir('gl4es/src'):
|
||||
conf.fatal('Can\'t find gl4es submodule. Run `git submodule update --init --recursive`.')
|
||||
return
|
||||
|
||||
def build(bld):
|
||||
gl4es_srcdir = bld.path.find_node('gl4es/src')
|
||||
|
||||
bld.stlib(source = gl4es_srcdir.ant_glob(['gl/*.c', 'gl/*/*.c', 'glx/hardext.c']),
|
||||
target = 'gl4es',
|
||||
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
||||
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'NO_LOADER', 'STATICLIB'],
|
||||
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
export_includes = '.')
|
||||
1
3rdparty/mainui
vendored
1
3rdparty/mainui
vendored
Submodule 3rdparty/mainui deleted from 0bb921ea8d
1
3rdparty/nanogl
vendored
1
3rdparty/nanogl
vendored
Submodule 3rdparty/nanogl deleted from 6c0f341b7b
1
3rdparty/opus/opus
vendored
1
3rdparty/opus/opus
vendored
Submodule 3rdparty/opus/opus deleted from 82ac57d9f1
40
3rdparty/opus/wscript
vendored
40
3rdparty/opus/wscript
vendored
@@ -1,40 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import os
|
||||
|
||||
def options(opt):
|
||||
pass
|
||||
|
||||
def configure(conf):
|
||||
if not conf.path.find_dir('opus') or not conf.path.find_dir('opus/src'):
|
||||
conf.fatal('Can\'t find opus submodule. Run `git submodule update --init --recursive`.')
|
||||
return
|
||||
|
||||
# TODO: ARM/x86 intrinsics detection
|
||||
# TODO: maybe call autotools/cmake/meson instead?
|
||||
|
||||
def build(bld):
|
||||
sources = bld.path.ant_glob([
|
||||
'opus/src/*.c',
|
||||
'opus/celt/*.c',
|
||||
'opus/silk/*.c',
|
||||
'opus/silk/float/*.c'
|
||||
], excl = [
|
||||
'opus/src/repacketizer_demo.c',
|
||||
'opus/src/opus_demo.c',
|
||||
'opus/src/opus_compare.c',
|
||||
'opus/celt/opus_custom_demo.c'
|
||||
])
|
||||
includes = ['opus/include/', 'opus/celt/', 'opus/silk/', 'opus/silk/float/']
|
||||
defines = ['USE_ALLOCA', 'OPUS_BUILD', 'FLOAT_APPROX', 'PACKAGE_VERSION="1.4.0"', 'CUSTOM_MODES']
|
||||
|
||||
bld.stlib(
|
||||
source = sources,
|
||||
target = 'opus',
|
||||
features = 'c',
|
||||
includes = includes,
|
||||
defines = defines,
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
export_includes = ['opus/include/']
|
||||
)
|
||||
1
3rdparty/vgui_support
vendored
1
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support deleted from e0ab95229d
@@ -1,17 +0,0 @@
|
||||
# Bug-compatibility in Xash3D FWGS
|
||||
|
||||
Xash3D FWGS has special mode for games that rely on original engine bugs. In this mode, we emulate the behaviour of selected functions that may help running mods relying on engine bugs, but enabling them by default may break majority of other games.
|
||||
|
||||
At this time, we only have implemented GoldSrc bug-compatibility. It can be enabled with `-bugcomp` command line switch.
|
||||
|
||||
When `-bugcomp` is specified without argument, it enables everything. This behavior might be changed or removed in future versions.
|
||||
|
||||
When `-bugcomp` is specified with argument, it interpreted as flags separated with `+`. This way it's possible to combine multiple levels of bug-compatibility.
|
||||
|
||||
## GoldSrc bug-compatibility
|
||||
|
||||
| Flag | Description | Games that require this flag |
|
||||
| ------- | ----------- | ---------------------------- |
|
||||
| `peoei` | Reverts `pfnPEntityOfEntIndex` behavior to GoldSrc, where it returns NULL for last player due to incorrect player index comparison | * Counter-Strike: Condition Zero - Deleted Scenes |
|
||||
| `gsmrf` | Rewrites message at the moment when Game DLL attempts to write an internal engine message, usually specific to GoldSrc protocol. Right now only supports `svc_spawnstaticsound`, more messages added by request. | * MetaMod/AMXModX based mods |
|
||||
| `sp_attn_none` | Makes sounds with attenuation zero spatialized, i.e. have a stereo effect. | Possibly, every game that was made for GoldSrc. |
|
||||
@@ -1,9 +0,0 @@
|
||||
# Cross-compiling for Windows with Wine
|
||||
|
||||
This can be useful to test engine in Wine without using virtual machines or dual-booting to Windows.
|
||||
|
||||
0. Clone and install https://github.com/mstorsjo/msvc-wine (you can skip CMake part)
|
||||
1. Set environment variable MSVC_WINE_PATH to the path to installed MSVC toolchain
|
||||
2. Pre-load wine: `wineserver -k; wineserver -p; wine64 wineboot`
|
||||
3. Run `./waf configure -T <build-type> --enable-wine-msvc --sdl2=../SDL2_VC`. Configuration step will take more time than usual.
|
||||
4. .. other typical steps to build from console ...
|
||||
@@ -1,10 +0,0 @@
|
||||
# Debugging your mod using minidump files (Windows only)
|
||||
Minidump files is awesome instrument for debugging your mod after it's being released, or for catch specific crashes which are presented only in one specific configuration, but doesn't happens in other configurations or even on developer machine. It contains a lot of information useful for debugging, and therefore it size is not so small: around hundreds or even thousands of megabytes. But this is not a problem, since minidump files compresses very effectively using common algorithms.
|
||||
There are short algorithm, explaining how to use this debugging instrument:
|
||||
|
||||
1. User starts your mod with `-minidumps` startup parameter
|
||||
2. Finally, crash happened on user's machine, and minidump file being written. This file has `.mdmp` extension and located in same folder, where mod folder located
|
||||
3. User packs this minidump file to .zip/.7z archive, and somehow sends it to developer
|
||||
4. Developer just opens minidump file in Visual Studio, then a virtual debugging session is opened and now reasons of crash is pretty easy to detect: you can see call stack, local function variables and global variables, information about exception and a lot of other information
|
||||
|
||||
You can find more information about minidumps in this [awesome article](https://learn.microsoft.com/en-us/windows/win32/dxtecharts/crash-dump-analysis?source=recommendations#writing-a-minidump).
|
||||
@@ -1,24 +0,0 @@
|
||||
# Developers donation page
|
||||
|
||||
On this page you can find links where you can support each developer individually, who has provided public sponsorship information.
|
||||
|
||||
### [a1batross](https://github.com/a1batross)
|
||||
|
||||
* Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization.
|
||||
* Boosty page: https://boosty.to/a1ba
|
||||
|
||||
### [nekonomicon](https://github.com/nekonomicon)
|
||||
|
||||
* [hlsdk-portable](https://github.com/FWGS/hlsdk-portable), [mdldec](../utils/mdldec), [opensource-mods.md](opensource-mods.md) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=nekonomicon) (*BSD/clang port, PNG support, etc).
|
||||
* Boosty page: https://boosty.to/nekonomicon
|
||||
|
||||
### [Velaron](https://github.com/Velaron)
|
||||
* [cs16-client](https://github.com/Velaron/cs16-client) & [tf15-client](https://github.com/Velaron/tf15-client) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=Velaron) (Android port, voice chat, etc).
|
||||
* BuyMeACoffee page: https://www.buymeacoffee.com/velaron
|
||||
|
||||
### [SNMetamorph](https://github.com/SNMetamorph)
|
||||
* [PrimeXT](https://github.com/SNMetamorph/PrimeXT) & [GoldSrc Monitor](https://github.com/SNMetamorph/goldsrc-monitor) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=SNMetamorph) (Windows port, voice chat, etc).
|
||||
* BTC: `16GAzK3qei5AwBW7sggXp3yNcFHBtdpxXj`
|
||||
* ETH (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||
* USDT (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||
* USDC (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||
@@ -1,150 +0,0 @@
|
||||
# There are few new commands availiable in xash3d fork:
|
||||
|
||||
## Commands:
|
||||
### ent_create
|
||||
Create entity with specified classname and key/values
|
||||
|
||||
`ent_create <classname> <key> <value> <key> <value> ...`
|
||||
|
||||
for example:
|
||||
|
||||
`ent_create monster_zombie targetname zomb1`
|
||||
|
||||
after creating entity, ent_last_xxx cvars are set to new entity and ent_last_cb called, look at ent_getvars description
|
||||
|
||||
### ent_fire
|
||||
|
||||
Make some actions on entity
|
||||
|
||||
`ent_fire <pattern> <command> <args>`
|
||||
Availiavle commands:
|
||||
* Set fields (Only set entity field, does not call any functions):
|
||||
* health
|
||||
* gravity
|
||||
* movetype
|
||||
* solid
|
||||
* rendermode
|
||||
* rendercolor (vector)
|
||||
* renderfx
|
||||
* renderamt
|
||||
* hullmin (vector)
|
||||
* hullmax (vector)
|
||||
* Actions
|
||||
* rename: set entity targetname
|
||||
* settarget: set entity target (only targetnames)
|
||||
* setmodel: set entity model (does not update)
|
||||
* set: set key/value by server library
|
||||
* See game FGD to get list.
|
||||
* command takes two arguments
|
||||
* touch: touch entity by current player.
|
||||
* use: use entity by current player.
|
||||
* movehere: place entity in player fov.
|
||||
* drop2floor: place entity to nearest floor surface
|
||||
* moveup: move entity to 25 units up
|
||||
* moveup (value): move by y axis relatively to specified value
|
||||
* Flags (Set/clear specified flag bit, arg is bit number):
|
||||
* setflag
|
||||
* clearflag
|
||||
* setspawnflag
|
||||
* clearspawnflag
|
||||
|
||||
### ent_info
|
||||
Print information about entity by identificator
|
||||
|
||||
`ent_info <identificator>`
|
||||
|
||||
### ent_getvars
|
||||
Set client cvars containing entity information (useful for [[Scripting]]) and call ent_last_cb
|
||||
|
||||
`ent_getvars <identificator>`
|
||||
|
||||
These cvars are set:
|
||||
```
|
||||
ent_last_name
|
||||
ent_last_num
|
||||
ent_last_inst
|
||||
ent_last_origin
|
||||
ent_last_class
|
||||
```
|
||||
|
||||
### ent_list
|
||||
Print short information about antities, filtered by pattern
|
||||
|
||||
`ent_list <pattern>`
|
||||
|
||||
## Syntax description
|
||||
|
||||
### \<identificator\>
|
||||
|
||||
* !cross: entity under aim
|
||||
* Instance code: !\<number\>_\<seria\l>
|
||||
* set by ent_getvars command
|
||||
* Entity index
|
||||
* targetname pattern
|
||||
|
||||
### \<pattern\>
|
||||
|
||||
Pattern is like identificator, but may filter many entities by classname
|
||||
|
||||
### (vector)
|
||||
|
||||
used by ent_fire command. vector means three float values, entered without quotes
|
||||
|
||||
### key/value
|
||||
|
||||
All entities parameters may be set by specifiing key and value strings.
|
||||
|
||||
Originally, this mechanizm is used in map/bsp format, but it can be used in enttools too.
|
||||
|
||||
Keys and values are passed to server library and processed by entity keyvalue function, setting edict and entity owns parameters.
|
||||
|
||||
If value contains spaces, it must be put in quotes:
|
||||
|
||||
`ent_fire !cross set origin "0 0 0"`
|
||||
|
||||
## Using with scripting
|
||||
|
||||
ent_create and ent_getvars commands are setting cvars on client
|
||||
|
||||
It can be used with ent_last_cb alias that is executed after setting cvars.
|
||||
|
||||
Simple example:
|
||||
|
||||
```
|
||||
ent_create weapon_c4
|
||||
alias ent_last_cb "ent_fire \$ent_last_inst use"
|
||||
```
|
||||
|
||||
Use weapon_c4 after creating it.
|
||||
|
||||
Note that you cannot use many dfferent callbacks at the same time.
|
||||
|
||||
You can set entity name by by pattern and create special script, contatning all callbacks.
|
||||
|
||||
Example:
|
||||
|
||||
example.cfg
|
||||
```
|
||||
alias ent_last_cb exec entity_cb.cfg
|
||||
ent create \<class\> targetname my_ent1_$name
|
||||
ent_create \<class\> targetname my_ent2_$name
|
||||
```
|
||||
entity_cb.cfg
|
||||
```
|
||||
if $ent_last_name == my_ent1_$name
|
||||
:(ent1 actions)
|
||||
if $ent_last_name == my_ent2_$name
|
||||
:(ent2 actions)
|
||||
```
|
||||
Note that scripting cannot be blocking. You cannot wait for server answer and continue. But you can use small scripts, connected with ent_last_cb command. The best usage is user interaction. You can add touch buttons to screen or call user command menu actions by callbacks.
|
||||
## Server side
|
||||
|
||||
To enable entity tools on server, set sv_enttools_enable to 1
|
||||
|
||||
To change maximum number of entities, touched by ent_fire, change sv_enttools_maxfire to required number.
|
||||
|
||||
To enable actions on players, set sv_enttools_players to 1.
|
||||
|
||||
To enable entity tools for player by nickname, set sv_enttools_godplayer to nickname. Useful to temporary enable from rcon.
|
||||
|
||||
To prevent crash on some actions, set host_mapdesign_fatal to 0
|
||||
@@ -1,21 +0,0 @@
|
||||
## Environment variables
|
||||
|
||||
#### Xash3D FWGS
|
||||
|
||||
The engine respects these environment variables:
|
||||
|
||||
| Variable | Type | Description |
|
||||
| --------------------- | ---------- | ----------- |
|
||||
| `XASH3D_GAME` | _string_ | Overrides default game directory. Ignored if `-game` command line argument is set |
|
||||
| `XASH3D_BASEDIR` | _string_ | Sets path to base (root) directory, instead of current working directory |
|
||||
| `XASH3D_RODIR` | _string_ | Sets path to read-only base (root) directory. Ignored if `-rodir` command line argument is set |
|
||||
| `XASH3D_EXTRAS_PAK1` | _string_ | Archive file from specified path will be added to virtual filesystem search path in the lowest possible priority |
|
||||
| `XASH3D_EXTRAS_PAK2` | _string_ | Similar to `XASH3D_EXTRAS_PAK1` but next to it in priority list |
|
||||
|
||||
Environment variables NOT listed in the table above are used internally, and aren't considered as stable interface.
|
||||
|
||||
#### mdldec
|
||||
|
||||
| Variable | Type | Description |
|
||||
| --------------------- | ---------- | ----------- |
|
||||
| `MDLDEC_ACT_PATH` | _string_ | If set, will read activities list from this path |
|
||||
@@ -1,8 +0,0 @@
|
||||
# Expanded structures that used by engine and mods
|
||||
To make porting and developing mods on 64-bit platforms less painful, we decided to expand size of several structures.
|
||||
This information important in case you are using codebase like XashXT, Paranoia 2: Savior and want to compile your mod for platform with 64-bit pointer size: you should replace old definitions with new ones, otherwise your mod will not work with Xash3D FWGS (typically, it's just crashing when starting map).
|
||||
| Structure name | Locates in file | Original size on 64-bit | Current size on 64-bit |
|
||||
|----------------|-----------------|-------------------------|------------------------|
|
||||
|`mfaceinfo_t` | `common/com_model.h` | 176 bytes | 304 bytes |
|
||||
|`decal_s` | `common/com_model.h` | 72 bytes | 88 bytes |
|
||||
|`mextrasurf_t` | `common/com_model.h` | 376 bytes | 504 bytes |
|
||||
@@ -31,14 +31,11 @@ Issue #0. Inconsistency between ABI and Q_buildarch.\
|
||||
Resolution: Change Q_buildarch return value to use Debian-styled architectures list: https://www.debian.org/ports/, which includes a special naming for big/little-endian and hard/soft-float ARM.
|
||||
|
||||
Issue #1: Build-system integration.\
|
||||
Resolution: implemented as [LibraryNaming.cmake](https://github.com/FWGS/hlsdk-portable/blob/master/cmake/LibraryNaming.cmake) and [library_naming.py](https://github.com/FWGS/hlsdk-portable/blob/master/scripts/waifulib/library_naming.py) extensions, see
|
||||
Resolution: implemented as [LibraryNaming.cmake](https://github.com/FWGS/hlsdk-xash3d/blob/master/cmake/LibraryNaming.cmake) and [library_naming.py](https://github.com/FWGS/hlsdk-xash3d/blob/master/scripts/waifulib/library_naming.py) extensions, see
|
||||
|
||||
Issue #2(related to #0): Which ARM flavours we actually need to handle?\
|
||||
Resolution: Little-endian only, as there is no known big-endian ARM platforms in the wild.
|
||||
Architecture is coded this way:
|
||||
* ```armvxy```, where `x` is ARM instruction set level and `y` is hard-float ABI presence: `hf` where hard float ABI used, otherwise `l`.
|
||||
|
||||
Issue #3: Some mods (like The Specialists, Tyrian, ...) already apply suffixes _i386, _i686 to the gamedll path:\
|
||||
Resolution: On x86 on **Win/Lin/Mac**, don't change anything. Otherwise, strip the _i?86 part and follow the usual scheme.
|
||||
|
||||
See discussion: https://github.com/FWGS/xash3d-fwgs/issues/39
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
## Looping MP3 extension
|
||||
|
||||
It is now possible to loop MP3 file in Xash3D FWGS by adding a custom text tag with `LOOP_START` or `LOOPSTART` in description and time point (in raw samples) in value.
|
||||
|
||||
### Example with foobar2000
|
||||
1. Open Foobar2000
|
||||
2. Add your .mp3 file to playlist
|
||||
3. Right click to newly added file and select Properties
|
||||
4. In Metadata tab, at the bottom of the table, select "+add new"
|
||||
5. In newly added line replace `<60>input field name<6D>` with `LOOP_START` (without any symbols).
|
||||
6. Press Tab and enter loop time point in raw samples. For example, `0` will replay sound file from beginning to end indefinitely.
|
||||
|
||||
### Possible alternatives
|
||||
1. Classic WAV files looping. HQ WAV files can take too much disk space, and recommended software supporting cue points is paid, outdated and can't run on modern systems. (Although there is alternative that's proven to work with idTech-based engines called LoopAuditioneer.)
|
||||
2. Vorbis looping through comment. Engine doesn't support Vorbis but this extension was highly inspired by this hack.
|
||||
|
||||
### Known bugs and limitations
|
||||
1. At this time using MP3 as SFX requires complete decoding. This can cause noticeable stutters, so keep MP3 file length in mind.
|
||||
2. We deliberately only support modern ID3v2.3 and ID3v2.4 tags. Using ID3v1 is not possible.
|
||||
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# GetNativeObject API
|
||||
|
||||
To be able to use platform-specific features or get optional engine interfaces, we've added a simple call to MobilityAPI on client DLL and PhysicsAPI for server DLL and extended MenuAPI for menu DLL.
|
||||
|
||||
It's defined like this:
|
||||
|
||||
```
|
||||
void *pfnGetNativeObject( const char *name );
|
||||
```
|
||||
|
||||
#### Cross-platform objects
|
||||
|
||||
Only these objects are guaranteed to be available on all targets.
|
||||
|
||||
| Object name | Interface |
|
||||
|-------------|-----------|
|
||||
| `VFileSystem009` | Provides C++ interface to filesystem, binary-compatible with Valve's VFileSystem009. |
|
||||
| `XashFileSystemXXX` | Provides C interface to filesystem. This interface is unstable and not recommended for generic use, outside of engine internals. For more info about current version look into `filesystem.h`. |
|
||||
|
||||
#### Android-specific objects
|
||||
|
||||
| Object name | Interface |
|
||||
|-------------|-----------|
|
||||
| `JNIEnv` | Allows interfacing with Java Native Interface. |
|
||||
| `ActivityClass` | Returns JNI object for engine Android activity class. |
|
||||
@@ -1,65 +0,0 @@
|
||||
# sounds.lst.md
|
||||
|
||||
Using sounds.lst located in scripts folder, modder can override some of the hardcoded sounds in temp entities and server physics.
|
||||
|
||||
File format:
|
||||
```
|
||||
<group name>
|
||||
{
|
||||
<path1>
|
||||
<path2>
|
||||
<path3>
|
||||
}
|
||||
|
||||
<group2 name> <path with %d> <min number> <max number>
|
||||
```
|
||||
|
||||
* Sounds can use any supported sound format (WAV or MP3).
|
||||
* The path must be relative to the sounds/ folder in the game or base directory root, addon folder, or archive root.
|
||||
* Groups can be empty or omitted from the file to load no sound.
|
||||
* Groups can either list a set of files or specify a format string and a range.
|
||||
* Anything after // will be considered a comment and ignored.
|
||||
* Behavior is undefined if the group was listed multiple times.
|
||||
|
||||
Currently supported groups are:
|
||||
|Group name|Usage|
|
||||
|----------|-----|
|
||||
|`BouncePlayerShell`|Used for BOUNCE_SHELL tempentity hitsound|
|
||||
|`BounceWeaponShell`|Used for BOUCNE_SHOTSHELL tempentity hitsound|
|
||||
|`BounceConcrete`|Used for BOUNCE_CONCRETE tempentity hitsound|
|
||||
|`BounceGlass`|Used for BOUCNE_GLASS|
|
||||
|`BounceMetal`|Used for BOUNCE_METAL|
|
||||
|`BounceFlesh`|Used for BOUNCE_FLESH|
|
||||
|`BounceWood`|Used for BOUNCE_WOOD|
|
||||
|`Ricochet`|Used for BOUNCE_SHRAP and ricochet tempentities|
|
||||
|`Explode`|Used for tempentity explosions|
|
||||
|`EntityWaterEnter`|Used for entity entering water|
|
||||
|`EntityWaterExit`|Used for entity exiting water|
|
||||
|`PlayerWaterEnter`|Used for player entering water|
|
||||
|`PlayerWaterExit`|Used for player exiting water|
|
||||
|
||||
## Example
|
||||
|
||||
This example is based on defaults sounds used in Half-Life:
|
||||
|
||||
```
|
||||
BouncePlayerShell "player/pl_shell%d.wav" 1 3
|
||||
BounceWeaponShell "weapons/sshell%d.wav" 1 3
|
||||
BounceConcrete "debris/concrete%d.wav" 1 3
|
||||
BounceGlass "debris/glass%d.wav" 1 4
|
||||
BounceMetal "debris/metal%d.wav" 1 6
|
||||
BounceFlesh "debris/flesh%d.wav" 1 7
|
||||
BounceWood "debris/wood%d.wav" 1 4
|
||||
Ricochet "weapons/ric%d.wav" 1 5
|
||||
Explode "weapons/explode%d.wav" 3 5
|
||||
EntityWaterEnter "player/pl_wade%d.wav" 1 4
|
||||
EntityWaterExit "player/pl_wade%d.wav" 1 4
|
||||
PlayerWaterEnter
|
||||
{
|
||||
"player/pl_wade1.wav"
|
||||
}
|
||||
PlayerWaterExit
|
||||
{
|
||||
"player/pl_wade2.wav"
|
||||
}
|
||||
```
|
||||
@@ -1,117 +0,0 @@
|
||||
# Game definition and information file
|
||||
|
||||
gameinfo.txt is an essential part of any Xash3D based game. It allows basic customization for games creators, like setting game title, DLL paths, etc.
|
||||
|
||||
This document defines gameinfo.txt syntax, supported keys and liblist.gam conversion rules for the latest version of the engine. Note for engine developers, keep this document in sync with an implementation.
|
||||
|
||||
## gameinfo.txt syntax
|
||||
|
||||
* gameinfo.txt is a simple list of keys and values, separated by newline.
|
||||
* You can add single line comments using double slashes (//).
|
||||
* Keys can accept integer, float, string or boolean values.
|
||||
* Boolean keys use 0 as false and 1 as true value.
|
||||
* To have spaces in string values, you must enclose them in double quotes. Then, to have double quotes, you must escape it with backslash, and to have a backslash you need to use double backslashes.
|
||||
|
||||
The example:
|
||||
```
|
||||
// this is a comment :)
|
||||
// this is another comment
|
||||
some_integer_key 123
|
||||
|
||||
this_is_float_key 13.37 // optional comment
|
||||
|
||||
enable_feature 1 // boolean, 1 to enable, 0 to disable
|
||||
|
||||
example_string_key string_value
|
||||
example_spaces "string with spaces"
|
||||
example_title "Fate\\Stay Night" // engine will parse it as Fate\Stay Night
|
||||
```
|
||||
|
||||
## gameinfo.txt keys
|
||||
|
||||
This is a list of all gameinfo.txt keys supported by the engine. Be aware that the engine will silently skip all unrecognized keys.
|
||||
|
||||
| Key | Type | Default value | Description |
|
||||
| ---------------- | ---------- | --------------- | ----------- |
|
||||
| `ambient0` | string | Empty string | Automatic ambient sound |
|
||||
| `ambient1` | string | Empty string | Automatic ambient sound |
|
||||
| `ambient2` | string | Empty string | Automatic ambient sound |
|
||||
| `ambient3` | string | Empty string | Automatic ambient sound |
|
||||
| `basedir` | string | `valve` | Game base directory, used to share assets between games |
|
||||
| `date` | string | Empty string | Game release date. Unused. |
|
||||
| `dllpath` | string | `cl_dlls` | Game DLL path. Engine will search custom DLLs (client or menu, for example) in this directory, except `gamedll`, see below. |
|
||||
| `fallback_dir` | string | Empty string | Additional game base directory |
|
||||
| `gamedir` | string | Current gamedir | Game directory, ignored in FWGS, as game directory is defined by the game directory name |
|
||||
| `gamedll` | string | `dlls/hl.dll` | Game server DLL for 32-bit x86 Windows (see LibraryNaming.md for details) |
|
||||
| `gamemode` | string | Empty string | Game type. When set to `singleplayer_only` or `multiplayer_only` marks the game as SP or MP only respectively, hiding the option in game UI. Omitting this key or using custom values mark the game as both MP and SP compatible. |
|
||||
| `icon` | string | `game.ico` | Game icon. Engine will automatically append .ico and may automatically switch to .tga icon as well |
|
||||
| `max_beams` | integer | 128 | Beams limit, 64 min, 512 max |
|
||||
| `max_edicts` | integer | 900 | Entities limit, 600 min, 8192 max (protocol limit). In FWGS, minimum is 64. |
|
||||
| `max_particles` | integer | 4096 | Particles limit, 1024 min, 131072 max |
|
||||
| `max_tempents` | integer | 500 | Temporary entities limit. 300 min, 2048 max |
|
||||
| `mp_entity` | string | `info_player_deathmatch` | Entity used to mark maps as multiplayer |
|
||||
| `mp_filter` | string | Empty string | When set, used to filter multiplayer maps instead of `mp_entity`.<br>If the map name starts with the same characters as this filter, it's considered a multiplayer map |
|
||||
| `nomodels` | boolean | 0 | When set to 1, disallows changing player model in UI |
|
||||
| `noskills` | boolean | 0 | When set to 1, disallows selection of game difficulty |
|
||||
| `secure` | boolean | 0 | When set to 1, original Unkle Mike's engine will completely disable developer mode. FWGS ignores but preserves this value for compatibility. |
|
||||
| `size` | integer | 0 | Game directory size in bytes, used in Change Game dialog only |
|
||||
| `startmap` | string | `c0a0` | The name of the map used in new game |
|
||||
| `sp_entity` | string | `info_player_start` | Entity used to mark map as single player. Used in map validation |
|
||||
| `title` | string | `New Game` | Game title, used in window title, default server name, etc. |
|
||||
| `trainmap` | string | `t0a0` | The name of the training map (Hazard Course) |
|
||||
| `type` | string | Empty string | Game type, used in Change Game UI. |
|
||||
| `url_info` | string | Empty string | Game homepage URL, used in Change Game UI |
|
||||
| `url_update` | string | Empty string | Game updates URL, used in Settings UI |
|
||||
| `version` | float | 1.0 | Game version, used in Change Game dialog and in server info |
|
||||
|
||||
## FWGS-specific gameinfo.txt keys
|
||||
|
||||
These strings are specific to Xash3D FWGS.
|
||||
|
||||
| Key | Type | Default value | Description |
|
||||
| ----------------------- | ---------- | ------------------------ | ----------- |
|
||||
| `animated_title` | boolean | 0 | Use animated title in main menu (WON Half-Life logo.avi imitation from Half-Life 25-th anniversary update)
|
||||
| `autosave_aged_count` | integer | 2 | Auto saves limit used in saves rotation |
|
||||
| `gamedll_linux` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 Linux (see LibraryNaming.md for details) |
|
||||
| `gamedll_osx` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 macOS (see LibraryNaming.md for details) |
|
||||
| `hd_background` | boolean | 0 | Use HD background for main menu (Half-Life 25-th anniversary update) |
|
||||
| `internal_vgui_support` | boolean | 0 | Only for programmers! Required to be set as 1 for PrimeXT!<br>When set to 1, the engine will not load vgui_support DLL, as VGUI support is done (or intentionally ignored) on the game side. |
|
||||
| `render_picbutton_text` | boolean | 0 | When set to 1, the UI will not use prerendered `btns_main.bmp` and dynamically render them instead |
|
||||
| `quicksave_aged_count` | integer | 2 | Quick saves limit used in saves rotation |
|
||||
| `demomap` | string | Empty string | The name of the demo chapter map (Half-Life Uplink) |
|
||||
|
||||
## Note on GoldSrc liblist.gam support
|
||||
|
||||
As Xash3D accidentally supports GoldSrc games, it also supports parsing liblist.gam.\
|
||||
Xash3D will use this file if gameinfo.txt is absent, or if its modification timestamp is older than liblist.gam.
|
||||
|
||||
For game creators who plan supporting only Xash3D, using this file is not recommended.
|
||||
|
||||
The table below defines conversion rules from liblist.gam to gameinfo.txt. Some keys' interpretation does differ from `gameinfo.txt`, in this case a note will be left. If `liblist.gam` key isn't present in this table, it's ignored.
|
||||
|
||||
| `liblist.gam` key | `gameinfo.txt` key | Note |
|
||||
| ----------------- | ------------------ | ---- |
|
||||
| `animated_title` | `animated_title` | |
|
||||
| `edicts` | `max_edicts` | |
|
||||
| `fallback_dir` | `fallback_dir` | |
|
||||
| `game` | `title` | |
|
||||
| `gamedir` | `gamedir` | |
|
||||
| `gamedll` | `gamedll` | |
|
||||
| `gamedll_linux` | `gamedll_linux` | |
|
||||
| `gamedll_osx` | `gamedll_osx` | |
|
||||
| `hd_background` | `hd_background` | |
|
||||
| `icon` | `icon` | |
|
||||
| `mpentity` | `mp_entity` | |
|
||||
| `mpfilter` | `mp_filter` | |
|
||||
| `nomodels` | `nomodels` | |
|
||||
| `secure` | `secure` | In GoldSrc it's used to mark the multiplayer game as anti-cheat enabled.<br>Original Xash3D misinterprets its value for disallowing console and developer mode.<br>FWGS ignores this key but preserves for compatibility. |
|
||||
| `startmap` | `startmap` | |
|
||||
| `size` | `size` | |
|
||||
| `trainingmap` | `trainmap` | |
|
||||
| `trainmap` | `trainmap` | |
|
||||
| `type` | `type` & `gamemode`| In `liblist.gam` this key works as both `type` and `gamemode`.<br>If value is `singleplayer_only` or `multiplayer_only` the game is marked as SP or MP only, and `gameinfo.txt` type set to `Single` or `Multiplayer`.<br>Any custom value will mark the game as both SP and MP compatible, and type is set to whatever custom value. |
|
||||
| `url_dl` | `url_update` | |
|
||||
| `url_info` | `url_info` | |
|
||||
| `version` | `version` | |
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Support for GoldSrc network protocol
|
||||
This feature is still work-in-progress, but for now it's available for all users, and we appreciate any bug-reports and contributions around it.
|
||||
|
||||
For connecting to GoldSrc-based servers, use this command:
|
||||
```
|
||||
connect ip:port gs
|
||||
```
|
||||
|
||||
But keep in mind, there are requirement for server to be able to accept connections from Xash3D-based clients: it should accept HLTV connections.
|
||||
Without this requirement, you will just get "Steam validation rejected" error on connecting.
|
||||
|
||||
That is because proper authorization with Steam API is not implemented in engine yet (but we have plans on it).
|
||||
|
||||
In case of ReHLDS with Reunion plugin, by default it rejects HLTV clients. But connections from HLTV can be easily enabled in `reunion.cfg` file.
|
||||
@@ -1,40 +0,0 @@
|
||||
### HD (external) textures support
|
||||
|
||||
Xash3D supports loading texture replacements in TGA format for almost all types of models in the game, except alias models at this time.
|
||||
|
||||
Textures are expected to be located at:
|
||||
* `modfolder/materials/<mapname>` - for a specific map
|
||||
* `modfolder/materials/common` - common for all maps
|
||||
* `modfolder/materials/decals` - for decals
|
||||
* `modfolder/materials/models/<model>` - for models (texture name must match the internal texture name in the model)
|
||||
|
||||
Support for high-resolution textures is enabled setting `host_allow_materials` cvar to `1` or in the menu, in "Video options" section.
|
||||
|
||||
#### Xash3D FWGS additions
|
||||
|
||||
In addition to paths above, Xash3D FWGS checks following paths:
|
||||
|
||||
* `modfolder/materials/sprites/<sprite>` - for sprites, except HUD sprites
|
||||
|
||||
Also, to check which texture replacements are loaded successfully, failed or weren't found, a mod developer can set `host_allow_materials` cvar value to `2`. The engine will spew log at any developer level in the following format:
|
||||
|
||||
```
|
||||
Looking for <replacement> replacement... <status code> (<path relative to mod directory>)
|
||||
```
|
||||
|
||||
Status codes:
|
||||
* `OK` - texture replacement file was found and loaded into GPU memory successfully
|
||||
* `FAIL` - texture file was found but hasn't been parsed or loaded successfully. Refer to engine log for more details.
|
||||
* `MISS` - texture file wasn't found
|
||||
|
||||
Example:
|
||||
```
|
||||
Looking for maps/bounce.bsp:!waterblue tex replacement...OK (materials/common/!waterblue.tga)
|
||||
Looking for maps/bounce.bsp:!waterblue_luma tex replacement...MISS (not found)
|
||||
Looking for {shot2 decal replacement...MISS (materials/decals/{shot2.tga)
|
||||
Looking for {shot4 decal replacement...MISS (materials/decals/{shot4.tga)
|
||||
Looking for {shot3 decal replacement...MISS (materials/decals/{shot3.tga)
|
||||
Looking for models/gman tex replacement...FAIL (materials/models/gman/GMan_Case1.tga)
|
||||
Looking for models/gman tex replacement...FAIL (materials/models/gman/inside_1.tga)
|
||||
```
|
||||
|
||||
@@ -1,40 +1,7 @@
|
||||
# Self-made port
|
||||
## Compatibility with RISC architectures
|
||||
### Unaligned access
|
||||
Unaligned access on **i386** causes only performance penalty, but on **RISC** it can cause unstable work.
|
||||
|
||||
For HLSDK at least you need such patches in util.cpp:
|
||||
- https://github.com/FWGS/halflife/commit/7bfefe86e35d67867ae7af830ac1fc38f2908360
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/617d75545f2ecb9b2d46cc30728dc37c9eb6d35e
|
||||
|
||||
### Signed chars
|
||||
`char` type defined as **signed** for **x86** and as **unsigned** for **arm**.
|
||||
|
||||
And sometimes such difference can break logic.
|
||||
|
||||
As a solution you can use `signed char` type in code directly or use `-fsigned-char` option for gcc/clang compilers.
|
||||
|
||||
For HLSDK at least you need such [fix](https://github.com/FWGS/hlsdk-portable/commit/1ca34fcb4381682bd517612b530db22a1354a795) in nodes.cpp/.h.
|
||||
|
||||
## Compatibility with 64bit architectures
|
||||
You need list of patches for Studio Model Render, MAKE_STRING macro and nodes:
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/d287ed446332e615ab5fb25ca81b99fa14d18a73
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/3bce17e3a04f8af10a927a07ceb8ab0f09152ec4
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/9ebfc981773ec4c7a89ffe52d9c249e1fbef9634
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/00833188dab87ef5746286479ba5aeb9d83b4a0c
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/4661b5c1a5245b27a5532745c11e44b5540e4172
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/2b61380146b1d58a8c465f0e312c061b12bda115
|
||||
- https://github.com/FWGS/hlsdk-portable/commit/8ef6cb2427ee16a763103bd3f315f38e2f01cfe2
|
||||
|
||||
## Mobility API
|
||||
Xash3D FWGS has special extended interface in `mobility_int.h` which adds some new features like vibration on mobile platforms.
|
||||
|
||||
## Porting server-side code
|
||||
# Server porting
|
||||
Original valve's server code was compatible with linux and gcc 2.x.
|
||||
|
||||
Newer gcc versions have restriction which breaks build.
|
||||
|
||||
Now, to make it building with gcc 4.x+ or clang, you need to do following:
|
||||
Now, to make it building with gcc 4.x, you need do following:
|
||||
* Go to cbase.h and redefine macros as following
|
||||
```
|
||||
#define SetThink( a ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (&a)
|
||||
@@ -51,60 +18,58 @@ Now, to make it building with gcc 4.x+ or clang, you need to do following:
|
||||
* Replace all SetThink(NULL), SetTouch(NULL), setUse(NULL) and SetBlocked(NULL) by ResetThink(), ResetTouch(), ResetUse() and ResetBlocked()
|
||||
* Sometimes you may need to add #include <ctype.h> if functions tolower or isspace are missing
|
||||
|
||||
## Porting client-side code
|
||||
# Client porting
|
||||
|
||||
## VGUI library
|
||||
|
||||
Valve's client uses vgui library which is available only on x86 systems and has big amount of mistakes in headers. The best and simplest way of porting is removing VGUI dependency at all.
|
||||
Most singleplayer mods don't really use VGUI at all. It is used in multiplayer only to show score table and MOTD window
|
||||
|
||||
## Porting
|
||||
|
||||
### First strategy: full port
|
||||
|
||||
#### Basic port (Stage 1)
|
||||
* First, remove all files and headers which use vgui (contains "vgui" in file name).
|
||||
* After that, try to build it and remove vgui includes.
|
||||
* Remove all gViewPort usings.
|
||||
* Remove all CVoiceManager usings (xash3d does not support voice)
|
||||
* Redefine all DLLEXPORT defines as empty field (Place it under _WIN32 macro if you want to keep windows compatibility).
|
||||
* Remove hud_servers.cpp and Servers_Init/Servers_Shutdown from hud.cpp.
|
||||
* Remove hud_servers.cpp and Servers_Init/Servers_Shutdown from hud.cpp
|
||||
* Fix CAPS filenames in includes (like STDIO.H, replace by stdio.h).
|
||||
* Replace broken macros as DECLARE_MESSAGE, DECLARE_COMMAND by fixed examples from our hlsdk-portable port (cl_util.h).
|
||||
* Add ctype.h where is needed (tolower, isspace functions).
|
||||
* Add string.h where is needed (memcpy, strcpy, etc).
|
||||
* Use in_defs.h from hlsdk-portable.
|
||||
* Add input_xash3d.cpp from hlsdk-portable project to fix input.
|
||||
* Replace broken macros as DECLARE_MESSAGE, DECLARE_COMMAND by fixed examples from our hlsdk-xash3d port (cl_util.h)
|
||||
* Add ctype.h where it is need (tolower, isspace functions)
|
||||
* Add string.h where it is need (memcpy, strcpy, etc)
|
||||
* Use in_defs.h from hlsdk_client
|
||||
* Add scoreboard_stub.cpp and input_stub.cpp from hlsdk-xash3d to fix linking.
|
||||
Now your client should be able to build and work correctly. Add input_xash3d.cpp from hlsdk-xash3d project to fix input.
|
||||
|
||||
Now your client should be able to build and work correctly.
|
||||
#### Multiplayer fix (Stage 2)
|
||||
Look at hlsdk-xash3d project.
|
||||
|
||||
# Porting mod to hlsdk-portable
|
||||
Look at changes which was made.
|
||||
Main changes are:
|
||||
* Add MOTD.cpp, scoreboard.cpp and input_xash3d.cpp
|
||||
* Add missing functions to hud_redraw.cpp, hud.cpp and tri.cpp, fix class defination in hud.h
|
||||
* Remove duplicate functions from hud.cpp and HOOK_MESSAGE's for it
|
||||
* Remove +showscores/-showscores hooks from input.h
|
||||
* Fix cl_util.h
|
||||
|
||||
If there are not too much changes (for example, only some weapons was added), add these changes in hlsdk-portable.
|
||||
### Second way: move mod to hlsdk-xash3d
|
||||
Look at changes you made in client.
|
||||
|
||||
You can use diff with original HLSDK and apply it as patch to hlsdk-portable.
|
||||
If there are not much changes (for example, only some weapons was add), add these changes in hlsdk-xash3d.
|
||||
|
||||
You may use diff with original HLSDK you used and apply it as patch to hlsdk-xash3d.
|
||||
|
||||
```
|
||||
NOTE: Many an old mods was made on HLSDK 2.0-2.1 and some rare mods on HLSDK 1.0.
|
||||
So you need to have different versions of HLSDK to make diffs.
|
||||
Plus different Spirit of Half-Life versions if mod was made on it.
|
||||
Also, weapons in old HLSDK versions does not use client weapon prediction system and you may be need to port standart half-life weapons to server side.
|
||||
```
|
||||
Files must have same line endings (use dos2unix on all files).
|
||||
|
||||
We recommend to enable ignoring space changes in diff.
|
||||
I recommend to enable ignoring space changes in diff.
|
||||
### Writing Makefiles
|
||||
|
||||
Move all new files to separate directories.
|
||||
Use Makefile from hlsdk-xash3d as Makefile example.
|
||||
|
||||
# Possible replacements for non-portable external dependencies
|
||||
1. If mod uses **fmod.dll** or **base.dll** to play mp3/ogg on client-side or to precache sounds on server-side, you can replace it with:
|
||||
- [pfnPrimeMusicStream](https://github.com/FWGS/hlsdk-portable/blob/master/engine/cdll_int.h#L293=) engine callback;
|
||||
- [miniaudio](https://github.com/mackron/miniaudio);
|
||||
- [phonon](https://community.kde.org/Phonon).
|
||||
Get .c and .cpp file lists from Visual Studio project and fill SRCS and SRCS_C variables to Makefile.
|
||||
|
||||
2. If mod uses **OpenGL**, porting code to Xash3D render interface is recommended.
|
||||
|
||||
3. If mod uses **cg.dll**, you can try to port code to [NVFX](https://github.com/tlorach/nvFX).
|
||||
|
||||
4. If mod uses detours, comment code or try to find replacement somehow by yourself.
|
||||
|
||||
# Additional recommendations
|
||||
1. If mod uses STL, you can replace it with [MiniUTL](https://github.com/FWGS/MiniUTL).
|
||||
2. Avoid to use dynamic casts to make small size binaries.
|
||||
3. Avoid to use exceptions to make small size binaries.
|
||||
|
||||
# Writing build scripts
|
||||
|
||||
Use wscript/CMakeLists.txt files from hlsdk-portable as build scripts example.
|
||||
|
||||
Get .c and .cpp file lists from Visual Studio project.
|
||||
|
||||
Add missing include dirs.
|
||||
Remove all files containing vgui in name from list, add missing include dirs.
|
||||
|
||||
Do same for Android.mk if you are building for android.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# Xash3D FWGS on `musl`
|
||||
|
||||
Xash3D FWGS works on `musl` out of the box. However, the engine doesn't try to differentiate glibc and musl anymore. If you see error similar to:
|
||||
|
||||
```
|
||||
Host_InitError: can't initialize cl_dlls/client.so: Error relocating valve/cl_dlls/client.so: __sprintf_chk: symbol not found
|
||||
```
|
||||
|
||||
... or you know that the game you're running is linked against glibc, you can try using `libgcompat`, like this:
|
||||
|
||||
```
|
||||
$ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ...
|
||||
```
|
||||
|
||||
It will automatically add the missing symbols that glibc binaries usually need. In the future we might automatically link engine against `libgcompat` for better compatibility with prebuilt or closed-source games, if there will be any use for this.
|
||||
@@ -7,5 +7,6 @@
|
||||
|Counter Strike: Condition Zero |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||
|Counter Strike: Condition Zero - Deleted scenes |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||
|Day of Defeat |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||
|Sven-Coop |5.0+ |Uses custom GoldSrc engine |
|
||||
|Sven-Coop |5.0+ |Uses filesystem_stdio library which xash3d does not support |filesystem_stdio replacement already was made: https://github.com/FWGS/filesystem_stdio_xash
|
||||
|XDM |3.0.4.0 | |
|
||||
|
||||
|
||||
@@ -17,9 +17,7 @@ Mirrored on github - https://github.com/JoelTroch/am_src_rebirth
|
||||
Mirrored on github - https://github.com/nekonomicon/BattleGrounds
|
||||
|
||||
## Bubblemod
|
||||
Download page on official site(WM snapshot) - [http://www.bubblemod.org/dl_default.php](https://web.archive.org/web/20130717133158/http://www.bubblemod.org/dl_default.php)
|
||||
|
||||
Mirrored on github - https://github.com/HLSources/BubbleMod
|
||||
Download page on official site - http://www.bubblemod.org/dl_default.php
|
||||
|
||||
## Chicken Fortress
|
||||
Official github repository - https://github.com/CKFDevPowered/CKF3Alpha
|
||||
@@ -27,11 +25,6 @@ Official github repository - https://github.com/CKFDevPowered/CKF3Alpha
|
||||
## Cold Ice
|
||||
Version 1.9 is available on ModDB - https://www.moddb.com/mods/cold-ice/downloads/cold-ice-sdk
|
||||
|
||||
Version 1.9 mirrored on github - https://github.com/solidi/hl-mods/tree/master/ci
|
||||
|
||||
## Cold Ice Ressurection
|
||||
Mirrored on github - https://github.com/solidi/hl-mods/tree/master/cir
|
||||
|
||||
## Cthulhu
|
||||
Uploaded to github by Oleg Cherkasky - https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK
|
||||
|
||||
@@ -45,36 +38,25 @@ Official github repository - https://github.com/adslbarxatov/xash3d-for-ESHQ
|
||||
Available on GamerLab - http://gamer-lab.com/eng/code_mods_goldsrc/Half-Life_2D_(Flat-Life)
|
||||
|
||||
## Gang Wars
|
||||
Mirrored on github - https://github.com/nekonomicon/gw1.45src
|
||||
Mirrored on github - https://github.com/hammermaps/gw1.45src
|
||||
|
||||
## Go-mod
|
||||
Versions 2.0 and 3.0, available in mod archives on ModDB - https://www.moddb.com/mods/go-mod/downloads
|
||||
|
||||
Version 3.0, mirrored on github - https://github.com/nekonomicon/Go-mod30
|
||||
|
||||
## GT mod
|
||||
Available on GamerLab - http://gamer-lab.com/eng/code_mods_goldsrc/GT_mod_(Polnie_ishodniki)
|
||||
|
||||
## Half-Life: Advanced Deathmatch
|
||||
Mirrored on github - https://github.com/solidi/hl-mods/tree/master/hla
|
||||
|
||||
## Half-Life: Decay
|
||||
Mirrored on github(PC Port) - https://github.com/hoaxer/Half-Life-Decay
|
||||
|
||||
## Half-Life: Echoes
|
||||
Available on ModDB - https://www.moddb.com/mods/half-life-echoes
|
||||
Download link on dropbox - https://www.dropbox.com/s/s6j8gtegn10wgvj/dlls.zip?dl=1
|
||||
|
||||
## Half-Life: Expanded Arsenal
|
||||
Available on ModDB - https://www.moddb.com/mods/half-life-expanded-arsenal
|
||||
|
||||
## Half-Life: Gravgun mod
|
||||
Branch **gravgun** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/gravgun
|
||||
Branch **gravgun** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/gravgun
|
||||
|
||||
## Half-Life: Invasion
|
||||
Official github repository - https://github.com/jlecorre/hlinvasion
|
||||
|
||||
## Half-Life: Pong
|
||||
Mirrored on github - https://github.com/solidi/hl-mods/tree/master/pong
|
||||
official github repository - https://github.com/jlecorre/hlinvasion
|
||||
|
||||
## Half-Life: Quest Mode
|
||||
Available on cs-mapping.com.ua - https://old.cs-mapping.com.ua/forum/showthread.php?t=38030
|
||||
@@ -85,9 +67,6 @@ Official gitlab repository - https://gitlab.com/Sockman/hltopdown
|
||||
## Half-Life: Update
|
||||
Official github repository - https://github.com/Fograin/hl-subsmod-ex
|
||||
|
||||
## Half-Life: Rally
|
||||
Official gitlab repository - https://gitlab.com/hlrally/src
|
||||
|
||||
## Half-Life: Weapon Edition
|
||||
Available on ModDB - https://www.moddb.com/mods/half-life-weapon-edition/downloads/half-life-weapon-edition-1508-alpha-open-src
|
||||
|
||||
@@ -113,7 +92,7 @@ Official github repository - https://github.com/desukuran/half-screwed
|
||||
Version 1.3 on ModDB - https://www.moddb.com/mods/headcrab-frenzy/downloads/headcrab-frenzy-13-beta-source-code
|
||||
|
||||
## Heart of Evil
|
||||
Mirrored on github - https://github.com/nekonomicon/HeartOfEvil
|
||||
Available on ModDB - https://www.moddb.com/mods/heart-of-evil/downloads/heart-of-evil-dlls-source-code
|
||||
|
||||
## Ingram Chillin' Mod
|
||||
Official SourceForge repository - https://sourceforge.net/projects/icm-hl/
|
||||
@@ -130,11 +109,22 @@ Official github repository - https://github.com/unknownworlds/NS
|
||||
## Overturn
|
||||
Available in mod archive on ModDB - https://www.moddb.com/mods/overturn
|
||||
|
||||
## Oz Deathmatch
|
||||
Mirrored on github - https://github.com/nekonomicon/OZDM
|
||||
## Spirit of Half-Life
|
||||
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||
|
||||
## Threewave CTF
|
||||
*Unfinished mod by Valve Software*
|
||||
|
||||
Available in Valve's Half-Life repository with Deathmatch Classic sources - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||
|
||||
## Trinity Render
|
||||
Available on ModDB: https://www.moddb.com/mods/half-life-episode-two/downloads/trinity-rendering-engine-v308f
|
||||
|
||||
## Tyrian: Ground Assault
|
||||
Available on ModDB: https://www.moddb.com/mods/tyriangroundassault/downloads/tyrianga-v1-0-src
|
||||
|
||||
## Paranoia
|
||||
Available on ModDB - https://www.moddb.com/mods/paranoia/downloads/paranoia-toolkit
|
||||
Available on ModDB: https://www.moddb.com/mods/paranoia/downloads/paranoia-toolkit
|
||||
|
||||
## Paranoia 2: The Savior
|
||||
Prealpha, mirrored on github - https://github.com/a1batross/Paranoia2_ancient
|
||||
@@ -149,37 +139,12 @@ Was found on HLFX - http://hlfx.ru/forum/showthread.php?s=2c892dfc52f72be52a89c3
|
||||
## Ricochet
|
||||
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/ricochet
|
||||
|
||||
## Spirit of Half-Life
|
||||
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||
|
||||
## The Wastes
|
||||
Version 1.5: mirrored on code.idtech.space - https://code.idtech.space/vera/halflife-thewastes-sdk
|
||||
|
||||
## Threewave CTF
|
||||
*Unfinished mod by Valve Software*
|
||||
|
||||
Available in Valve's Half-Life repository with Deathmatch Classic sources - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||
|
||||
## Trinity Render
|
||||
Available on ModDB - https://www.moddb.com/mods/half-life-episode-two/downloads/trinity-rendering-engine-v308f
|
||||
|
||||
## Tyrian: Ground Assault
|
||||
Available on ModDB - https://www.moddb.com/mods/tyriangroundassault/downloads/tyrianga-v1-0-src
|
||||
|
||||
## Wasteland
|
||||
Mirrored on code.idtech.space - https://code.idtech.space/vera/halflife-wasteland-sdk
|
||||
|
||||
## Wizard Wars
|
||||
Download page on official site - http://www.thothie.com/ww/
|
||||
|
||||
## XashXT
|
||||
Mirrored on github - https://github.com/a1batross/XashXT_original
|
||||
|
||||
## Xen-Warrior
|
||||
*Source code is a part of Spirit of Half-Life 1.0-1.2 under XENWARRIOR macro*
|
||||
|
||||
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||
|
||||
## Zombie-X
|
||||
Available in mod archive on ModDB - https://www.moddb.com/mods/zombie-x-10-final/downloads/zombie-x-10-dle-beta6-last-version
|
||||
|
||||
@@ -190,45 +155,45 @@ Mirrored on github - https://github.com/ZXCmod/ZXCmod
|
||||
|
||||
# Reimplementation
|
||||
## Absolute Redemption
|
||||
Branch **redempt** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/redempt
|
||||
Branch **redempt** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/redempt
|
||||
|
||||
## Adrenaline Gamer
|
||||
OpenAG by YaLTeR - https://github.com/YaLTeR/OpenAG
|
||||
|
||||
## Afraid of Monsters
|
||||
malortie's recreation - https://github.com/malortie/hl-aom
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-aom
|
||||
|
||||
Branch **aom** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/aom
|
||||
Branch **aom** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/aom
|
||||
|
||||
## Afraid of Monsters: Director's cut
|
||||
Reverse-engineered code: branch **aomdc** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/aomdc
|
||||
Reverse-engineered code, branch **aomdc** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/aomdc
|
||||
|
||||
## Azure Sheep
|
||||
malortie's recreation - https://github.com/malortie/hl-asheep
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-asheep
|
||||
|
||||
Reverse-engineered code: branch **asheep** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/asheep
|
||||
Reverse-engineered code, branch **asheep** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/asheep
|
||||
|
||||
## Big Lolly
|
||||
malortie's recreation - https://github.com/malortie/hl-biglolly
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-biglolly
|
||||
|
||||
Branch **biglolly** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/biglolly
|
||||
Branch **biglolly** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/biglolly
|
||||
|
||||
## Black Ops
|
||||
malortie's recreation - https://github.com/malortie/hl-blackops
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-blackops
|
||||
|
||||
Branch **blackops** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/blackops
|
||||
Branch **blackops** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/blackops
|
||||
|
||||
## Bloody Pizza: Vendetta
|
||||
Branch **caseclosed** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/caseclosed
|
||||
Branch **caseclosed** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/caseclosed
|
||||
|
||||
## Case Closed
|
||||
Branch **caseclosed** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/caseclosed
|
||||
Branch **caseclosed** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/caseclosed
|
||||
|
||||
## Cleaner's Adventures
|
||||
Branch **CAd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/CAd
|
||||
Branch **CAd** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/CAd
|
||||
|
||||
## Counter Strike
|
||||
Reverse-engineered code of client part by a1batross - https://github.com/Velaron/cs16-client
|
||||
Reverse-engineered code of client part by a1batross - https://github.com/FWGS/cs16-client/tree/v1.32
|
||||
|
||||
Reverse-engineered code of server part by nagist - https://github.com/nagist/cs16nd
|
||||
|
||||
@@ -240,141 +205,117 @@ CSO-like Xash3D-based mod, CSMoE - https://github.com/MoeMod/CSMoE
|
||||
## Crack-Life: Campaign Mode
|
||||
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
||||
|
||||
Reverse-engineered code: branch **clcampaign** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/clcampaign
|
||||
|
||||
## Escape from the Darkness
|
||||
malortie's recreation - https://github.com/malortie/hl-eftd
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-eftd
|
||||
|
||||
Reverse-engineered code: branch **eftd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/eftd
|
||||
|
||||
## Half-Life: Black Guard
|
||||
*This mod uses dlls from Cleaner's Adventures*
|
||||
|
||||
Branch **CAd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/CAd
|
||||
Reverse-engineered code, branch **eftd** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/eftd
|
||||
|
||||
## Half-Life: Blue Shift
|
||||
Unkle Mike's recreation - https://hlfx.ru/forum/showthread.php?s=&threadid=5253
|
||||
|
||||
Reverse-engineered code: branch **bshift** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/bshift
|
||||
Reverse-engineered code, branch **bshift** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/bshift
|
||||
|
||||
## Half-Life: Induction
|
||||
Branch **induction** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/induction
|
||||
Branch **induction** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/induction
|
||||
|
||||
## Half-Life: Opposing Force
|
||||
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/hlsdk-xash3d
|
||||
|
||||
Reverse-engineered code: clean branch **opfor** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/opfor
|
||||
Reverse-engineered code, clean branch **opfor** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/opfor
|
||||
|
||||
Spirit of Half Life: Opposing-Force Edition - https://github.com/Hammermaps-DEV/SOHL-V1.9-Opposing-Force-Edition
|
||||
|
||||
## Half-Life: Rebellion
|
||||
Reverse-engineered code: branch **rebellion** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/rebellion
|
||||
|
||||
## Half-Life: Urbicide
|
||||
Branch **hl_urbicide** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/hl_urbicide
|
||||
Reverse-engineered code, branch **rebellion** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/rebellion
|
||||
|
||||
## Half-Life: Visitors
|
||||
malortie's recreation - https://github.com/malortie/hl-visitors
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-visitors
|
||||
|
||||
Reverse-engineered code: branch **visitors** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/visitors
|
||||
Reverse-engineered code, branch **visitors** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/visitors
|
||||
|
||||
## Half-Secret
|
||||
Branch **half-secret** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/half-secret
|
||||
Branch **half-secret** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/half-secret
|
||||
|
||||
## Night at the Office
|
||||
malortie's recreation - https://github.com/malortie/hl-nato
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-noffice
|
||||
|
||||
Branch **noffice** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/noffice
|
||||
Branch **noffice** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/noffice
|
||||
|
||||
## Poke 646
|
||||
malortie's recreation - https://github.com/malortie/hl-poke646
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-poke646
|
||||
|
||||
Reverse-engineered code: branch **poke646** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/poke646
|
||||
Reverse-engineered code, branch **poke646** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/poke646
|
||||
|
||||
## Poke 646: Vendetta
|
||||
malortie's recreation - https://github.com/malortie/hl-poke646-vendetta
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-poke646
|
||||
|
||||
Reverse-engineered code: branch **poke646_vendetta** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/poke646_vendetta
|
||||
Reverse-engineered code, branch **poke646_vendetta** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/poke646_vendetta
|
||||
|
||||
## Residual Life
|
||||
Reverse-engineered code: branch **residual_point** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/residual_point
|
||||
Reverse-engineered code, branch **residual_point** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/residual_point
|
||||
|
||||
## Residual Point
|
||||
Reverse-engineered code: branch **residual_point** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/residual_point
|
||||
|
||||
## Sewer Beta
|
||||
Branch **sewer_beta** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sewer_beta
|
||||
Reverse-engineered code, branch **residual_point** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/residual_point
|
||||
|
||||
## Team Fortress Classic
|
||||
Reverse-engineered code by Velaron - https://github.com/Velaron/tf15-client
|
||||
|
||||
## The Gate
|
||||
malortie's recreation - https://github.com/malortie/hl-thegate
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-TheGate
|
||||
|
||||
Reverse-engineered code: branch **thegate** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/thegate
|
||||
Reverse-engineered code, branch **thegate** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/thegate
|
||||
|
||||
## They Hunger
|
||||
malortie's recreation - https://github.com/malortie/hl-theyhunger
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-Hunger
|
||||
|
||||
Reverse-engineered code: branch **theyhunger** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/theyhunger
|
||||
Reverse-engineered code, branch **theyhunger** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/theyhunger
|
||||
|
||||
They Hunger: Tactical - https://www.moddb.com/mods/they-hunger-tactical/downloads/tht-source-code-documentation
|
||||
|
||||
## Times of Troubles
|
||||
malortie's recreation - https://github.com/malortie/hl-tot
|
||||
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-tot
|
||||
|
||||
Branch **tot** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/tot
|
||||
Branch **tot** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/tot
|
||||
|
||||
# Derived work
|
||||
## Adrenaline Gamer
|
||||
Branch **aghl** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/aghl
|
||||
Branch **aghl** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/aghl
|
||||
|
||||
## Bubblemod
|
||||
Branch **bubblemod** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/bubblemod
|
||||
Branch **bubblemod** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/bubblemod
|
||||
|
||||
## Deathmatch Classic
|
||||
Deathmatch Classic: Adrenaline Gamer Edition - https://github.com/martinwebrant/agmod/tree/master/src/dmc
|
||||
|
||||
Deathmatch Quaked - https://www.moddb.com/games/deathmatch-classic/downloads/dmq2
|
||||
|
||||
Branch **dmc** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/dmc
|
||||
Branch **dmc** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/dmc
|
||||
|
||||
## Half-Life: Echoes
|
||||
Branch **echoes** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/echoes
|
||||
Branch **echoes** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/echoes
|
||||
|
||||
## Half-Life: Invasion
|
||||
Port to HLSDK 2.4 by malortie - https://github.com/malortie/hl-invasion
|
||||
Port to HLSDK 2.4 by malortie - https://github.com/malortie/halflife/tree/mod-hl-invasion
|
||||
|
||||
Port to Linux by fmoraw - https://github.com/fmoraw/hlinvasion
|
||||
|
||||
Branch **invasion** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/invasion
|
||||
|
||||
## Half-Life: Top-Down
|
||||
Branch **hltopdown** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/hltopdown
|
||||
Branch **hltopdown** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/hltopdown
|
||||
|
||||
## Half-Screwed
|
||||
Branch **half-screwed** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/half-screwed
|
||||
Branch **half-screwed** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/half-screwed
|
||||
|
||||
## Natural Selection
|
||||
Port to Linux - https://github.com/fmoraw/NS
|
||||
|
||||
## Spirit of Half-Life
|
||||
Version 1.2: branch **sohl1.2** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sohl1.2
|
||||
|
||||
## Swiss Cheese Halloween 2002
|
||||
Just more playable version by malortie - https://github.com/malortie/hl-shall
|
||||
Just more playable version by malortie - https://github.com/malortie/halflife/tree/mod-hl-halloween
|
||||
|
||||
Branch **halloween** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/halloween
|
||||
|
||||
## The Wastes
|
||||
Version 1.5: Port to Linux - https://git.mentality.rip/a1batross/halflife-thewastes-sdk
|
||||
Branch **halloween** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/halloween
|
||||
|
||||
## Threewave CTF
|
||||
Branch **dmc** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/dmc
|
||||
|
||||
## Xen-Warrior
|
||||
Branch **sohl1.2** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sohl1.2
|
||||
Branch **dmc** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/dmc
|
||||
|
||||
## Zombie-X
|
||||
Branch **zombie-x** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/zombie-x
|
||||
Branch **zombie-x** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/zombie-x
|
||||
|
||||
|
||||
@@ -2,32 +2,37 @@ Xash3D FWGS is intended to be easily ported to specific platform, however main i
|
||||
|
||||
This page is about merged ports to main source tree and responsible for it developers.
|
||||
|
||||
For porting guidelines, look engine-porting-guide.md.
|
||||
For porting guidelines, look here(TODO!)
|
||||
|
||||
Status:
|
||||
* **Supported**: active, was confirmed to be fully functional.
|
||||
* **Supported**: active, confirmed to be fully functional.
|
||||
* **In progress**: active, under development.
|
||||
* **Incomplete**: not active, but some work was accepted to main repository before
|
||||
* **Old Engine**: port was for old engine fork
|
||||
* **Not maintained**: lack of human resources
|
||||
* **Not merged**: was done in third-party fork, real status unknown
|
||||
* **Deprecated**: not supported anymore
|
||||
|
||||
Table is sorted by status and platform.
|
||||
Table is sorted by status.
|
||||
|
||||
| Platform | Status | Maintainer | Note
|
||||
| -------- | ------ | ---------- | ----
|
||||
| Android | Supported | @Velaron |
|
||||
| *BSD | Supported | @nekonomicon |
|
||||
| DOS4GW | Supported | @mittorn |
|
||||
| GNU/Linux | Supported | @a1batross, @mittorn |
|
||||
| Haiku | Supported | not maintained | Was added by #478 and #483
|
||||
| macOS | Supported | @sofakng |
|
||||
| MotoMAGX | Supported | @a1batross |
|
||||
| PSVita | Supported | @fgsfdsfgs |
|
||||
| Switch | Supported | @fgsfdsfgs |
|
||||
| Windows | Supported | @a1batross, @SNMetamorph |
|
||||
| PSP | In progress | @Crow_bar, @Velaron | [GitHub Repository](https://github.com/Crow-bar/xash3d-fwgs)
|
||||
| Wii | In progress | Collaborative effort | [GitHub Repository](https://github.com/saucesaft/xash3d-wii)
|
||||
| Emscripten | Old Engine | not maintained |
|
||||
| 3DS | Old Engine fork | not maintained | [GitHub Repository](https://github.com/masterfeizz/Xash3DS)
|
||||
| Oculus Quest | Old Engine fork | @DrBeef | [GitHub Repository](https://github.com/DrBeef/Lambda1VR)
|
||||
| iOS | Deprecated | not maintained | See GitHub issue #61
|
||||
| Platform | Status | Maintainer | Note
|
||||
| -------- | ------ | ---------- | ----
|
||||
| Windows | Supported | @a1batross |
|
||||
| *BSD | Supported | @nekonomicon |
|
||||
| GNU/Linux(x86, amd64, arm) | Supported | @a1batross, @mittorn |
|
||||
| Android | Supported | @a1batross, @mittorn |
|
||||
| MotoMAGX | Supported | @a1batross |
|
||||
| GNU/Linux(elbrus) | Supported | @a1batross, @mittorn | Rare and eventual access to e2k machine
|
||||
| Haiku | Supported | not maintained | Was added by #478 and #483
|
||||
| DOS4GW | Supported | @mittorn |
|
||||
| GNU/Linux(mipsel) | Supported | @mittorn |
|
||||
| Switch | In progress | @fgsfdsfgs | [Github Repository](https://github.com/fgsfdsfgs/xash3d-fwgs/tree/switch_new)
|
||||
| Wii | In progress | Collaborative effort | [Github Repository](https://github.com/saucesaft/xash3d-wii)
|
||||
| PSP | In progress | Collaborative effort | No sources available at this moment
|
||||
| Emscripten | Old Engine | not maintained |
|
||||
| Oculus Quest | Old Engine fork | @DrBeef | [GitHub Repository](https://github.com/DrBeef/Lambda1VR)
|
||||
| PSVita | Old Engine fork | not maintained | [GitHub Repository](https://github.com/fgsfdsfgs/vitaXash3D)
|
||||
| Switch | Old Engine fork | not maintained | [GitHub Repository](https://github.com/switchports/xash3d-switch)
|
||||
| 3DS | Old Engine fork | not maintained | [GitHub Repository](https://github.com/masterfeizz/Xash3DS)
|
||||
| macOS | Deprecated | not maintained | See GitHub issue #61
|
||||
| iOS | Deprecated | not maintained | See GitHub issue #61
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
## PlayStation Vita port
|
||||
|
||||
### Prerequisites
|
||||
1. Make sure your PSVita is [set up to run homebrew applications](https://vita.hacks.guide/).
|
||||
2. Install [kubridge](https://github.com/TheOfficialFloW/kubridge/releases/) by copying `kubridge.suprx` to your taiHEN plugins folder (usually `ux0:/tai`) and add it to your `config.txt`, for example:
|
||||
```
|
||||
*KERNEL
|
||||
ux0:tai/kubridge.skprx
|
||||
```
|
||||
3. Install `libshacccg.suprx` by following [this guide](https://cimmerian.gitbook.io/vita-troubleshooting-guide/shader-compiler/extract-libshacccg.suprx).
|
||||
|
||||
### Installation
|
||||
1. If you have an old vitaXash3D install, remove it.
|
||||
2. Get `xash3d-fwgs-psvita.7z` from the latest [automatic build](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous).
|
||||
3. Install `xash.vpk` from the 7z archive onto your PSVita.
|
||||
4. Copy the `data` directory from the 7z archive to the root of your PSVita's SD card.
|
||||
5. Copy the valve folder and any other mod folders from your Half-Life install to `ux0:/data/xash3d/` (you can use other mountpoints instead of `ux0`). **Do not overwrite anything.**
|
||||
|
||||
### Build instructions
|
||||
1. Install [VitaSDK](https://vitasdk.org/).
|
||||
2. Build and install [vitaGL](https://github.com/Rinnegatamante/vitaGL):
|
||||
```
|
||||
git clone https://github.com/Rinnegatamante/vitaGL.git
|
||||
make -C vitaGL NO_TEX_COMBINER=1 HAVE_UNFLIPPED_FBOS=1 HAVE_PTHREAD=1 SINGLE_THREADED_GC=1 MATH_SPEEDHACK=1 DRAW_SPEEDHACK=1 HAVE_CUSTOM_HEAP=1 -j2 install
|
||||
```
|
||||
3. Build and install [vita-rtld](https://github.com/fgsfdsfgs/vita-rtld):
|
||||
```
|
||||
git clone https://github.com/fgsfdsfgs/vita-rtld.git && cd vita-rtld
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make -j2 install
|
||||
```
|
||||
4. Build and install [this SDL2 fork](https://github.com/Northfear/SDL) with vitaGL integration:
|
||||
```
|
||||
git clone https://github.com/Northfear/SDL.git && cd SDL
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DVIDEO_VITA_VGL=ON ..
|
||||
make -j2 install
|
||||
```
|
||||
5. Use `waf`:
|
||||
```
|
||||
./waf configure -T release --psvita
|
||||
./waf build
|
||||
```
|
||||
6. Copy all the resulting `.so` files into a single folder:
|
||||
```
|
||||
./waf install --destdir=xash3d
|
||||
```
|
||||
7. `xash.vpk` is located in `build/engine/`.
|
||||
@@ -19,22 +19,7 @@
|
||||
- [List of XashXT-based mods](#list-of-xashxt-based-mods)
|
||||
- [List of maps for They Hunger](#list-of-maps-for-they-hunger)
|
||||
- [List of games and mods with custom gamedll](#list-of-games-and-mods-with-custom-gamedll)
|
||||
- [List of mods for Counter Strike](#list-of-mods-for-counter-strike)
|
||||
- [List of supported mods from mobile_hacks branch of HLSDK Portable by FWGS](#list-of-supported-mods-from-mobile_hacks-branch-of-hlsdk-portable-by-fwgs)
|
||||
|
||||
# List of supported mods from mobile_hacks branch of HLSDK Portable by FWGS
|
||||
1. [Afraid of Monsters](https://www.moddb.com/mods/afraid-of-monsters/downloads/afraid-of-monsters-v1)
|
||||
2. [Big Lolly](https://www.moddb.com/mods/big-lolly)
|
||||
3. [Half-Life: Blue Shift](https://store.steampowered.com/app/130/HalfLife_Blue_Shift/)
|
||||
4. [Half-Secret](https://www.moddb.com/mods/half-secret)
|
||||
5. [Case Closed](https://www.moddb.com/mods/caseclosed)
|
||||
6. [Bloody Pizza - Vendetta](https://www.moddb.com/games/half-life/addons/bloody-pizza-vendetta)
|
||||
7. [Borderlands](https://www.moddb.com/games/half-life/addons/borderlands-v04)
|
||||
8. [Half-Life: Induction](https://www.moddb.com/mods/half-life-induction/downloads/half-life-induction-12)
|
||||
9. [Redemption/Absolute Redemption](https://www.moddb.com/mods/absolute-redemption)
|
||||
10. [Sewer beta](https://www.moddb.com/games/half-life/addons/sewer-beta)
|
||||
11. [Times of Troubles](https://www.moddb.com/mods/times-of-troubles)
|
||||
12. [Half-Life: Urbicide](https://www.moddb.com/mods/half-life-urbicide)
|
||||
- [List of mods for Counter Strike(Android only)](#list-of-mods-for-counter-strike)
|
||||
|
||||
# List of Half-Life-based mods
|
||||
Originally this list was written by *Qwertyus*(*Qortez*)
|
||||
@@ -61,7 +46,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
16. [Betrayal](http://www.moddb.com/mods/betrayal) (this mod has inner bugs; set **gl_allow_mirrors** to **0** to prevent drops of game's perfomance in some areas)
|
||||
17. [Between Two Worlds](https://www.runthinkshootlive.com/posts/between-two-worlds/)
|
||||
18. [Black Mesa Energy Testing Chamber](http://twhl.info/competitions.php?results=17)
|
||||
19. [Black Mesa Sideline](https://www.moddb.com/mods/black-mesa-sideline) (set **gl_allow_mirrors** to **0** to prevent drops of game's perfomance in some areas)
|
||||
19. [Black Mesa Sideline](http://www.isolated-design.de/half-life-mods/black-mesa-sideline/) (set **gl_allow_mirrors** to **0** to prevent drops of game's perfomance in some areas)
|
||||
20. [BlackMesa 2007( Black Mesa Missions 2007 )](http://www.moddb.com/addons/blackmesa-2007)
|
||||
21. [Blood and Bones](https://www.runthinkshootlive.com/posts/blood-and-bones/)
|
||||
22. Boom (Huknenn) v1.0 & [HL Boom: Gold Edition v1.1](http://www.moddb.com/mods/boom)
|
||||
@@ -118,8 +103,8 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
72. [Freeman](https://www.runthinkshootlive.com/posts/freeman/)
|
||||
73. [Freeman's Escape](http://www.moddb.com/mods/freeman-escape-french) (2 maps by *JiggZ*)
|
||||
74. [Freeman's Fight](https://www.runthinkshootlive.com/posts/freemans-fight/)
|
||||
75. [Freeman's Return](https://www.moddb.com/games/half-life/addons/freemans-return-v12)
|
||||
76. [Freeman's Return 2](https://www.moddb.com/games/half-life/addons/freemans-return-2-v11)
|
||||
75. [Freeman's Return](http://jpmaps.wz.cz/epizody.htm)
|
||||
76. [Freeman's Return 2](http://jpmaps.wz.cz/epizody.htm)
|
||||
77. [Freeman's Revenge](https://www.runthinkshootlive.com/posts/freemans-revenge/)
|
||||
78. [Freeman's Tomb( The Crypt )](http://twhl.info/vault.php?map=3787)
|
||||
79. [G-Invasion v2.5](http://www.moddb.com/mods/g-man-invasion) aka G-Man Invasion (there is an inner crash bug on final titles: some text lines are too long and cannot be properly displayed)
|
||||
@@ -144,7 +129,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
96. [Haunted](https://www.runthinkshootlive.com/posts/haunted/) (set **sv_validate_changelevel** to **0** to avoid a problem with level change between maps **pagan7** and **pagan8**)
|
||||
97. [Hazardous Materials: Episode 1 & 2](http://www.moddb.com/mods/half-life-hazardous-materials)
|
||||
98. [Hazardous-Course 2](http://www.moddb.com/mods/hazardous-course-2)
|
||||
99. [Help Wanted](https://www.moddb.com/games/half-life/addons/help-wanted)
|
||||
99. [Help Wanted](http://maps.mrsucko.org/work/)
|
||||
100. [Hidden Evil v1.01](https://www.runthinkshootlive.com/posts/hidden-evil/)
|
||||
101. [High Speed](http://www.moddb.com/games/half-life/addons/high-speed-english-version)
|
||||
102. [hlife_hotdog_compo26](http://twhl.info/vault.php?map=5181)
|
||||
@@ -170,7 +155,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
122. [Mario Keys](http://www.moddb.com/mods/mario-keys)
|
||||
123. [McBeth](https://www.runthinkshootlive.com/posts/mcbeth/)
|
||||
124. [Medieval World](http://www.moddb.com/mods/medieval-world)
|
||||
125. [Mel Soaring 2: Star Rancor](https://www.moddb.com/addons/mel-soaring-2-star-rancor)
|
||||
125. [Mel Soaring 2: Star Rancor](http://www.etherealhell.com/etherealhell/index.php/my-levels/half-life)
|
||||
126. [MINIMICUS](http://twhl.info/vault.php?map=163)
|
||||
127. [Mission Failed](http://www.moddb.com/mods/mission-failed)
|
||||
128. [Mission MC Poker](http://www.moddb.com/mods/half-life-mission-mc-poker)
|
||||
@@ -191,7 +176,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
143. [Operation: Nova](http://www.moddb.com/mods/half-life-operation-nova) (there is an inner bug with an M60 machinegun on a map with Osprey: it can be activated and used if you are staying in front of it, not behind it)
|
||||
144. [Optimum Fear](https://www.fileplanet.com/7472/0/fileinfo/Optimum-Fear)
|
||||
145. [Outrun](http://www.moddb.com/mods/outrun)
|
||||
146. [Outwards (Day One)](https://web.archive.org/web/20161026104825/http://visgi.info/maps/)
|
||||
146. [Outwards (Day One)](http://www.visgi.info/maps/)
|
||||
147. [Overhaul Pack](http://www.moddb.com/mods/half-life-overhaul-pack) (Just HD pack for Half-Life)
|
||||
148. [P.I.Z.D.E.C.](https://www.runthinkshootlive.com/posts/pizdec/)
|
||||
149. [pagoda](http://www.moddb.com/mods/pagoda1)
|
||||
@@ -199,7 +184,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
151. [Phobos IV](http://www.moddb.com/mods/phobos-iv)
|
||||
152. [Pimp My Car](https://www.runthinkshootlive.com/posts/pimp-my-car/) (there is an inner issue with incorrect responses of buttons on combination locks)
|
||||
153. [Point Blank – Stackdeath Complex](https://www.runthinkshootlive.com/posts/half-life-point-blank-stackdeath-complex/)
|
||||
154. [Prisoner Escaped](https://www.moddb.com/mods/prisoner-escaped-1-2)
|
||||
154. [Prisoner Escaped](http://four0four.org/downloads/maps/)
|
||||
155. [Prisoner of Event](http://wp.vondur.net/?page_id=40)
|
||||
156. [Prisoner of War](https://www.runthinkshootlive.com/posts/prisoner-of-war/)
|
||||
157. [Project Quantum Leap](http://www.moddb.com/mods/project-quantum-leap)
|
||||
@@ -297,7 +282,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
6. [Catacombs: Part 1](https://www.runthinkshootlive.com/posts/catacombs/)
|
||||
7. [Cro-man's Office Mappack](http://twhl.info/vault.php?map=5547)
|
||||
8. [Half-Life Episode Two Demo Alpha v1.0](http://hl.loess.ru/?mod=451)
|
||||
9. [Hazardous-Course (first version of Hazardous-Course 2)](https://web.archive.org/web/20110512012317/http://www.richmans-maps.ch.vu/)
|
||||
9. [Hazardous-Course (first version of Hazardous-Course 2)](http://www.richmans-maps.ch.vu/) (link dead!)
|
||||
10. [High Tech v0.2](http://hl.loess.ru/?mod=499)
|
||||
11. [HL Shadows, Part 1](https://www.fileplanet.com/7466/0/fileinfo/'HL-Shadows',-Part-1)
|
||||
12. [HLNewEnd](http://twhl.info/vault.php?map=2275)
|
||||
@@ -320,11 +305,11 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
||||
29. [Shortcut v1.0 Beta](https://www.runthinkshootlive.com/posts/shortcut/)
|
||||
30. [Stoka](https://www.ceskemody.cz/mapy.php?lng=1&clanek=222&razeni_hra=1&pn=stoka)
|
||||
31. [Striker's Compo 26](http://twhl.info/vault.php?map=5190) (buggy)
|
||||
32. [Technology Test 2](https://web.archive.org/web/20110512012317/http://www.richmans-maps.ch.vu/)
|
||||
32. [Technology Test 2](http://www.richmans-maps.ch.vu/) (link dead!)
|
||||
33. [The Gate Playable Demo](https://www.fileplanet.com/116347/110000/fileinfo/The-Gate-Playable-Demo)
|
||||
34. [They are Back](https://www.runthinkshootlive.com/posts/they-are-back/)
|
||||
35. [Tiefseelabor( Deep Sea Laboratory )](https://www.runthinkshootlive.com/posts/deep-sea-laboratory/)
|
||||
36. [Time-Shift](https://web.archive.org/web/20110512012317/http://www.richmans-maps.ch.vu/)
|
||||
36. [Time-Shift](http://www.richmans-maps.ch.vu/) (link dead!)
|
||||
37. [Train Single Beta](https://cs-mapping.com.ua/forum/showthread.php?t=36394) (Remove **gfx.wad** from **TrainSingle** folder)
|
||||
38. [WAR: The Killer Beta 0.1](http://www.moddb.com/mods/war)
|
||||
39. [White Force Beta( Residual Point prototype )](http://www.moddb.com/mods/hl-residual-point/downloads/white-force-beta-2002)
|
||||
@@ -394,7 +379,7 @@ Mods:
|
||||
5. [Half-Life Baby v1.4](http://www.moddb.com/games/half-life/addons/half-life-baby) (it's an unfinished but playable mod; after installing of the mod open **liblist.gam** or **gameinfo.txt** file in the mod's folder and correct the line **gamedll "..\hlbaby\dlls\hl.dll"** for **gamedll "dlls\hl.dll"**, otherwise you'll not be able to start a game)
|
||||
6. [Half-Secret](http://www.moddb.com/mods/half-secret) (this mod has custom **weapon_snark** code)
|
||||
7. [Induction](http://www.moddb.com/mods/half-life-induction) (this mod has new item - **item_flashlight**)
|
||||
8. [Lost in Black Mesa(first version without HLFX)](https://web.archive.org/web/20160407041812/http://half-life.ru/forum/showthread.php?threadid=13959) (download links dead!)
|
||||
8. [Lost in Black Mesa(first version without HLFX)](http://half-life.ru/forum/showthread.php?threadid=13959)
|
||||
9. [Soldier](http://www.moddb.com/mods/half-life-soldier)
|
||||
10. [Solo Operations](http://www.moddb.com/mods/solo-operations)
|
||||
11. [The Blood v1.1](http://hl.loess.ru/?mods=&search=The+Blood) (there are some inner bugs in the mod, but they don't interfere with a game progress)
|
||||
@@ -455,7 +440,7 @@ Mods:
|
||||
51. [Data-base](https://www.runthinkshootlive.com/posts/database/)
|
||||
52. [de_dust2_azabetfeN](https://cs-mapping.com.ua/forum/showthread.php?t=36394) (remove **cl_dlls** & **dlls** folders from inside of mod's directory before you start the game)
|
||||
53. [De-railed](http://twhl.info/competitions.php?results=7)
|
||||
54. [Dead Shift Beta](http://www.moddb.com/mods/dead-shift) - [Demo 1](https://www.gamewatcher.com/mods/half-life-mod/dead-shift-1-0-beta) & [Demo 2](https://web.archive.org/web/20151030005310/http://www.gamefront.com/files/13532512)
|
||||
54. [Dead Shift Beta](http://www.moddb.com/mods/dead-shift) - [Demo 1](https://www.gamewatcher.com/mods/half-life-mod/dead-shift-1-0-beta) & [Demo 2](https://www.gamefront.com/files/13532512) (3rd link dead!)
|
||||
55. [Deep](http://twhl.info/vault.php?map=1669)
|
||||
56. [Desert Attack](http://fyzzer.narod.ru/index.html)
|
||||
57. [Desert Combat Demo](https://www.fileplanet.com/190487/190000/fileinfo/Half-Life---Desert-Combat-Mod) (despite a big file size there's only one small unfinished map)
|
||||
@@ -484,7 +469,7 @@ Mods:
|
||||
80. [Extinct Lifeform Hunt](https://www.fileplanet.com/13501/10000/fileinfo/Extinct-Lifeform-Hunt)
|
||||
81. [Facility](http://twhl.info/vault.php?map=5482)
|
||||
82. [Facility Escape](http://twhl.info/vault.php?map=3673)
|
||||
83. [Fallout](http://www.thewall.de/forum/thread/hl1-sp-48h-mapping-contest/64975.4.html) (map by *simb*) (link dead!)
|
||||
83. [Fallout](http://www.thewall.de/forum/thread/hl1-sp-48h-mapping-contest/64975.4.html) (map by *simb*)
|
||||
84. [Final Assault](http://twhl.info/vault.php?map=4500)
|
||||
85. [Flat](http://hl.loess.ru/?mods=&search=Flat)
|
||||
86. [Freeman's Allegiance](https://www.runthinkshootlive.com/posts/freemans-allegiance/)
|
||||
@@ -514,7 +499,7 @@ Mods:
|
||||
110. [Hostage](https://www.runthinkshootlive.com/posts/hostage-2/)
|
||||
111. [House](http://www.artpeter.net/Data/HalfLife/Hl.php)
|
||||
112. [Impulse 101 Fun - The Train](http://web.archive.org/web/20070305075816/http://www.twhl.co.za/mapvault/2817.zip) (map from *TWHL* by *Archie* aka *The Hunter*)
|
||||
113. [In America](https://web.archive.org/web/20170221213409/http://www.lambda-force.org/load/half_life/karty/half_life_in_america/18-1-0-476)
|
||||
113. [In America](http://www.lambda-force.org/load/half_life/karty/half_life_in_america/18-1-0-476)
|
||||
114. [In the Kitchen](http://twhl.info/vault.php?map=4314)
|
||||
115. [Infiltration](https://www.fileplanet.com/7467/0/fileinfo/Infiltration)
|
||||
116. [Interactivity & Lots of Entities](http://twhl.info/vault.php?map=5744) (link dead!)
|
||||
@@ -683,7 +668,7 @@ Mods:
|
||||
279. [X-treme Violence](http://www.moddb.com/mods/x-treme-violence)
|
||||
280. [XargoL's Entry for Vassy's Compo](http://twhl.info/vault.php?map=769)
|
||||
281. [Xen Again](https://www.fileplanet.com/9132/0/fileinfo/XEN-AGAIN)
|
||||
282. [Xen World](http://www.lambda-force.org/load/half_life/karty/half_life_xen_world/18-1-0-481) (link dead!)
|
||||
282. [Xen World](http://www.lambda-force.org/load/half_life/karty/half_life_xen_world/18-1-0-481)
|
||||
283. [XUnil](https://www.fileplanet.com/7883/0/fileinfo/XUNIL)
|
||||
284. [Zeeba-G's TWHL Compo 26 Entry](http://twhl.info/competitions.php?results=26)
|
||||
285. [Zombies!](https://gamebanana.com/maps/160812)
|
||||
@@ -709,7 +694,7 @@ For Linux and OS X you must download crossbuild from [here](http://www.moddb.com
|
||||
2. [Big Scientists](http://www.moddb.com/mods/big-scientists)
|
||||
3. [Black Silla Assault DEMO v1.2](http://www.moddb.com/mods/black-silla-assault)
|
||||
4. [Blbej Den](http://www.moddb.com/mods/blbej-den)
|
||||
5. [Cold Experiment v1](https://www.moddb.com/games/half-life/addons/cold-experiment) (you will need some files from SoHL to play it properly; download SoHL 1.2, extract files and copy following folders into **coldexv1** folder: cl_dlls, dlls, models, sprites)
|
||||
5. [Cold Experiment v1](http://jpmaps.wz.cz/epizody.htm) (you will need some files from SoHL to play it properly; download SoHL 1.2, extract files and copy following folders into **coldexv1** folder: cl_dlls, dlls, models, sprites)
|
||||
6. [Dead Sector v1.0a](http://www.moddb.com/mods/dead-sector)
|
||||
7. [Death Is Dead](http://www.moddb.com/games/half-life/addons/death-is-dead) (there is a fog-related inner bug at the first map)
|
||||
8. [Escape from Black Mesa Alpha](http://www.moddb.com/mods/escape-from-black-mesa)
|
||||
@@ -725,9 +710,9 @@ For Linux and OS X you must download crossbuild from [here](http://www.moddb.com
|
||||
18. [Santa's Revenge](http://twhl.info/vault.php?map=4332) (set **fps_max** to **60** to avoid an inner problem of the last map with final scripted sequence, otherwise the mod can not be finished properly)
|
||||
19. [Sector 6](https://www.moddb.com/mods/sector-6/)
|
||||
20. [Space Prisoner v1.1](http://www.moddb.com/games/half-life/addons/space-prisoner-v11) (after installing of the mod open **liblist.gam** or **gameinfo.txt** file in the mod's folder and correct the line **gamedll "..\prison\dlls\spirit.dll"** for **gamedll "dlls\spirit.dll"**, otherwise you'll not be able to start a game; there is also a scripting error on a third map of the mod, so you'll be forced to use **noclip** to pass around bugged place)
|
||||
21. [Terrorist Attack 2](https://www.moddb.com/games/half-life/addons/terrorist-attack-2)
|
||||
21. [Terrorist Attack 2](http://terroristattack.wz.cz/mody.html) (link dead!)
|
||||
22. [Timeline III: The Heart of Darkness](http://www.moddb.com/mods/timeline-series)
|
||||
23. [Underground 2 Demo](https://www.moddb.com/games/half-life/addons/underground-2-demo)
|
||||
23. [Underground 2 Demo](http://www.isolated-design.de/half-life-mods/underground-2/)
|
||||
|
||||
## Mods which based on modified Spirit of Half-Life 1.2 or older(Partially playable with SoHL 1.2 libraries or not playable at all)
|
||||
1. [Black Death](http://www.moddb.com/mods/half-life-black-death)
|
||||
@@ -840,10 +825,10 @@ Mods:
|
||||
3. [Bomb Squad](http://www.snarkpit.net/index.php?s=maps&map=3471)
|
||||
4. [Corruption](http://www.snarkpit.net/index.php?s=maps&map=3154)
|
||||
5. [Critical Mass](http://www.moddb.com/mods/half-life-critical-mass) [C3M1 Build 1 Demo](https://www.fileplanet.com/125746/120000/fileinfo/C3M1-Build-1)
|
||||
6. [EPRST!](https://www.runthinkshootlive.com/posts/ep-rst/)
|
||||
6. [EPRST!](http://www.planetphillip.com/posts/ep-rst-opposing-force/) (link dead!)
|
||||
7. [Firing Range](https://www.runthinkshootlive.com/posts/firing-range/)
|
||||
8. [Friendly Fire](https://www.runthinkshootlive.com/posts/friendly-fire/)
|
||||
9. [Guitar Star Pre-Alpha](http://gamer-lab.com/rus/mods_goldsrc/Guitar_Star_(Prealpha))
|
||||
9. [Guitar Star Pre-Alpha](http://hl-lab.ru/eng/mods_goldsrc/Guitar_Star_(Prealpha)) (link dead!)
|
||||
10. [J2000](https://www.runthinkshootlive.com/posts/j2000/)
|
||||
11. [Killing House for OF](https://www.runthinkshootlive.com/posts/scientist-rescue-aka-cqb/)
|
||||
12. [Klabautermann](https://www.runthinkshootlive.com/posts/klabautermann/) (though the map has some inner issues, it can be properly finished, just don't let the welder soldier die and don't press the fifth button until you mount a special gun in its' place)
|
||||
|
||||
120
README.md
120
README.md
@@ -1,56 +1,56 @@
|
||||
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||
[](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||
# Xash3D FWGS Engine
|
||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://travis-ci.org/FWGS/xash3d-fwgs) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://discord.fwgs.ru/) \
|
||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||
|
||||
Xash3D (pronounced `[ksɑʂ]`) FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
||||
|
||||
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.
|
||||
|
||||
## Donate
|
||||
[](Documentation/donate.md) \
|
||||
If you like Xash3D FWGS, consider supporting individual engine maintainers. By supporting us, you help to continue developing this game engine further. The sponsorship links are available in [documentation](Documentation/donate.md).
|
||||
```
|
||||
Xash3D is a game engine, aimed to provide compatibility with Half-Life Engine,
|
||||
as well as to give game developers well known workflow and extend it.
|
||||
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
||||
```
|
||||
|
||||
## Fork features
|
||||
* Steam Half-Life (HLSDK 2.5) support.
|
||||
* Crossplatform and modern compilers support: supports Windows, Linux, BSD & Android on x86 & ARM and [many more](Documentation/ports.md).
|
||||
* Better multiplayer: multiple master servers, headless dedicated server, voice chat, [GoldSrc protocol support](Documentation/goldsrc-protocol-support.md) and IPv6 support.
|
||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2 and Software.
|
||||
* Advanced virtual filesystem: `.pk3` and `.pk3dir` support, compatibility with GoldSrc FS module, fast case-insensitivity emulation for crossplatform.
|
||||
* Mobility API: better game integration on mobile devices (vibration, touch controls).
|
||||
* Different input methods: touch and gamepad in addition to mouse & keyboard.
|
||||
* HLSDK 2.4 support.
|
||||
* Crossplatform: supported x86 and ARM on Windows/Linux/BSD/Android. ([see docs for more info](Documentation/ports.md))
|
||||
* Modern compilers support: say no more to MSVC6.
|
||||
* Better multiplayer support: multiple master servers, headless dedicated server.
|
||||
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
||||
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
||||
* TrueType font rendering, as a part of mainui_cpp.
|
||||
* External VGUI support module.
|
||||
* PNG & KTX2 image format support.
|
||||
* [A set of small improvements](Documentation/), without broken compatibility.
|
||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2, Software
|
||||
* A set of small improvements, without broken compatibility.
|
||||
|
||||
## Planned fork features
|
||||
* Virtual Reality support and game API
|
||||
* Voice support
|
||||
* Vulkan renderer
|
||||
|
||||
## Installation & Running
|
||||
0) Get Xash3D FWGS binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
||||
0) Get Xash3D binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
||||
Choose proper build package depending on which platform you're using.
|
||||
1) Copy engine binaries to some directory.
|
||||
2) Copy `valve` directory from [Half-Life](https://store.steampowered.com/app/70/HalfLife/) to directory with engine binaries.
|
||||
If your CPU is NOT x86 compatible or you're running 64-bit version of the engine, you may want to compile [Half-Life SDK](https://github.com/FWGS/hlsdk-portable).
|
||||
This repository contains our fork of HLSDK and restored source code for Half-Life expansions and some mods.
|
||||
You still needed to copy `valve` directory as all game resources located there.
|
||||
3) Run the main executable (`xash3d.exe` or AppImage).
|
||||
Also if you're using Windows: you should copy `vgui.dll` library from Half-Life directory to Xash3D directory.
|
||||
As alternative, you can compile [hlsdk-xash3d](https://github.com/FWGS/hlsdk-xash3d) instead of using official Valve game binaries, but you still needed to copy `valve` directory as all game resources located in there.
|
||||
3) Download [extras.pak](https://github.com/FWGS/xash-extras/releases/tag/v0.19.2) and place it to `valve` directory.
|
||||
4) Run `xash3d.exe`/`xash3d.sh`/`xash3d` depending on which platform you're using.
|
||||
|
||||
Note: on Linux, you may need to create an sh file with the command `LD_LIBRARY_PATH=. ./xash3d`.
|
||||
|
||||
For additional info, run Xash3D with `-help` command line key.
|
||||
|
||||
## Contributing
|
||||
* Before sending an issue, check if someone already reported your issue. Make sure you're following "How To Ask Questions The Smart Way" guide by Eric Steven Raymond. Read more: http://www.catb.org/~esr/faqs/smart-questions.html.
|
||||
* Issues are accepted in both English and Russian.
|
||||
* Before sending an issue, check if someone already reported your issue. Make sure you're following "How To Ask Questions The Smart Way" guide by Eric Steven Raymond. Read more: http://www.catb.org/~esr/faqs/smart-questions.html
|
||||
* Issues are accepted in both English and Russian
|
||||
* Before sending a PR, check if you followed our contribution guide in CONTRIBUTING.md file.
|
||||
|
||||
## Build instructions
|
||||
We are using Waf build system. If you have some Waf-related questions, I recommend you to read [Waf Book](https://waf.io/book/).
|
||||
We are using Waf build system. If you have some Waf-related questions, I recommend you to read https://waf.io/book/
|
||||
|
||||
NOTE: NEVER USE GitHub's ZIP ARCHIVES. GitHub doesn't include external dependencies we're using!
|
||||
|
||||
### Prerequisites
|
||||
If your CPU is x86 compatible and you're on Windows or Linux, we are building 32-bit code by default. This was done to maintain compatibility with Steam releases of Half-Life and based on it's engine games.
|
||||
Even if Xash3D FWGS does support targetting 64-bit, you can't load games without recompiling them from source code!
|
||||
|
||||
If your CPU is NOT x86 compatible or you decided build 64-bit version of engine, you may want to compile [Half-Life SDK](https://github.com/FWGS/hlsdk-portable).
|
||||
This repository contains our fork of HLSDK and restored source code for Half-Life expansions and some mods.
|
||||
|
||||
#### Windows (Visual Studio)
|
||||
* Install Visual Studio.
|
||||
* Install latest [Python](https://python.org) **OR** run `cinst python.install` if you have Chocolatey.
|
||||
@@ -60,41 +60,37 @@ This repository contains our fork of HLSDK and restored source code for Half-Lif
|
||||
* Make sure you have at least 12GB of free space to store all build-time dependencies: ~10GB for Visual Studio, 300 MB for Git, 100 MB for Python and other.
|
||||
|
||||
#### GNU/Linux
|
||||
NOTE FOR USERS WITH X86 COMPATIBLE CPUs:
|
||||
We have forced Waf to throw an error, if you're trying to build 64-bit engine. This was done for keeping compatibility with Steam releases of Half-Life and based on it's engine games.
|
||||
Even if Xash3D FWGS does support targetting 64-bit, you can't load games without recompiling them from source code!
|
||||
|
||||
##### Debian/Ubuntu
|
||||
* Only for 32-bit engine on 64-bit x86 operating system:
|
||||
* Enable i386 on your system: `$ sudo dpkg --add-architecture i386`.
|
||||
* Install `aptitude` ([why?](https://github.com/FWGS/xash3d-fwgs/issues/1828#issuecomment-2415131759)): `$ sudo apt update && sudo apt upgrade && sudo apt install aptitude`
|
||||
* Install development tools: `$ sudo aptitude --without-recommends install git build-essential gcc-multilib g++-multilib libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype-dev:i386 libopus-dev:i386 libbz2-dev:i386`.
|
||||
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig`.
|
||||
* Enable i386 on your system, if you're compiling 32-bit engine on amd64. If not, skip this
|
||||
|
||||
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
||||
* Install development tools: `$ sudo apt install git build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev libopus-dev libbz2-dev`.
|
||||
|
||||
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||
|
||||
##### RedHat/Fedora
|
||||
* Only for 32-bit engine on 64-bit x86 operating system:
|
||||
* Install development tools: `$ sudo dnf install git gcc gcc-c++ glibc-devel.i686 SDL2-devel.i686 opus-devel.i686 fontconfig-devel.i686 freetype-devel.i686 bzip2-devel.i686`.
|
||||
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig`.
|
||||
|
||||
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
||||
* Install development tools: `$ sudo dnf install git gcc gcc-c++ SDL2-devel opus-devel fontconfig-devel freetype-devel bzip2-devel`.
|
||||
|
||||
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||
`$ sudo dpkg --add-architecture i386`
|
||||
* Install development tools
|
||||
* For 32-bit engine on amd64: \
|
||||
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386`
|
||||
* For everything else: \
|
||||
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev`
|
||||
* Clone this repostory:
|
||||
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
||||
|
||||
### Building
|
||||
#### Windows (Visual Studio)
|
||||
0) Open command line.
|
||||
0) Open command line
|
||||
1) Navigate to `xash3d-fwgs` directory.
|
||||
2) (optional) Examine which build options are available: `waf --help`.
|
||||
3) Configure build: `waf configure --sdl2=c:/path/to/SDL2`.
|
||||
4) Compile: `waf build`.
|
||||
5) Install: `waf install --destdir=c:/path/to/any/output/directory`.
|
||||
2) Carefully examine which build options are available: `waf --help`
|
||||
3) Configure build: `waf configure -T release --sdl2=c:/path/to/SDL2 --prefix=c:/path/to/any/output/directory`
|
||||
4) Compile: `waf build`
|
||||
5) Install: `waf install`
|
||||
|
||||
#### Linux
|
||||
If compiling 32-bit on amd64, make sure `PKG_CONFIG_PATH` from the previous step is set correctly, prior to running configure.
|
||||
0) Examine which build options are available: `./waf --help`
|
||||
1) Configure build: `./waf configure -T release --prefix=/path/to/any/output/directory`
|
||||
(You need to pass `-8` to compile 64-bit engine on 64-bit x86 processor)
|
||||
2) Compile: `./waf build`
|
||||
3) Install(optional): `./waf install`
|
||||
|
||||
Note: if compiling 32-bit on amd64, you may need to supply `export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig` prior to running configure.
|
||||
|
||||
0) (optional) Examine which build options are available: `./waf --help`.
|
||||
1) Configure build: `./waf configure` (you need to pass `-8` to compile 64-bit engine on 64-bit x86 processor).
|
||||
2) Compile: `./waf build`.
|
||||
3) Install: `./waf install --destdir=/path/to/any/output/directory`.
|
||||
|
||||
@@ -18,17 +18,27 @@ GNU General Public License for more details.
|
||||
// video backends (XASH_VIDEO)
|
||||
#define VIDEO_NULL 0
|
||||
#define VIDEO_SDL 1
|
||||
#define VIDEO_ANDROID 2
|
||||
#define VIDEO_FBDEV 3
|
||||
#define VIDEO_DOS 4
|
||||
|
||||
|
||||
// audio backends (XASH_SOUND)
|
||||
#define SOUND_NULL 0
|
||||
#define SOUND_SDL 1
|
||||
#define SOUND_OPENSLES 2
|
||||
#define SOUND_ALSA 3
|
||||
|
||||
// crash handler (XASH_CRASHHANDLER)
|
||||
#define CRASHHANDLER_NULL 0
|
||||
#define CRASHHANDLER_UCONTEXT 1
|
||||
#define CRASHHANDLER_DBGHELP 2
|
||||
#define CRASHHANDLER_WIN32 3
|
||||
|
||||
// input (XASH_INPUT)
|
||||
#define INPUT_NULL 0
|
||||
#define INPUT_SDL 1
|
||||
#define INPUT_ANDROID 2
|
||||
#define INPUT_EVDEV 3
|
||||
|
||||
// timer (XASH_TIMER)
|
||||
@@ -41,8 +51,9 @@ GNU General Public License for more details.
|
||||
// messageboxes (XASH_MESSAGEBOX)
|
||||
#define MSGBOX_STDERR 0
|
||||
#define MSGBOX_SDL 1
|
||||
#define MSGBOX_ANDROID 2
|
||||
#define MSGBOX_WIN32 3
|
||||
#define MSGBOX_NSWITCH 4
|
||||
|
||||
|
||||
// library loading (XASH_LIB)
|
||||
#define LIB_NULL 0
|
||||
@@ -50,4 +61,5 @@ GNU General Public License for more details.
|
||||
#define LIB_WIN32 2
|
||||
#define LIB_STATIC 3
|
||||
|
||||
|
||||
#endif /* BACKENDS_H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
net.h - WinSock to BSD sockets wrap
|
||||
Copyright (C) 2022 a1batross
|
||||
boneinfo.h - structure that send delta-compressed bones across network
|
||||
Copyright (C) 2018 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -12,12 +12,14 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
#ifndef NET_H
|
||||
#define NET_H
|
||||
|
||||
#include <WS2tcpip.h>
|
||||
typedef int WSAsize_t;
|
||||
#ifndef BONEINFO_H
|
||||
#define BONEINFO_H
|
||||
|
||||
#define HAVE_GETADDRINFO
|
||||
typedef struct
|
||||
{
|
||||
vec3_t angles;
|
||||
vec3_t origin;
|
||||
} boneinfo_t;
|
||||
|
||||
#endif // NET_H
|
||||
#endif//BONEINFO_H
|
||||
@@ -61,27 +61,23 @@ BRUSH MODELS
|
||||
#define LS_UNUSED 0xFE
|
||||
#define LS_NONE 0xFF
|
||||
|
||||
#define MAX_MAP_CLIPNODES_HLBSP 32767
|
||||
#define MAX_MAP_CLIPNODES_BSP2 524288
|
||||
|
||||
// these limis not using by modelloader but only for displaying 'mapstats' correctly
|
||||
#ifdef SUPPORT_BSP2_FORMAT
|
||||
#define MAX_MAP_MODELS 2048 // embedded models
|
||||
#define MAX_MAP_ENTSTRING 0x200000 // 2 Mb should be enough
|
||||
#define MAX_MAP_PLANES 131072 // can be increased without problems
|
||||
#define MAX_MAP_NODES 262144 // can be increased without problems
|
||||
#define MAX_MAP_CLIPNODES MAX_MAP_CLIPNODES_BSP2 // can be increased without problems
|
||||
#define MAX_MAP_CLIPNODES 524288 // can be increased without problems
|
||||
#define MAX_MAP_LEAFS 131072 // CRITICAL STUFF to run ad_sepulcher!!!
|
||||
#define MAX_MAP_VERTS 524288 // can be increased without problems
|
||||
#define MAX_MAP_FACES 262144 // can be increased without problems
|
||||
#define MAX_MAP_MARKSURFACES 524288 // can be increased without problems
|
||||
#else
|
||||
// increased to match PrimeXT compilers
|
||||
#define MAX_MAP_MODELS 1024 // embedded models
|
||||
#define MAX_MAP_MODELS 768 // embedded models
|
||||
#define MAX_MAP_ENTSTRING 0x100000 // 1 Mb should be enough
|
||||
#define MAX_MAP_PLANES 65536 // can be increased without problems
|
||||
#define MAX_MAP_NODES 32767 // because negative shorts are leafs
|
||||
#define MAX_MAP_CLIPNODES MAX_MAP_CLIPNODES_HLBSP // because negative shorts are contents
|
||||
#define MAX_MAP_CLIPNODES 32767 // because negative shorts are contents
|
||||
#define MAX_MAP_LEAFS 32767 // signed short limit
|
||||
#define MAX_MAP_VERTS 65535 // unsigned short limit
|
||||
#define MAX_MAP_FACES 65535 // unsigned short limit
|
||||
|
||||
@@ -9,20 +9,8 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
|
||||
========================================================================
|
||||
*/
|
||||
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24 || type == PF_LUMINANCE)
|
||||
#define ImageCompressed( type ) \
|
||||
( type == PF_DXT1 \
|
||||
|| type == PF_DXT3 \
|
||||
|| type == PF_DXT5 \
|
||||
|| type == PF_ATI2 \
|
||||
|| type == PF_BC4_SIGNED \
|
||||
|| type == PF_BC4_UNSIGNED \
|
||||
|| type == PF_BC5_SIGNED \
|
||||
|| type == PF_BC5_UNSIGNED \
|
||||
|| type == PF_BC6H_SIGNED \
|
||||
|| type == PF_BC6H_UNSIGNED \
|
||||
|| type == PF_BC7_UNORM \
|
||||
|| type == PF_BC7_SRGB \
|
||||
|| type == PF_KTX2_RAW )
|
||||
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2)
|
||||
#define Image16( type ) (type == PF_RGBA_64 || type == PF_RGB_48)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -34,19 +22,12 @@ typedef enum
|
||||
PF_RGB_24, // uncompressed dds or another 24-bit image
|
||||
PF_BGR_24, // big-endian RGB (MacOS)
|
||||
PF_LUMINANCE,
|
||||
PF_DXT1, // s3tc DXT1/BC1 format
|
||||
PF_DXT3, // s3tc DXT3/BC2 format
|
||||
PF_DXT5, // s3tc DXT5/BC3 format
|
||||
PF_ATI2, // latc ATI2N/BC5 format
|
||||
PF_BC4_SIGNED,
|
||||
PF_BC4_UNSIGNED,
|
||||
PF_BC5_SIGNED,
|
||||
PF_BC5_UNSIGNED,
|
||||
PF_BC6H_SIGNED, // bptc BC6H signed FP16 format
|
||||
PF_BC6H_UNSIGNED, // bptc BC6H unsigned FP16 format
|
||||
PF_BC7_UNORM, // bptc BC7 format
|
||||
PF_BC7_SRGB,
|
||||
PF_KTX2_RAW, // Raw KTX2 data, used for yet unsupported KTX2 subformats
|
||||
PF_DXT1, // s3tc DXT1 format
|
||||
PF_DXT3, // s3tc DXT3 format
|
||||
PF_DXT5, // s3tc DXT5 format
|
||||
PF_ATI2, // latc ATI2N format
|
||||
PF_RGBA_64, // 16-bit RGBA
|
||||
PF_RGB_48, // 16-bit RGB
|
||||
PF_TOTALCOUNT, // must be last
|
||||
} pixformat_t;
|
||||
|
||||
@@ -68,8 +49,6 @@ typedef enum
|
||||
IL_DDS_HARDWARE = BIT(4), // DXT compression is support
|
||||
IL_LOAD_DECAL = BIT(5), // special mode for load gradient decals
|
||||
IL_OVERVIEW = BIT(6), // overview required some unque operations
|
||||
IL_LOAD_PLAYER_DECAL = BIT(7), // special mode for player decals
|
||||
IL_KTX2_RAW = BIT(8), // renderer can consume raw KTX2 files (e.g. ref_vk)
|
||||
} ilFlags_t;
|
||||
|
||||
// goes into rgbdata_t->encode
|
||||
@@ -106,7 +85,7 @@ typedef enum
|
||||
IMAGE_ROT_90 = BIT(18), // flip from upper left corner to down right corner
|
||||
IMAGE_ROT180 = IMAGE_FLIP_X|IMAGE_FLIP_Y,
|
||||
IMAGE_ROT270 = IMAGE_FLIP_X|IMAGE_FLIP_Y|IMAGE_ROT_90,
|
||||
// reserved
|
||||
IMAGE_EMBOSS = BIT(19), // apply emboss mapping
|
||||
IMAGE_RESAMPLE = BIT(20), // resample image to specified dims
|
||||
// reserved
|
||||
// reserved
|
||||
|
||||
@@ -105,7 +105,7 @@ typedef struct
|
||||
|
||||
vec3_t mins, maxs; // terrain bounds (fill by user)
|
||||
|
||||
intptr_t reserved[32]; // just for future expansions or mod-makers
|
||||
int reserved[32]; // just for future expansions or mod-makers
|
||||
} mfaceinfo_t;
|
||||
|
||||
typedef struct
|
||||
@@ -127,23 +127,14 @@ typedef struct
|
||||
int flags; // sky or slime, no lightmap or 256 subdivision
|
||||
} mtexinfo_t;
|
||||
|
||||
// a1ba: changed size to avoid undefined behavior. Check your allocations if you take this header!
|
||||
// For example:
|
||||
// before: malloc( sizeof( glpoly_t ) + ( numverts - 4 ) * VERTEXSIZE * sizeof( float ))
|
||||
// after (C): malloc( sizeof( glpoly_t ) + numverts * VERTEXSIZE * sizeof( float ))
|
||||
// after (C++): malloc( sizeof( glpoly_t ) + ( numverts - 1 ) * VERTEXSIZE * sizeof( float ))
|
||||
typedef struct glpoly2_s
|
||||
typedef struct glpoly_s
|
||||
{
|
||||
struct glpoly2_s *next;
|
||||
struct glpoly2_s *chain;
|
||||
struct glpoly_s *next;
|
||||
struct glpoly_s *chain;
|
||||
int numverts;
|
||||
int flags; // for SURF_UNDERWATER
|
||||
#ifdef __cplusplus
|
||||
float verts[1][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||
#else
|
||||
float verts[][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||
#endif
|
||||
} glpoly2_t;
|
||||
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||
} glpoly_t;
|
||||
|
||||
typedef struct mnode_s
|
||||
{
|
||||
@@ -182,8 +173,8 @@ struct decal_s
|
||||
short entityIndex; // Entity this is attached to
|
||||
// Xash3D specific
|
||||
vec3_t position; // location of the decal center in world space.
|
||||
glpoly2_t *polys; // precomputed decal vertices
|
||||
intptr_t reserved[4]; // just for future expansions or mod-makers
|
||||
glpoly_t *polys; // precomputed decal vertices
|
||||
int reserved[4]; // just for future expansions or mod-makers
|
||||
};
|
||||
|
||||
typedef struct mleaf_s
|
||||
@@ -237,7 +228,7 @@ typedef struct mextrasurf_s
|
||||
unsigned short numverts; // world->vertexes[]
|
||||
int firstvertex; // fisrt look up in tr.tbn_vectors[], then acess to world->vertexes[]
|
||||
|
||||
intptr_t reserved[32]; // just for future expansions or mod-makers
|
||||
int reserved[32]; // just for future expansions or mod-makers
|
||||
} mextrasurf_t;
|
||||
|
||||
struct msurface_s
|
||||
@@ -255,7 +246,7 @@ struct msurface_s
|
||||
|
||||
int light_s, light_t; // gl lightmap coordinates
|
||||
|
||||
glpoly2_t *polys; // multiple if warped
|
||||
glpoly_t *polys; // multiple if warped
|
||||
struct msurface_s *texturechain;
|
||||
|
||||
mtexinfo_t *texinfo;
|
||||
@@ -497,8 +488,7 @@ typedef struct
|
||||
int flags;
|
||||
float size;
|
||||
|
||||
const trivertex_t **pposeverts; // only valid during loading, used to build GL mesh
|
||||
intptr_t reserved[7]; // VBO offsets
|
||||
int reserved[8]; // VBO offsets
|
||||
|
||||
int numposes;
|
||||
int poseverts;
|
||||
@@ -540,11 +530,9 @@ typedef struct
|
||||
#define MAX_DEMOS 32
|
||||
#define MAX_MOVIES 8
|
||||
#define MAX_CDTRACKS 32
|
||||
#define MAX_CLIENT_SPRITES 512 // SpriteTextures (0-256 hud, 256-512 client)
|
||||
#define MAX_CLIENT_SPRITES 256 // SpriteTextures
|
||||
#define MAX_EFRAGS 8192 // Arcane Dimensions required
|
||||
#define MAX_REQUESTS 64
|
||||
|
||||
STATIC_CHECK_SIZEOF( mextrasurf_t, 324, 496 );
|
||||
STATIC_CHECK_SIZEOF( decal_t, 60, 88 );
|
||||
STATIC_CHECK_SIZEOF( mfaceinfo_t, 176, 304 );
|
||||
|
||||
#endif//COM_MODEL_H
|
||||
|
||||
@@ -717,7 +717,6 @@ enum
|
||||
kRenderFxExplode, // Scale up really big!
|
||||
kRenderFxGlowShell, // Glowing Shell
|
||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||
kRenderFxLightMultiplier,
|
||||
};
|
||||
|
||||
typedef int func_t;
|
||||
@@ -726,6 +725,7 @@ typedef int string_t;
|
||||
typedef unsigned short word;
|
||||
|
||||
#include "xash3d_types.h"
|
||||
#define Q_isspace( ch ) (ch < 32 || ch > 255)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
157
common/cvardef.h
157
common/cvardef.h
@@ -1,122 +1,45 @@
|
||||
/*
|
||||
cvardef.h - quake cvar definition
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
Copyright (C) 2024 Alibek Omarov
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#ifndef CVARDEF_H
|
||||
#define CVARDEF_H
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
|
||||
#define FCVAR_USERINFO (1<<1) // changes the client's info string
|
||||
#define FCVAR_SERVER (1<<2) // notifies players when changed
|
||||
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
|
||||
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
|
||||
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
|
||||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
||||
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#define FCVAR_MOVEVARS (1<<10) // this cvar is a part of movevars_t struct that shared between client and server
|
||||
#define FCVAR_LATCH (1<<11) // notify client what this cvar will be applied only after server restart (but don't does more nothing)
|
||||
#define FCVAR_GLCONFIG (1<<12) // write it into <renderer>.cfg(see RefAPI)
|
||||
#define FCVAR_CHANGED (1<<13) // set each time the cvar is changed
|
||||
#define FCVAR_GAMEUIDLL (1<<14) // defined by the menu DLL
|
||||
#define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef CVAR
|
||||
#define CVAR
|
||||
|
||||
#include STDINT_H
|
||||
#include "xash3d_types.h"
|
||||
|
||||
/*
|
||||
|
||||
cvar_t variables are used to hold scalar or string variables that can be changed
|
||||
or displayed at the console or prog code as well as accessed directly
|
||||
in C code.
|
||||
|
||||
The user can access cvars from the console in three ways:
|
||||
r_draworder prints the current value
|
||||
r_draworder 0 sets the current value to 0
|
||||
set r_draworder 0 as above, but creates the cvar if not present
|
||||
|
||||
Cvars are restricted from having the same names as commands to keep this
|
||||
interface from being ambiguous.
|
||||
|
||||
The are also occasionally used to communicated information between different
|
||||
modules of the program.
|
||||
|
||||
*/
|
||||
|
||||
enum
|
||||
typedef struct cvar_s
|
||||
{
|
||||
// GoldSrc compatibility flags
|
||||
FCVAR_ARCHIVE = 1 << 0, // set to cause it to be saved to vars.rc
|
||||
FCVAR_USERINFO = 1 << 1, // added to userinfo when changed
|
||||
FCVAR_SERVER = 1 << 2, // added to serverinfo when changed, will notify clients by default
|
||||
FCVAR_EXTDLL = 1 << 3, // defined by server.dll
|
||||
FCVAR_CLIENTDLL = 1 << 4, // defined by client.dll
|
||||
FCVAR_PROTECTED = 1 << 5, // private server cvar
|
||||
FCVAR_SPONLY = 1 << 6, // can be set only in singleplayer
|
||||
FCVAR_PRINTABLEONLY = 1 << 7, // only allows printable characters
|
||||
FCVAR_UNLOGGED = 1 << 8, // disables notifying client about server cvar change
|
||||
FCVAR_NOEXTRAWHITESPACE = 1 << 9, // removes space characters from the beginning and the end of the string
|
||||
FCVAR_PRIVILEGED = 1 << 10, // only available in privileged mode
|
||||
FCVAR_FILTERABLE = 1 << 11, // treated as privileged if cl_filterstuffcmd is 1, otherwise ignored
|
||||
char *name;
|
||||
char *string;
|
||||
int flags;
|
||||
float value;
|
||||
struct cvar_s *next;
|
||||
} cvar_t;
|
||||
|
||||
// Xash3D public flags
|
||||
// FCVAR_LATCH = 1 << 11, // deprecated Xash3D flag, conflicts with FCVAR_FILTERABLE. Use another FCVAR_LATCH!
|
||||
FCVAR_GLCONFIG = 1 << 12, // set to cause it to be saved to <renderer>.cfg (see RefAPI)
|
||||
FCVAR_CHANGED = 1 << 13, // set each time the cvar changed
|
||||
FCVAR_GAMEUIDLL = 1 << 14, // defined by menu.dll
|
||||
FCVAR_CHEAT = 1 << 15, // cannot be changed if sv_cheats is 0
|
||||
|
||||
#if REF_DLL || ENGINE_DLL // Xash3D internal flags, MUST NOT be used outside of engine
|
||||
FCVAR_RENDERINFO = 1 << 16, // set to cause it to be saved to video.cfg
|
||||
FCVAR_READ_ONLY = 1 << 17, // display only, cannot be set by user at all
|
||||
FCVAR_EXTENDED = 1 << 18, // extended cvar structure
|
||||
FCVAR_ALLOCATED = 1 << 19, // allocated by the engine, must be freed with Mem_Free
|
||||
FCVAR_VIDRESTART = 1 << 20, // triggers video subsystem to recreate/modify window parameters
|
||||
FCVAR_TEMPORARY = 1 << 21, // only used to temporarly hold some value, can be unlinked
|
||||
FCVAR_MOVEVARS = 1 << 22, // access to movevars_t structure, synchornized between client and server
|
||||
FCVAR_USER_CREATED = 1 << 23, // created by a set command
|
||||
|
||||
FCVAR_REFDLL = 1 << 29, // (Xash3D FWGS internal flag) defined by the renderer DLL
|
||||
#endif // REF_DLL || ENGINE_DLL
|
||||
|
||||
FCVAR_LATCH = 1 << 30, // (Xash3D FWGS public flag, was FCVAR_FILTERABLE in Xash3D) save changes until server restart
|
||||
};
|
||||
|
||||
struct cvar_s {
|
||||
char *name;
|
||||
char *string;
|
||||
uint32_t flags;
|
||||
float value;
|
||||
struct cvar_s *next;
|
||||
};
|
||||
typedef struct cvar_s cvar_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( struct cvar_s, 20, 32 );
|
||||
|
||||
#if REF_DLL || ENGINE_DLL // Xash3D internal cvar format, MUST NOT be used outside of engine
|
||||
struct convar_s {
|
||||
char *name;
|
||||
char *string;
|
||||
uint32_t flags;
|
||||
float value;
|
||||
struct convar_s *next;
|
||||
char *desc;
|
||||
char *def_string;
|
||||
};
|
||||
typedef struct convar_s convar_t;
|
||||
|
||||
#if XASH_64BIT
|
||||
#define CVAR_SENTINEL (uintptr_t)0xDEADBEEFDEADBEEF
|
||||
#else
|
||||
#define CVAR_SENTINEL (uintptr_t)0xDEADBEEF
|
||||
#endif
|
||||
|
||||
#define CVAR_CHECK_SENTINEL( cv ) ((uintptr_t)(cv)->next == CVAR_SENTINEL)
|
||||
|
||||
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) \
|
||||
convar_t cv = { (char*)cvname, (char*)cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, (char*)cvdesc, NULL }
|
||||
|
||||
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) CVAR_DEFINE( cv, #cv, cvstr, cvflags, cvdesc )
|
||||
#endif // REF_DLL || ENGINE_DLL
|
||||
|
||||
#endif // CVAR
|
||||
#endif//CVARDEF_H
|
||||
|
||||
@@ -47,11 +47,29 @@ SETUP BACKENDS DEFINITIONS
|
||||
#endif // XASH_TIMER
|
||||
|
||||
#ifndef XASH_MESSAGEBOX
|
||||
#if !XASH_NSWITCH // SDL2 messageboxes not available
|
||||
#define XASH_MESSAGEBOX MSGBOX_SDL
|
||||
#endif
|
||||
#define XASH_MESSAGEBOX MSGBOX_SDL
|
||||
#endif // XASH_MESSAGEBOX
|
||||
#endif
|
||||
#elif XASH_ANDROID
|
||||
// we are building for Android platform, use Android APIs
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_ANDROID
|
||||
#endif // XASH_VIDEO
|
||||
|
||||
#ifndef XASH_INPUT
|
||||
#define XASH_INPUT INPUT_ANDROID
|
||||
#endif // XASH_INPUT
|
||||
|
||||
#ifndef XASH_SOUND
|
||||
#define XASH_SOUND SOUND_OPENSLES
|
||||
#endif // XASH_SOUND
|
||||
|
||||
#ifndef XASH_MESSAGEBOX
|
||||
#define XASH_MESSAGEBOX MSGBOX_ANDROID
|
||||
#endif // XASH_MESSAGEBOX
|
||||
|
||||
#define XASH_USE_EVDEV
|
||||
#define XASH_DYNAMIC_DLADDR
|
||||
#elif XASH_LINUX
|
||||
// we are building for Linux without SDL2, can draw only to framebuffer yet
|
||||
#ifndef XASH_VIDEO
|
||||
@@ -66,7 +84,7 @@ SETUP BACKENDS DEFINITIONS
|
||||
#define XASH_SOUND SOUND_ALSA
|
||||
#endif // XASH_SOUND
|
||||
|
||||
#define XASH_USE_EVDEV 1
|
||||
#define XASH_USE_EVDEV
|
||||
#elif XASH_DOS4GW
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_DOS
|
||||
@@ -87,13 +105,22 @@ SETUP BACKENDS DEFINITIONS
|
||||
#ifndef XASH_MESSAGEBOX
|
||||
#if XASH_WIN32
|
||||
#define XASH_MESSAGEBOX MSGBOX_WIN32
|
||||
#elif XASH_NSWITCH
|
||||
#define XASH_MESSAGEBOX MSGBOX_NSWITCH
|
||||
#else // !XASH_WIN32
|
||||
#define XASH_MESSAGEBOX MSGBOX_STDERR
|
||||
#endif // !XASH_WIN32
|
||||
#endif // XASH_MESSAGEBOX
|
||||
|
||||
//
|
||||
// select crashhandler based on defines
|
||||
//
|
||||
#ifndef XASH_CRASHHANDLER
|
||||
#if XASH_WIN32 && defined(DBGHELP)
|
||||
#define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP
|
||||
#elif XASH_LINUX || XASH_BSD
|
||||
#define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT
|
||||
#endif // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
|
||||
#endif
|
||||
|
||||
//
|
||||
// no timer - no xash
|
||||
//
|
||||
@@ -130,6 +157,10 @@ SETUP BACKENDS DEFINITIONS
|
||||
#define XASH_INPUT INPUT_NULL
|
||||
#endif // XASH_INPUT
|
||||
|
||||
#ifndef XASH_CRASHHANDLER
|
||||
#define XASH_CRASHHANDLER CRASHHANDLER_NULL
|
||||
#endif // XASH_CRASHHANDLER
|
||||
|
||||
/*
|
||||
=========================================================================
|
||||
|
||||
@@ -138,59 +169,27 @@ Default build-depended cvar and constant values
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
// Platform overrides
|
||||
#if XASH_NSWITCH
|
||||
#define DEFAULT_TOUCH_ENABLE "0"
|
||||
#define DEFAULT_M_IGNORE "1"
|
||||
#define DEFAULT_MODE_WIDTH 1280
|
||||
#define DEFAULT_MODE_HEIGHT 720
|
||||
#define DEFAULT_ALLOWCONSOLE 1
|
||||
#elif XASH_PSVITA
|
||||
#define DEFAULT_TOUCH_ENABLE "0"
|
||||
#define DEFAULT_M_IGNORE "1"
|
||||
#define DEFAULT_MODE_WIDTH 960
|
||||
#define DEFAULT_MODE_HEIGHT 544
|
||||
#define DEFAULT_ALLOWCONSOLE 1
|
||||
#elif XASH_ANDROID
|
||||
#if XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_TOUCH_ENABLE "1"
|
||||
#elif XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_TOUCH_ENABLE "1"
|
||||
#define DEFAULT_M_IGNORE "1"
|
||||
#endif // !XASH_MOBILE_PLATFORM && !XASH_NSWITCH
|
||||
#define DEFAULT_M_IGNORE "1"
|
||||
#else // !XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_TOUCH_ENABLE "0"
|
||||
#define DEFAULT_M_IGNORE "0"
|
||||
#endif // !XASH_MOBILE_PLATFORM
|
||||
|
||||
#if XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
|
||||
// this means that libraries are provided with engine, but not in game data
|
||||
// You need add library loading code to library.c when adding new platform
|
||||
#define XASH_INTERNAL_GAMELIBS
|
||||
#define XASH_INTERNAL_GAMELIBS
|
||||
// this means that libraries are provided with engine, but not in game data
|
||||
// You need add library loading code to library.c when adding new platform
|
||||
#endif // XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
|
||||
|
||||
// Defaults
|
||||
#ifndef DEFAULT_TOUCH_ENABLE
|
||||
#define DEFAULT_TOUCH_ENABLE "0"
|
||||
#endif // DEFAULT_TOUCH_ENABLE
|
||||
|
||||
#ifndef DEFAULT_M_IGNORE
|
||||
#define DEFAULT_M_IGNORE "0"
|
||||
#endif // DEFAULT_M_IGNORE
|
||||
|
||||
#ifndef DEFAULT_JOY_DEADZONE
|
||||
#define DEFAULT_JOY_DEADZONE "4096"
|
||||
#endif // DEFAULT_JOY_DEADZONE
|
||||
|
||||
// allow override for developer/debug builds
|
||||
#ifndef DEFAULT_DEV
|
||||
#define DEFAULT_DEV 0
|
||||
#endif // DEFAULT_DEV
|
||||
|
||||
#ifndef DEFAULT_ALLOWCONSOLE
|
||||
#define DEFAULT_ALLOWCONSOLE 0
|
||||
#endif // DEFAULT_ALLOWCONSOLE
|
||||
|
||||
#ifndef DEFAULT_FULLSCREEN
|
||||
#define DEFAULT_FULLSCREEN "1" // must be a string
|
||||
#define DEFAULT_FULLSCREEN 1
|
||||
#endif // DEFAULT_FULLSCREEN
|
||||
|
||||
#ifndef DEFAULT_MAX_EDICTS
|
||||
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
|
||||
#endif // DEFAULT_MAX_EDICTS
|
||||
|
||||
#endif // DEFAULTS_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
enginefeatures.h - engine features that can be enabled by mod-maker request
|
||||
features.h - engine features that can be enabled by mod-maker request
|
||||
Copyright (C) 2012 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -25,22 +25,5 @@ GNU General Public License for more details.
|
||||
#define ENGINE_COMPENSATE_QUAKE_BUG (1<<5) // compensate stupid quake bug (inverse pitch) for mods where this bug is fixed
|
||||
#define ENGINE_IMPROVED_LINETRACE (1<<6) // new traceline that tracing through alphatextures
|
||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
||||
|
||||
#define ENGINE_DISABLE_HDTEXTURES (1U<<30) // disable support of HD-textures in case custom renderer have separate way to load them
|
||||
#define ENGINE_STEP_POSHISTORY_LERP (1U<<31) // enable MOVETYPE_STEP interpolation based on position history. Incompatible with ENGINE_COMPUTE_STUDIO_LERP!
|
||||
|
||||
// adjust the mask when features will be added or removed
|
||||
#define ENGINE_FEATURES_MASK \
|
||||
( ENGINE_WRITE_LARGE_COORD \
|
||||
| ENGINE_QUAKE_COMPATIBLE \
|
||||
| ENGINE_LOAD_DELUXEDATA \
|
||||
| ENGINE_PHYSICS_PUSHER_EXT \
|
||||
| ENGINE_LARGE_LIGHTMAPS \
|
||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||
| ENGINE_IMPROVED_LINETRACE \
|
||||
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||
| ENGINE_STEP_POSHISTORY_LERP )
|
||||
|
||||
#endif//FEATURES_H
|
||||
|
||||
@@ -18,9 +18,6 @@ GNU General Public License for more details.
|
||||
|
||||
#define GFL_NOMODELS (1<<0)
|
||||
#define GFL_NOSKILLS (1<<1)
|
||||
#define GFL_RENDER_PICBUTTON_TEXT (1<<2)
|
||||
#define GFL_HD_BACKGROUND (1<<3)
|
||||
#define GFL_ANIMATED_TITLE (1<<4)
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
@@ -30,7 +27,7 @@ GAMEINFO stuff
|
||||
internal shared gameinfo structure (readonly for engine parts)
|
||||
========================================================================
|
||||
*/
|
||||
typedef struct GAMEINFO_s
|
||||
typedef struct
|
||||
{
|
||||
// filesystem info
|
||||
char gamefolder[64]; // used for change game '-game x'
|
||||
@@ -50,48 +47,4 @@ typedef struct GAMEINFO_s
|
||||
int gamemode;
|
||||
} GAMEINFO;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
Extended GameInfo struct introduced in Xash3D FWGS
|
||||
|
||||
GAMEINFO can't be reliably extended, as nor engine, nor menu can't be
|
||||
sure about struct size. By adding struct versioning, we can check the
|
||||
presense for extra fields.
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define GAMEINFO_VERSION 2
|
||||
|
||||
typedef enum gametype_e
|
||||
{
|
||||
GAME_NORMAL,
|
||||
GAME_SINGLEPLAYER_ONLY,
|
||||
GAME_MULTIPLAYER_ONLY,
|
||||
} gametype_t;
|
||||
|
||||
typedef struct gameinfo2_s
|
||||
{
|
||||
int gi_version; // should be set to desired struct version, e.g. GAMEINFO_VERSION
|
||||
|
||||
// filesystem info
|
||||
char gamefolder[64]; // used for change game
|
||||
char startmap[64]; // map to start singleplayer game from
|
||||
char trainmap[64]; // map to start hazardous course from (if specified)
|
||||
char demomap[64]; // map to start demo chapter from (if specified)
|
||||
char title[64]; // game title
|
||||
char iconpath[64]; // path to game icon
|
||||
char version[16]; // game version (optional)
|
||||
uint32_t flags; // gameinfo flags, extended to fit more flags
|
||||
|
||||
// mod info
|
||||
char game_url[256]; // link to a developer's site
|
||||
char update_url[256]; // link to updates page
|
||||
char type[64]; // single, toolkit, multiplayer, etc
|
||||
char date[64]; // release date
|
||||
uint64_t size; // size in bytes
|
||||
|
||||
gametype_t gamemode;
|
||||
} gameinfo2_t;
|
||||
|
||||
#endif//GAMEINFO_H
|
||||
|
||||
@@ -1,35 +1,18 @@
|
||||
/*
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
#ifndef KBUTTON_H
|
||||
#define KBUTTON_H
|
||||
|
||||
// a1ba: copied from WinQuake/client.h
|
||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// cl_input
|
||||
// Purpose:
|
||||
//
|
||||
typedef struct
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#if !defined( KBUTTONH )
|
||||
#define KBUTTONH
|
||||
#pragma once
|
||||
|
||||
typedef struct kbutton_s
|
||||
{
|
||||
int down[2]; // key nums holding it down
|
||||
int state; // low bit is down state
|
||||
} kbutton_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( kbutton_t, 12, 12 );
|
||||
|
||||
#endif // KBUTTON_H
|
||||
#endif // !KBUTTONH
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// Set this flag for things like broadcast requests, etc. where the engine should not
|
||||
// kill the request hook after receiving the first response
|
||||
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
|
||||
#define FNETAPI_LEGACY_PROTOCOL ( 1<<1 ) // xash3d-fwgs extension
|
||||
|
||||
struct net_response_s;
|
||||
typedef void (*net_api_response_func_t) ( struct net_response_s *response );
|
||||
@@ -36,7 +35,6 @@ typedef void (*net_api_response_func_t) ( struct net_response_s *response );
|
||||
#define NET_ERROR_TIMEOUT ( 1<<0 )
|
||||
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
|
||||
#define NET_ERROR_UNDEFINED ( 1<<2 )
|
||||
#define NET_ERROR_FORBIDDEN ( 1<<3 ) // xash3d-fwgs extension
|
||||
|
||||
typedef struct net_adrlist_s
|
||||
{
|
||||
|
||||
@@ -1,74 +1,37 @@
|
||||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
#ifndef NETADR_H
|
||||
#define NETADR_H
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NET_ADR_H
|
||||
#define NET_ADR_H
|
||||
|
||||
#include STDINT_H
|
||||
|
||||
// net.h -- quake's interface to the networking layer
|
||||
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6
|
||||
|
||||
#define PORT_ANY -1
|
||||
|
||||
typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;
|
||||
|
||||
/*
|
||||
Original Quake-2 structure:
|
||||
typedef struct
|
||||
typedef enum
|
||||
{
|
||||
netadrtype_t type;
|
||||
NA_UNUSED,
|
||||
NA_LOOPBACK,
|
||||
NA_BROADCAST,
|
||||
NA_IP,
|
||||
NA_IPX,
|
||||
NA_BROADCAST_IPX
|
||||
} netadrtype_t;
|
||||
|
||||
byte ip[4];
|
||||
byte ipx[10];
|
||||
|
||||
unsigned short port;
|
||||
} netadr_t;
|
||||
*/
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
typedef struct netadr_s
|
||||
{
|
||||
union
|
||||
{
|
||||
// IPv6 struct
|
||||
struct
|
||||
{
|
||||
uint16_t type6;
|
||||
uint8_t ip6[16];
|
||||
};
|
||||
struct
|
||||
{
|
||||
uint32_t type; // must be netadrtype_t but will break with short enums
|
||||
union
|
||||
{
|
||||
uint8_t ip[4];
|
||||
uint32_t ip4; // for easier conversions
|
||||
};
|
||||
uint8_t ipx[10];
|
||||
};
|
||||
};
|
||||
uint16_t port;
|
||||
netadrtype_t type;
|
||||
unsigned char ip[4];
|
||||
unsigned char ipx[10];
|
||||
unsigned short port;
|
||||
} netadr_t;
|
||||
#pragma pack( pop )
|
||||
|
||||
STATIC_CHECK_SIZEOF( netadr_t, 20, 20 );
|
||||
|
||||
#endif // NET_ADR_H
|
||||
#endif//NETADR_H
|
||||
|
||||
@@ -20,6 +20,8 @@ GNU General Public License for more details.
|
||||
#include "build.h"
|
||||
|
||||
#if !XASH_WIN32
|
||||
|
||||
|
||||
#if XASH_APPLE
|
||||
#include <sys/syslimits.h>
|
||||
#define OS_LIB_EXT "dylib"
|
||||
@@ -28,44 +30,97 @@ GNU General Public License for more details.
|
||||
#define OS_LIB_EXT "so"
|
||||
#define OPEN_COMMAND "xdg-open"
|
||||
#endif
|
||||
|
||||
#define OS_LIB_PREFIX "lib"
|
||||
|
||||
#if XASH_ANDROID
|
||||
//#if defined(LOAD_HARDFP)
|
||||
// #define POSTFIX "_hardfp"
|
||||
//#else
|
||||
#define POSTFIX
|
||||
//#endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
#define VGUI_SUPPORT_DLL "libvgui_support." OS_LIB_EXT
|
||||
|
||||
// Windows-specific
|
||||
#define __cdecl
|
||||
#define __stdcall
|
||||
#define _inline static inline
|
||||
|
||||
#if XASH_POSIX
|
||||
#include <unistd.h>
|
||||
#if XASH_NSWITCH
|
||||
#define SOLDER_LIBDL_COMPAT
|
||||
#include <solder.h>
|
||||
#elif XASH_PSVITA
|
||||
#define VRTLD_LIBDL_COMPAT
|
||||
#include <vrtld.h>
|
||||
#define O_BINARY 0
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#define HAVE_DUP
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#define O_TEXT 0
|
||||
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
||||
#endif
|
||||
#define _inline static inline
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
|
||||
#if XASH_POSIX
|
||||
#define PATH_SPLITTER "/"
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#define O_BINARY 0 // O_BINARY is Windows extension
|
||||
#define O_TEXT 0 // O_TEXT is Windows extension
|
||||
// Windows functions to posix equivalent
|
||||
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
||||
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
|
||||
#define GetProcAddress( x, y ) dlsym( x, y )
|
||||
#define FreeLibrary( x ) dlclose( x )
|
||||
#define tell( a ) lseek(a, 0, SEEK_CUR)
|
||||
#define HAVE_DUP
|
||||
#endif
|
||||
|
||||
#if XASH_DOS4GW
|
||||
#define PATH_SPLITTER "\\"
|
||||
#define LoadLibrary( x ) (0)
|
||||
#define GetProcAddress( x, y ) (0)
|
||||
#define FreeLibrary( x ) (0)
|
||||
#endif
|
||||
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
|
||||
#define max( a, b ) (((a) > (b)) ? (a) : (b))
|
||||
#define min( a, b ) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
/// TODO: check if we may clean this defines, it should not appear in non-platform code!
|
||||
typedef unsigned char BYTE;
|
||||
typedef short int WORD;
|
||||
typedef unsigned int DWORD;
|
||||
typedef int LONG;
|
||||
typedef unsigned int ULONG;
|
||||
typedef int WPARAM;
|
||||
typedef unsigned int LPARAM;
|
||||
|
||||
typedef void* HANDLE;
|
||||
typedef void* HMODULE;
|
||||
typedef void* HINSTANCE;
|
||||
|
||||
typedef char* LPSTR;
|
||||
|
||||
typedef struct tagPOINT
|
||||
{
|
||||
int x, y;
|
||||
} POINT;
|
||||
#else // WIN32
|
||||
#define PATH_SPLITTER "\\"
|
||||
#ifdef __MINGW32__
|
||||
#define _inline static inline
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define FORCEINLINE __forceinline
|
||||
#endif
|
||||
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define alloca _alloca
|
||||
|
||||
// shut-up compiler warnings
|
||||
#pragma warning(disable : 4244) // MIPS
|
||||
#pragma warning(disable : 4018) // signed/unsigned mismatch
|
||||
#pragma warning(disable : 4305) // truncation from const double to float
|
||||
#pragma warning(disable : 4115) // named type definition in parentheses
|
||||
#pragma warning(disable : 4100) // unreferenced formal parameter
|
||||
#pragma warning(disable : 4127) // conditional expression is constant
|
||||
#pragma warning(disable : 4057) // differs in indirection to slightly different base types
|
||||
#pragma warning(disable : 4201) // nonstandard extension used
|
||||
#pragma warning(disable : 4706) // assignment within conditional expression
|
||||
#pragma warning(disable : 4054) // type cast' : from function pointer
|
||||
#pragma warning(disable : 4310) // cast truncates constant value
|
||||
|
||||
#define HSPRITE WINAPI_HSPRITE
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
@@ -75,9 +130,13 @@ GNU General Public License for more details.
|
||||
#define OS_LIB_PREFIX ""
|
||||
#define OS_LIB_EXT "dll"
|
||||
#define VGUI_SUPPORT_DLL "../vgui_support." OS_LIB_EXT
|
||||
#ifdef XASH_64BIT
|
||||
// windows NameForFunction not implemented yet
|
||||
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
||||
#endif
|
||||
#define HAVE_DUP
|
||||
#endif //WIN32
|
||||
|
||||
#endif //WIN32
|
||||
#ifndef XASH_LOW_MEMORY
|
||||
#define XASH_LOW_MEMORY 0
|
||||
#endif
|
||||
|
||||
@@ -56,8 +56,6 @@ color24 gTracerColors[] =
|
||||
};
|
||||
*/
|
||||
|
||||
#define TRACER_COLORINDEX_DEFAULT 4
|
||||
|
||||
// Temporary entity array
|
||||
#define TENTPRIORITY_LOW 0
|
||||
#define TENTPRIORITY_HIGH 1
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef enum
|
||||
TF_KEEP_SOURCE = (1<<1), // some images keep source
|
||||
TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20
|
||||
TF_EXPAND_SOURCE = (1<<3), // Don't keep source as 8-bit expand to RGBA
|
||||
// reserved
|
||||
TF_ALLOW_EMBOSS = (1<<4), // Allow emboss-mapping for this image
|
||||
TF_RECTANGLE = (1<<5), // this is GL_TEXTURE_RECTANGLE
|
||||
TF_CUBEMAP = (1<<6), // it's cubemap texture
|
||||
TF_DEPTHMAP = (1<<7), // custom texture filter used
|
||||
@@ -107,8 +107,6 @@ typedef enum
|
||||
TF_ARB_FLOAT = (1<<26), // float textures
|
||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
||||
TF_MULTISAMPLE = (1<<29), // multisampling texture
|
||||
TF_ALLOW_NEAREST = (1<<30), // allows toggling nearest filtering for TF_NOMIPMAP textures
|
||||
} texFlags_t;
|
||||
|
||||
typedef enum
|
||||
@@ -162,7 +160,7 @@ struct ref_viewpass_s;
|
||||
typedef struct render_api_s
|
||||
{
|
||||
// Get renderer info (doesn't changes engine state at all)
|
||||
intptr_t (*RenderGetParm)( int parm, int arg ); // generic
|
||||
int (*RenderGetParm)( int parm, int arg ); // generic
|
||||
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );
|
||||
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );
|
||||
lightstyle_t* (*GetLightStyle)( int number );
|
||||
@@ -230,7 +228,7 @@ typedef struct render_api_s
|
||||
void (*R_Reserved0)( void );
|
||||
|
||||
// static allocations
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||
|
||||
// engine utils (not related with render API but placed here)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
synctype.h -- shared synctype_t definition
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 2023 Alibek Omarov
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef SYNCTYPE_H
|
||||
#define SYNCTYPE_H
|
||||
typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
|
||||
#endif
|
||||
@@ -2,19 +2,12 @@
|
||||
#ifndef XASH_TYPES_H
|
||||
#define XASH_TYPES_H
|
||||
|
||||
#include "build.h"
|
||||
|
||||
#if XASH_IRIX
|
||||
#include <port.h>
|
||||
#endif
|
||||
|
||||
#if XASH_WIN32
|
||||
#ifdef _WIN32
|
||||
#include <wchar.h> // off_t
|
||||
#endif // _WIN32
|
||||
|
||||
#include <sys/types.h> // off_t
|
||||
#include STDINT_H
|
||||
#include <assert.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef int sound_t;
|
||||
@@ -27,7 +20,6 @@ typedef byte rgba_t[4]; // unsigned byte colorpack
|
||||
typedef byte rgb_t[3]; // unsigned byte colorpack
|
||||
typedef vec_t matrix3x4[3][4];
|
||||
typedef vec_t matrix4x4[4][4];
|
||||
|
||||
typedef uint32_t poolhandle_t;
|
||||
|
||||
#undef true
|
||||
@@ -46,14 +38,15 @@ typedef uint64_t longtime_t;
|
||||
#define MAX_SERVERINFO_STRING 512 // server handles too many settings. expand to 1024?
|
||||
#define MAX_LOCALINFO_STRING 32768 // localinfo used on server and not sended to the clients
|
||||
#define MAX_SYSPATH 1024 // system filepath
|
||||
#define MAX_VA_STRING 1024 // string length returned by va()
|
||||
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Con_Printf or Con_DPrintf
|
||||
#define MAX_TOKEN 2048 // parse token length
|
||||
#define MAX_MODS 512 // environment games that engine can keep visible
|
||||
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
||||
|
||||
#define BIT( n ) ( 1U << ( n ))
|
||||
#define BIT64( n ) ( 1ULL << ( n ))
|
||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||
@@ -70,96 +63,22 @@ typedef uint64_t longtime_t;
|
||||
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
|
||||
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
||||
|
||||
#if defined( __GNUC__ )
|
||||
#if defined( __i386__ )
|
||||
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
||||
#define GAME_EXPORT __attribute(( force_align_arg_pointer ))
|
||||
#else
|
||||
#define EXPORT __attribute__(( visibility ( "default" )))
|
||||
#define GAME_EXPORT
|
||||
#endif
|
||||
|
||||
#define MALLOC __attribute__(( malloc ))
|
||||
|
||||
// added in GCC 11
|
||||
#if __GNUC__ >= 11
|
||||
// might want to set noclone due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116893
|
||||
// but it's easier to not force mismatched-dealloc to error yet
|
||||
#define MALLOC_LIKE( x, y ) __attribute__(( malloc( x, y )))
|
||||
#else
|
||||
#define MALLOC_LIKE( x, y ) MALLOC
|
||||
#endif
|
||||
#define NORETURN __attribute__(( noreturn ))
|
||||
#define NONNULL __attribute__(( nonnull ))
|
||||
#define _format( x ) __attribute__(( format( printf, x, x + 1 )))
|
||||
#define ALLOC_CHECK( x ) __attribute__(( alloc_size( x )))
|
||||
#define NO_ASAN __attribute__(( no_sanitize( "address" )))
|
||||
#define WARN_UNUSED_RESULT __attribute__(( warn_unused_result ))
|
||||
#define RENAME_SYMBOL( x ) asm( x )
|
||||
#if defined(__GNUC__)
|
||||
#ifdef __i386__
|
||||
#define EXPORT __attribute__ ((visibility ("default"),force_align_arg_pointer))
|
||||
#define GAME_EXPORT __attribute((force_align_arg_pointer))
|
||||
#else
|
||||
#if defined( _MSC_VER )
|
||||
#define EXPORT __declspec( dllexport )
|
||||
#define NO_ASAN __declspec( no_sanitize_address )
|
||||
#else
|
||||
#define EXPORT
|
||||
#define NO_ASAN
|
||||
#endif
|
||||
#define GAME_EXPORT
|
||||
#define NORETURN
|
||||
#define NONNULL
|
||||
#define _format( x )
|
||||
#define ALLOC_CHECK( x )
|
||||
#define RENAME_SYMBOL( x )
|
||||
#define MALLOC
|
||||
#define MALLOC_LIKE( x, y )
|
||||
#define WARN_UNUSED_RESULT
|
||||
#define EXPORT __attribute__ ((visibility ("default")))
|
||||
#define GAME_EXPORT
|
||||
#endif
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
#define unlikely( x ) __builtin_expect( x, 0 )
|
||||
#define likely( x ) __builtin_expect( x, 1 )
|
||||
#elif defined( __has_builtin )
|
||||
#if __has_builtin( __builtin_expect ) // this must be after defined() check
|
||||
#define unlikely( x ) __builtin_expect( x, 0 )
|
||||
#define likely( x ) __builtin_expect( x, 1 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined( unlikely ) || !defined( likely )
|
||||
#define unlikely( x ) ( x )
|
||||
#define likely( x ) ( x )
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
|
||||
#define STATIC_ASSERT static_assert
|
||||
#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert
|
||||
#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )
|
||||
#define STATIC_ASSERT _Static_assert
|
||||
#elif defined(_MSC_VER)
|
||||
#define EXPORT __declspec( dllexport )
|
||||
#define GAME_EXPORT
|
||||
#else
|
||||
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
||||
// need these to correctly expand the line macro
|
||||
#define STATIC_ASSERT_3( line, x, y ) STATIC_ASSERT_( static_assert_ ## line, x, y )
|
||||
#define STATIC_ASSERT_2( line, x, y ) STATIC_ASSERT_3( line, x, y )
|
||||
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_2( __LINE__, x, y )
|
||||
#define EXPORT
|
||||
#define GAME_EXPORT
|
||||
#endif
|
||||
|
||||
// at least, statically check size of some public structures
|
||||
#if XASH_64BIT
|
||||
#define STATIC_CHECK_SIZEOF( type, size32, size64 ) \
|
||||
STATIC_ASSERT( sizeof( type ) == size64, #type " unexpected size" )
|
||||
#else
|
||||
#define STATIC_CHECK_SIZEOF( type, size32, size64 ) \
|
||||
STATIC_ASSERT( sizeof( type ) == size32, #type " unexpected size" )
|
||||
#endif
|
||||
|
||||
#if !defined( __cplusplus ) && __STDC_VERSION__ >= 199101L // not C++ and C99 or newer
|
||||
#define XASH_RESTRICT restrict
|
||||
#elif _MSC_VER || __GNUC__ || __clang__ // compiler-specific extensions
|
||||
#define XASH_RESTRICT __restrict
|
||||
#else
|
||||
#define XASH_RESTRICT // nothing
|
||||
#endif
|
||||
|
||||
#ifdef XASH_BIG_ENDIAN
|
||||
#define LittleLong(x) (((int)(((x)&255)<<24)) + ((int)((((x)>>8)&255)<<16)) + ((int)(((x)>>16)&255)<<8) + (((x) >> 24)&255))
|
||||
@@ -191,18 +110,13 @@ _inline float LittleFloat( float f )
|
||||
#endif
|
||||
|
||||
|
||||
typedef unsigned int dword;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int dword;
|
||||
typedef unsigned int uint;
|
||||
typedef char string[MAX_STRING];
|
||||
typedef struct file_s file_t; // normal file
|
||||
typedef struct wfile_s wfile_t; // wad file
|
||||
typedef struct stream_s stream_t; // sound stream for background music playing
|
||||
typedef off_t fs_offset_t;
|
||||
#if XASH_WIN32
|
||||
typedef int fs_size_t; // return type of _read, _write funcs
|
||||
#else /* !XASH_WIN32 */
|
||||
typedef ssize_t fs_size_t;
|
||||
#endif /* !XASH_WIN32 */
|
||||
|
||||
typedef struct dllfunc_s
|
||||
{
|
||||
@@ -218,8 +132,7 @@ typedef struct dll_info_s
|
||||
void *link; // hinstance of loading library
|
||||
} dll_info_t;
|
||||
|
||||
typedef void (*setpair_t)( const char *key, const void *value, const void *buffer, void *numpairs );
|
||||
typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
||||
typedef void (*setpair_t)( const char *key, const void *value, void *buffer, void *numpairs );
|
||||
|
||||
// config strings are a general means of communication from
|
||||
// the server to all connected clients.
|
||||
|
||||
206
contrib/mittorn/Makefile.linux
Normal file
206
contrib/mittorn/Makefile.linux
Normal file
@@ -0,0 +1,206 @@
|
||||
#############################################
|
||||
# Makefile.linux - linux makefile
|
||||
# Copyright (C) 2017 mittorn
|
||||
|
||||
# This program is free software: you can redistribute it and/or 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 your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
##############################################
|
||||
|
||||
# Default options - optimized to debug on local machine
|
||||
CC ?= gcc
|
||||
CXX ?= g++
|
||||
CFLAGS ?= -g -O1 -fsigned-char -Wall -Wextra -Wsign-compare -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable
|
||||
LDFLAGS =
|
||||
LBITS := $(shell getconf LONG_BIT)
|
||||
DEPS :=
|
||||
|
||||
XASH_COMMIT := $(firstword $(shell git rev-parse --short=6 HEAD) unknown)
|
||||
|
||||
ifeq ($(XASH_COMMIT),unknown)
|
||||
$(warning You seems to build xash3d without git)
|
||||
$(warning Please use git if you are going to publish your build)
|
||||
endif
|
||||
|
||||
# Pass 64BIT=1 to make arguments to allow amd64 builds
|
||||
ifneq ($(64BIT),1)
|
||||
ifeq ($(LBITS),64)
|
||||
LDFLAGS += -m32
|
||||
CFLAGS += -m32
|
||||
endif
|
||||
endif
|
||||
|
||||
TOPDIR = $(PWD)/..
|
||||
INCLUDES :=
|
||||
XASH_SINGLE_BINARY ?= 1
|
||||
INSTALL_DIR ?= ./install/
|
||||
ifeq ($(NANOGL),1)
|
||||
INCLUDES += -Inanogl -Inanogl/GL
|
||||
endif
|
||||
INCLUDES += -I/usr/include/SDL2 -Icommon -I../common -I. -I../pm_shared -Iclient -Iserver -Iclient/vgui -Icommon/sdl
|
||||
|
||||
#############################
|
||||
# Preprocessor defines:
|
||||
#############################
|
||||
DEFINES =
|
||||
|
||||
# Specify commit hash in version string
|
||||
DEFINES += -DXASH_BUILD_COMMIT=\"$(XASH_COMMIT)\"
|
||||
|
||||
|
||||
# Only SDL backend exists on linux
|
||||
ifeq ($(XASH_DEDICATED),1)
|
||||
DEFINES += -DXASH_DEDICATED
|
||||
else
|
||||
DEFINES += -DXASH_SDL
|
||||
LIBS += -lSDL2
|
||||
endif
|
||||
|
||||
#############################################
|
||||
# GL/GLES translators.
|
||||
# You need clone it to engine folder to use
|
||||
# Only one translator should be enabled
|
||||
#############################################
|
||||
ifeq ($(NANOGL),1)
|
||||
DEFINES += -DXASH_NANOGL -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"libEGL.so\"
|
||||
endif
|
||||
|
||||
ifeq ($(WES),1)
|
||||
DEFINES += -DXASH_WES -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"libEGL.so\"
|
||||
endif
|
||||
|
||||
ifeq ($(REGAL),1)
|
||||
DEFINES += -DXASH_REGAL -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"regal/lib/linux-32/libRegal.so\"
|
||||
LIBS += regal/lib/linux-32/libRegal.so
|
||||
endif
|
||||
|
||||
# Some libc implementations cannot use libdl in static builds, so disable it by default
|
||||
ifeq ($(XASH_STATIC),1)
|
||||
|
||||
ifneq ($(XASH_STATIC_LIBDL),1)
|
||||
DEFINES += -DNO_LIBDL
|
||||
endif
|
||||
|
||||
XASH_SINGLE_BINARY := 1
|
||||
endif
|
||||
|
||||
ifneq ($(XASH_STATIC),1)
|
||||
LIBS += -ldl
|
||||
endif
|
||||
|
||||
ifeq ($(XASH_STATIC_LIBDL),1)
|
||||
LIBS += -ldl
|
||||
endif
|
||||
|
||||
LIBS += -lm -pthread
|
||||
|
||||
|
||||
ifeq ($(XASH_SINGLE_BINARY),1)
|
||||
DEFINES += -DSINGLE_BINARY
|
||||
endif
|
||||
|
||||
# Collect files
|
||||
SRCS_CPP =
|
||||
SRCS = $(wildcard server/*.c) $(wildcard client/vgui/*.c) $(wildcard client/avi/*.c) $(wildcard common/*.c) $(wildcard common/imagelib/*.c) $(wildcard common/soundlib/*.c) $(wildcard common/soundlib/libmpg/*.c)
|
||||
ifneq ($(XASH_DEDICATED),1)
|
||||
SRCS += $(wildcard client/*.c)
|
||||
SRCS += $(wildcard platform/sdl/*.c)
|
||||
ifeq ($(WES),1)
|
||||
SRCS += $(wildcard gl-wes-v2/src/*.c)
|
||||
endif
|
||||
ifeq ($(NANOGL),1)
|
||||
SRCS_CPP += $(wildcard nanogl/*.cpp)
|
||||
endif
|
||||
endif
|
||||
OBJS = $(patsubst %.c,obj/%.o,$(SRCS))
|
||||
OBJS_CPP = $(patsubst %.cpp,obj/%.o,$(SRCS_CPP))
|
||||
|
||||
#################################
|
||||
# Windows DLL loader
|
||||
# Should be enabled only on i386 builds
|
||||
#################################
|
||||
LOADER :=
|
||||
ifeq ($(XASH_DLL_LOADER),1)
|
||||
DEFINES += -DDLL_LOADER
|
||||
ifeq ($(XASH_SINGLE_BINARY),1)
|
||||
LOADER = libloader.a
|
||||
else
|
||||
LOADER = libloader.so
|
||||
endif
|
||||
DEPS += $(LOADER)
|
||||
LIBS += $(LOADER)
|
||||
endif
|
||||
|
||||
# Rules for binaries
|
||||
ifeq ($(XASH_SINGLE_BINARY),0)
|
||||
BINARIES = libxash.so
|
||||
libxash.so : $(OBJS) $(OBJS_CPP) $(DEPS)
|
||||
$(CC) -fvisibility=hidden -o libxash.so $(LDFLAGS) -shared $(OBJS) $(OBJS_CPP) $(LIBS)
|
||||
|
||||
else
|
||||
BINARIES = xash
|
||||
xash: $(OBJS) $(OBJS_CPP) $(DEPS)
|
||||
ifeq ($(XASH_STATIC),1)
|
||||
$(CC) -o xash -static $(LDFLAGS) $(OBJS) $(OBJS_CPP) $(LIBS)
|
||||
else
|
||||
$(CC) -o xash -fvisibility=hidden $(LDFLAGS) $(OBJS) $(OBJS_CPP) $(LIBS)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(XASH_DLL_LOADER),1)
|
||||
$(LOADER):
|
||||
$(MAKE) -f ../loader/Makefile.linux -C ../loader $(LOADER)
|
||||
cp ../loader/$(LOADER) .
|
||||
endif
|
||||
|
||||
# Create dirs for object files
|
||||
DIRS := obj obj/server obj/client/avi obj/client/vgui obj/common/sdl obj/common/imagelib obj/common/soundlib/libmpg obj/platform/sdl obj/nanogl
|
||||
$(OBJS): | $(DIRS)
|
||||
|
||||
$(DIRS) :
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
# Object rules
|
||||
obj/%.o : %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c "$<" -o "$@" -Wno-unused-result -fvisibility=hidden
|
||||
|
||||
obj/%.o : %.cpp
|
||||
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -c "$<" -o "$@"
|
||||
|
||||
|
||||
default: $(BINARIES)
|
||||
|
||||
.PHONY: depend clean list install
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(OBJS_CPP) $(BINARIES) ../loader/*.o ../loader/*.a ../loader/*.so $(LOADER)
|
||||
|
||||
list:
|
||||
@echo Sources:
|
||||
@echo $(SRCS)
|
||||
@echo C++ Sources:
|
||||
@echo $(SRCS_CPP)
|
||||
@echo Objects:
|
||||
@echo $(OBJS) $(OBJS_CPP)
|
||||
@echo Dirs:
|
||||
@echo $(DIRS)
|
||||
@echo Dependencies:
|
||||
@echo $(DEPS)
|
||||
|
||||
# Simple install rule
|
||||
install: $(BINARIES)
|
||||
mkdir -p $(INSTALL_DIR)
|
||||
|
||||
ifeq ($(XASH_SINGLE_BINARY),1)
|
||||
cp xash $(INSTALL_DIR)/xash_bin
|
||||
else
|
||||
cp libxash.so $(INSTALL_DIR)/
|
||||
cp libloader.so $(INSTALL_DIR)/
|
||||
endif
|
||||
269
contrib/mittorn/README.md
Normal file
269
contrib/mittorn/README.md
Normal file
@@ -0,0 +1,269 @@
|
||||
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
||||
|
||||
- [Building](#building)
|
||||
- [Manual build (without CMake)](#manual-build-without-cmake)
|
||||
- [Building Engine](#building-engine)
|
||||
- [Building launch binary](#building-launch-binary)
|
||||
- [Building on Windows](#building-on-windows)
|
||||
- [Visual Studio 2013 (recommended for Windows)](#visual-studio-2013-recommended-for-windows)
|
||||
- [Visual Studio 6](#visual-studio-6)
|
||||
- [MinGW](#mingw)
|
||||
- [Building Game mods](#building-game-mods)
|
||||
- [Linux](#linux)
|
||||
- [microndk](#microndk)
|
||||
- [Makefile.linux](#makefile-linux)
|
||||
- [Windows](#windows)
|
||||
- [Running](#running)
|
||||
- [Manual running](#manual-running)
|
||||
- [Running with GDB](#running-with-gdb)
|
||||
- [Using DLL Loader](#using-dll-loader)
|
||||
- [Running MinGW builds](#running-mingw-builds)
|
||||
- [Running MinGW builds under GDB](#running-mingw-builds-under-gdb)
|
||||
|
||||
# Building
|
||||
|
||||
## Manual build (without CMake)
|
||||
|
||||
### Building engine
|
||||
|
||||
Clone Xash3D repository using git:
|
||||
|
||||
git clone https://github.com/FWGS/xash3d
|
||||
|
||||
Move to the Xash3D folder:
|
||||
|
||||
cd xash3d/engine
|
||||
|
||||
make -f Makefile.linux XASH_VGUI=1
|
||||
|
||||
or same for dedicated
|
||||
|
||||
make -f Makefile.linux XASH_DEDICATED=1
|
||||
|
||||
To enable dll support on linux, build loader library:
|
||||
|
||||
cd ../loader
|
||||
make -f Makefile.linux libloader.so libloader.a
|
||||
cp libloader.so libloader.a ../engine/
|
||||
|
||||
And built engine with XASH_DLL_LOADER=1:
|
||||
|
||||
cd ../engine
|
||||
make -f Makefile.linux XASH_VGUI=1 XASH_SDL=1 XASH_DLL_LOADER=1
|
||||
|
||||
or same for dedicated server
|
||||
|
||||
cd ../engine
|
||||
make -f Makefile.linux XASH_DEDICATED=1 XASH_DLL_LOADER=1
|
||||
|
||||
### Building engine in separate library
|
||||
|
||||
Some old distros does not support hidden symbol visibility
|
||||
This results in crash when loading server library
|
||||
|
||||
Building launch binary
|
||||
|
||||
cd (xash3d)/game_launch
|
||||
gcc xash.c -o xash -ldl -lrt -lm
|
||||
|
||||
Building engine library:
|
||||
|
||||
make -f Makefile.linux XASH_SINGLE_BINARY=0
|
||||
|
||||
## Building on Windows
|
||||
|
||||
### Visual Studio 2013 (recommended for Windows)
|
||||
|
||||
Download latest prebuilt SDL2 from
|
||||
|
||||
https://www.libsdl.org/release/SDL2-devel-2.0.4-VC.zip
|
||||
|
||||
Unzip and rename `SDL2-2.0.4` folder to `SDL2` and put it next to xash3d project folder.
|
||||
|
||||
..\xash3d\
|
||||
..\SDL2\
|
||||
|
||||
Open `xash.sln` with Visual Studio 2013 and make a build. After building, copy contents of `Debug` or
|
||||
`Release` folder to directory you choose. Copy `valve` folder and `vgui.dll` from your Half Life game
|
||||
installation folder and `SDL2.dll` form `\SDL2\lib\x86\` to it.
|
||||
Move `vgui_support.dll` into `valve` folder.
|
||||
|
||||
..\valve\
|
||||
..\valve\vgui_support.dll
|
||||
..\menu.dll
|
||||
..\SDL2.dll
|
||||
..\vgui.dll
|
||||
..\xash.dll
|
||||
..\xash.exe
|
||||
|
||||
Now you good to go, just run `xash.exe`.
|
||||
|
||||
### Visual Studio 6
|
||||
|
||||
This is legacy configuration, but msvc6 seems to generate more stable and more effective code
|
||||
|
||||
Setup your msvc6 enviroment, unpack SDL2-2.0.4 to xash3d folder and do:
|
||||
|
||||
cd (xash3d)\engine
|
||||
..\msvc6\build.bat
|
||||
cd (xash3d)\game_launch
|
||||
..\msvc6\build_launch.bat
|
||||
|
||||
### MinGW
|
||||
|
||||
The most effective configuration, but maybe unstable.
|
||||
Setup your MinGW environment and run:
|
||||
|
||||
cd (xash3d)\engine\
|
||||
CC=gcc mingw32-make -f Makefile.mingw
|
||||
|
||||
engine will be built to single exe binary
|
||||
|
||||
## Building game mods
|
||||
|
||||
### Linux
|
||||
|
||||
#### microndk
|
||||
|
||||
All mods that ported to android may be build to linux using Android.mk with microndk:
|
||||
|
||||
[https://github.com/SDLash3D/microndk]
|
||||
|
||||
Clone microndk repo somewhere, change xash3d_config to preffered configuration (change arch to x86
|
||||
for example)
|
||||
|
||||
Go to dlls folder if you are building server or cl_dlls if you are building client and do:
|
||||
|
||||
make -f /path/to/microndk/microndk.mk -j4
|
||||
|
||||
Do:
|
||||
|
||||
make -f /path/to/microndk/microndk.mk -j4 clean
|
||||
|
||||
every time when you build client after building server
|
||||
|
||||
#### Makefile.linux
|
||||
|
||||
### Windows
|
||||
|
||||
On windows common way is using Visual Studio as many mods does not correctly work with mingw.
|
||||
|
||||
Just open project and build it.
|
||||
|
||||
Other is using mingw and microndk, but it was not tested yet.
|
||||
|
||||
hlsdk-xash3d based mods may work fine with mingw.
|
||||
|
||||
You may use microndk to build it. Build process is very similar to linux one.
|
||||
|
||||
After setting up MinGW enviroment, do:<br>
|
||||
`mingw32-make -f \path\to\microndk\Microndk.mk`
|
||||
|
||||
to build 64-bit library, use:<br>
|
||||
`mingw32-make -f \path\to\microndk\Microndk.mk 64BIT=1`
|
||||
|
||||
Edit xash3d_config.mk to set optimal CFLAGS if you are running server
|
||||
|
||||
# Running
|
||||
|
||||
Copy **valve** folder from Half-Life:
|
||||
|
||||
cp -r $HOME/.steam/steam/steamapps/common/Half-Life/valve $HOME/Games/Xash3D
|
||||
|
||||
**NOTE**: If you build with CMake, you can now use `make install`. It will install binaries where
|
||||
they must be located. So just run `xash3d` from command line in directory where is gamedata is located.
|
||||
For additional info look to the CMakeLists.txt in repo root and xash3d.sh script.
|
||||
|
||||
After a successful build, copy the next files to some other directory where you want to run Xash3D:
|
||||
|
||||
cp engine/libxash.so game_launch/xash3d mainui/libxashmenu.so $HOME/Games/Xash3D
|
||||
|
||||
If you built it with XASH_VGUI, also copy vgui.so:
|
||||
|
||||
cp ../hlsdk/linux/vgui.so vgui_support/libvgui_support.so $HOME/Games/Xash3D
|
||||
|
||||
Copy script:
|
||||
|
||||
cp ../xash3d.sh $HOME/Games/Xash3D
|
||||
|
||||
Run:
|
||||
|
||||
cd $HOME/Games/Xash3D
|
||||
./xash3d.sh
|
||||
|
||||
## Manual running
|
||||
|
||||
Put xash3d binaries and vgui(optionally) to you game data directory and run:
|
||||
|
||||
LD_LIBRARY_PATH=. ./xash -dev 5
|
||||
|
||||
## Running under GDB
|
||||
|
||||
LD_LIBRARY_PATH=. gdb --args ./xash -dev 5
|
||||
|
||||
## Using DLL Loader
|
||||
|
||||
Put vgui_support.dll from windows build to your game data folder and run:
|
||||
|
||||
LD_LIBRARY_PATH=. ./xash -dev 5 -vguilib vgui.dll -clientlib valve/cl_dlls/client.dll -dll dlls/hl.dll
|
||||
|
||||
## Running MinGW builds
|
||||
|
||||
Put exe file to your game data directory
|
||||
|
||||
cd (game)\
|
||||
xash_bin -dev 5
|
||||
|
||||
### Running MinGW builds under GDB
|
||||
|
||||
gdb --args ./xash_bin.exe -dev 5
|
||||
|
||||
# Useful GDB commands
|
||||
|
||||
Start or restart process:
|
||||
|
||||
(gdb) r
|
||||
|
||||
Show backtrace:
|
||||
|
||||
(gdb) bt
|
||||
|
||||
Full backtrace:
|
||||
|
||||
(gdb) bt full
|
||||
|
||||
Continue execution:
|
||||
|
||||
(gdb) c
|
||||
|
||||
Recover from segmentation fault:
|
||||
|
||||
Skipping function:
|
||||
|
||||
(gdb) handle SIGSEGV nopass
|
||||
(gdb) ret
|
||||
(gdb) c
|
||||
|
||||
Restart frame for beginning:
|
||||
|
||||
(gdb) handle SIGSEGV nopass
|
||||
(gdb) jump *Host_AbortCurrentFrame
|
||||
Anti-Crash script (useful for scripting servers):
|
||||
```
|
||||
cd /path/to/rootdir
|
||||
file xash
|
||||
set args xash -dev 5 -nowcon
|
||||
handle SIGSEGV nopass
|
||||
catch signal SIGSEGV
|
||||
set $crashes=0
|
||||
commands
|
||||
print $crashes++
|
||||
if $crashes > 500
|
||||
set $crashes=0
|
||||
run
|
||||
else
|
||||
jump *Host_AbortCurrentFrame
|
||||
end
|
||||
end
|
||||
run
|
||||
```
|
||||
7
contrib/mittorn/setup.sh
Executable file
7
contrib/mittorn/setup.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
SCRIPTDIR=$(dirname "$0")
|
||||
TOPDIR=$SCRIPTDIR/../../
|
||||
cp $SCRIPTDIR/Makefile.dllloader $TOPDIR/loader/
|
||||
cp $SCRIPTDIR/Makefile.emscripten $TOPDIR/engine/
|
||||
cp $SCRIPTDIR/Makefile.linux $TOPDIR/engine/
|
||||
cp $SCRIPTDIR/wscript $TOPDIR/engine/
|
||||
73
contrib/mittorn/wscript
Normal file
73
contrib/mittorn/wscript
Normal file
@@ -0,0 +1,73 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# mittorn, 2018
|
||||
|
||||
VERSION='0.99'
|
||||
APPNAME='xash3d-fwgs'
|
||||
|
||||
top = '.'
|
||||
|
||||
def options(opt):
|
||||
opt.load('compiler_c')
|
||||
# opt.load('msvs')
|
||||
opt.add_option('--dedicated', action = 'store_true', help = 'build dedicated server only' )
|
||||
opt.add_option('--64bits', dest = 'amd64', action = 'store_true', help = 'build 64-bit engine on x86_64' )
|
||||
|
||||
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_c')
|
||||
conf.env.append_unique('CFLAGS', '-O2')
|
||||
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
|
||||
conf.env.append_value('LINKFLAGS', '-ldl')
|
||||
conf.env.append_value('LINKFLAGS', '-lm')
|
||||
conf.env.append_value('LINKFLAGS', '-pthread')
|
||||
|
||||
# check for 64-bit builds
|
||||
# TODO: check 32-bit toolchain and dependencies
|
||||
if conf.env.DEST_CPU == 'x86_64' and not conf.options.amd64:
|
||||
conf.env.append_value('LINKFLAGS', '-m32')
|
||||
conf.env.append_value('CFLAGS', '-m32')
|
||||
print('NOTE: will build engine with 64-bit toolchain using -m32')
|
||||
else:
|
||||
print('Warning: 64bit engine may be unstable')
|
||||
|
||||
# check for dedicated server build
|
||||
if conf.options.dedicated:
|
||||
conf.env.append_unique('DEFINES', 'XASH_DEDICATED')
|
||||
conf.env.dedicated = True
|
||||
else:
|
||||
# TODO: add way to specify SDL2 path, move to separate function
|
||||
try:
|
||||
conf.check_cfg(path='sdl2-config', args='--cflags --libs', package='', msg='Checking for SDL2', uselib_store='SDL2')
|
||||
except conf.errors.ConfigurationError:
|
||||
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
|
||||
conf.env.append_unique('DEFINES', 'XASH_SDL')
|
||||
|
||||
def build(bld):
|
||||
# basic build: dedicated only, no dependencies
|
||||
use = [];
|
||||
source = bld.path.ant_glob([
|
||||
'common/*.c',
|
||||
'common/imagelib/*.c',
|
||||
'common/soundlib/*.c',
|
||||
'common/soundlib/libmpg/*.c',
|
||||
'server/*.c'])
|
||||
|
||||
# add client files and sdl2 library
|
||||
if not bld.env.dedicated:
|
||||
use += ['SDL2']
|
||||
source += bld.path.ant_glob([
|
||||
'client/*.c',
|
||||
'client/vgui/*.c',
|
||||
'client/avi/*.c',
|
||||
'platform/sdl/*.c'])
|
||||
|
||||
|
||||
bld(
|
||||
target = 'xash',
|
||||
features = 'c cprogram',
|
||||
includes = ['../common', '../pm_shared', 'common', 'server', 'client', 'client/vgui', '.' ],
|
||||
source = source,
|
||||
use = use
|
||||
)
|
||||
@@ -16,10 +16,6 @@
|
||||
#ifndef ALIAS_H
|
||||
#define ALIAS_H
|
||||
|
||||
#include "build.h"
|
||||
#include STDINT_H
|
||||
#include "synctype.h"
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
@@ -43,6 +39,16 @@ Alias models are position independent, so the cache manager can move them.
|
||||
#define ALIAS_TRACER2 0x0040 // orange split trail + rotate
|
||||
#define ALIAS_TRACER3 0x0080 // purple trail
|
||||
|
||||
// must match definition in sprite.h
|
||||
#ifndef SYNCTYPE_T
|
||||
#define SYNCTYPE_T
|
||||
typedef enum
|
||||
{
|
||||
ST_SYNC = 0,
|
||||
ST_RAND
|
||||
} synctype_t;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ALIAS_SINGLE = 0,
|
||||
@@ -57,42 +63,36 @@ typedef enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t ident;
|
||||
int32_t version;
|
||||
int ident;
|
||||
int version;
|
||||
vec3_t scale;
|
||||
vec3_t scale_origin;
|
||||
float boundingradius;
|
||||
vec3_t eyeposition;
|
||||
int32_t numskins;
|
||||
int32_t skinwidth;
|
||||
int32_t skinheight;
|
||||
int32_t numverts;
|
||||
int32_t numtris;
|
||||
int32_t numframes;
|
||||
uint32_t synctype; // was synctype_t
|
||||
int32_t flags;
|
||||
int numskins;
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int numverts;
|
||||
int numtris;
|
||||
int numframes;
|
||||
synctype_t synctype;
|
||||
int flags;
|
||||
float size;
|
||||
} daliashdr_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliashdr_t, 84, 84 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t onseam;
|
||||
int32_t s;
|
||||
int32_t t;
|
||||
int onseam;
|
||||
int s;
|
||||
int t;
|
||||
} stvert_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( stvert_t, 12, 12 );
|
||||
|
||||
typedef struct dtriangle_s
|
||||
{
|
||||
int32_t facesfront;
|
||||
int32_t vertindex[3];
|
||||
int facesfront;
|
||||
int vertindex[3];
|
||||
} dtriangle_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( dtriangle_t, 16, 16 );
|
||||
|
||||
#define DT_FACES_FRONT 0x0010
|
||||
#define ALIAS_ONSEAM 0x0020
|
||||
|
||||
@@ -103,50 +103,36 @@ typedef struct
|
||||
char name[16]; // frame name from grabbing
|
||||
} daliasframe_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasframe_t, 24, 24 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t numframes;
|
||||
int numframes;
|
||||
trivertex_t bboxmin; // lightnormal isn't used
|
||||
trivertex_t bboxmax; // lightnormal isn't used
|
||||
} daliasgroup_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasgroup_t, 12, 12 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t numskins;
|
||||
int numskins;
|
||||
} daliasskingroup_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasskingroup_t, 4, 4 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} daliasinterval_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasinterval_t, 4, 4 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} daliasskininterval_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasskininterval_t, 4, 4 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t type; // was aliasframetype_t
|
||||
aliasframetype_t type;
|
||||
} daliasframetype_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasframetype_t, 4, 4 );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t type; // was aliasskintype_t
|
||||
aliasskintype_t type;
|
||||
} daliasskintype_t;
|
||||
|
||||
STATIC_CHECK_SIZEOF( daliasskintype_t, 4, 4 );
|
||||
|
||||
#endif//ALIAS_H
|
||||
|
||||
356
engine/anorms.h
356
engine/anorms.h
@@ -1,181 +1,177 @@
|
||||
/*
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
{-0.525731, 0.000000, 0.850651},
|
||||
{-0.442863, 0.238856, 0.864188},
|
||||
{-0.295242, 0.000000, 0.955423},
|
||||
{-0.309017, 0.500000, 0.809017},
|
||||
{-0.162460, 0.262866, 0.951056},
|
||||
{0.000000, 0.000000, 1.000000},
|
||||
{0.000000, 0.850651, 0.525731},
|
||||
{-0.147621, 0.716567, 0.681718},
|
||||
{0.147621, 0.716567, 0.681718},
|
||||
{0.000000, 0.525731, 0.850651},
|
||||
{0.309017, 0.500000, 0.809017},
|
||||
{0.525731, 0.000000, 0.850651},
|
||||
{0.295242, 0.000000, 0.955423},
|
||||
{0.442863, 0.238856, 0.864188},
|
||||
{0.162460, 0.262866, 0.951056},
|
||||
{-0.681718, 0.147621, 0.716567},
|
||||
{-0.809017, 0.309017, 0.500000},
|
||||
{-0.587785, 0.425325, 0.688191},
|
||||
{-0.850651, 0.525731, 0.000000},
|
||||
{-0.864188, 0.442863, 0.238856},
|
||||
{-0.716567, 0.681718, 0.147621},
|
||||
{-0.688191, 0.587785, 0.425325},
|
||||
{-0.500000, 0.809017, 0.309017},
|
||||
{-0.238856, 0.864188, 0.442863},
|
||||
{-0.425325, 0.688191, 0.587785},
|
||||
{-0.716567, 0.681718, -0.147621},
|
||||
{-0.500000, 0.809017, -0.309017},
|
||||
{-0.525731, 0.850651, 0.000000},
|
||||
{0.000000, 0.850651, -0.525731},
|
||||
{-0.238856, 0.864188, -0.442863},
|
||||
{0.000000, 0.955423, -0.295242},
|
||||
{-0.262866, 0.951056, -0.162460},
|
||||
{0.000000, 1.000000, 0.000000},
|
||||
{0.000000, 0.955423, 0.295242},
|
||||
{-0.262866, 0.951056, 0.162460},
|
||||
{0.238856, 0.864188, 0.442863},
|
||||
{0.262866, 0.951056, 0.162460},
|
||||
{0.500000, 0.809017, 0.309017},
|
||||
{0.238856, 0.864188, -0.442863},
|
||||
{0.262866, 0.951056, -0.162460},
|
||||
{0.500000, 0.809017, -0.309017},
|
||||
{0.850651, 0.525731, 0.000000},
|
||||
{0.716567, 0.681718, 0.147621},
|
||||
{0.716567, 0.681718, -0.147621},
|
||||
{0.525731, 0.850651, 0.000000},
|
||||
{0.425325, 0.688191, 0.587785},
|
||||
{0.864188, 0.442863, 0.238856},
|
||||
{0.688191, 0.587785, 0.425325},
|
||||
{0.809017, 0.309017, 0.500000},
|
||||
{0.681718, 0.147621, 0.716567},
|
||||
{0.587785, 0.425325, 0.688191},
|
||||
{0.955423, 0.295242, 0.000000},
|
||||
{1.000000, 0.000000, 0.000000},
|
||||
{0.951056, 0.162460, 0.262866},
|
||||
{0.850651, -0.525731, 0.000000},
|
||||
{0.955423, -0.295242, 0.000000},
|
||||
{0.864188, -0.442863, 0.238856},
|
||||
{0.951056, -0.162460, 0.262866},
|
||||
{0.809017, -0.309017, 0.500000},
|
||||
{0.681718, -0.147621, 0.716567},
|
||||
{0.850651, 0.000000, 0.525731},
|
||||
{0.864188, 0.442863, -0.238856},
|
||||
{0.809017, 0.309017, -0.500000},
|
||||
{0.951056, 0.162460, -0.262866},
|
||||
{0.525731, 0.000000, -0.850651},
|
||||
{0.681718, 0.147621, -0.716567},
|
||||
{0.681718, -0.147621, -0.716567},
|
||||
{0.850651, 0.000000, -0.525731},
|
||||
{0.809017, -0.309017, -0.500000},
|
||||
{0.864188, -0.442863, -0.238856},
|
||||
{0.951056, -0.162460, -0.262866},
|
||||
{0.147621, 0.716567, -0.681718},
|
||||
{0.309017, 0.500000, -0.809017},
|
||||
{0.425325, 0.688191, -0.587785},
|
||||
{0.442863, 0.238856, -0.864188},
|
||||
{0.587785, 0.425325, -0.688191},
|
||||
{0.688191, 0.587785, -0.425325},
|
||||
{-0.147621, 0.716567, -0.681718},
|
||||
{-0.309017, 0.500000, -0.809017},
|
||||
{0.000000, 0.525731, -0.850651},
|
||||
{-0.525731, 0.000000, -0.850651},
|
||||
{-0.442863, 0.238856, -0.864188},
|
||||
{-0.295242, 0.000000, -0.955423},
|
||||
{-0.162460, 0.262866, -0.951056},
|
||||
{0.000000, 0.000000, -1.000000},
|
||||
{0.295242, 0.000000, -0.955423},
|
||||
{0.162460, 0.262866, -0.951056},
|
||||
{-0.442863, -0.238856, -0.864188},
|
||||
{-0.309017, -0.500000, -0.809017},
|
||||
{-0.162460, -0.262866, -0.951056},
|
||||
{0.000000, -0.850651, -0.525731},
|
||||
{-0.147621, -0.716567, -0.681718},
|
||||
{0.147621, -0.716567, -0.681718},
|
||||
{0.000000, -0.525731, -0.850651},
|
||||
{0.309017, -0.500000, -0.809017},
|
||||
{0.442863, -0.238856, -0.864188},
|
||||
{0.162460, -0.262866, -0.951056},
|
||||
{0.238856, -0.864188, -0.442863},
|
||||
{0.500000, -0.809017, -0.309017},
|
||||
{0.425325, -0.688191, -0.587785},
|
||||
{0.716567, -0.681718, -0.147621},
|
||||
{0.688191, -0.587785, -0.425325},
|
||||
{0.587785, -0.425325, -0.688191},
|
||||
{0.000000, -0.955423, -0.295242},
|
||||
{0.000000, -1.000000, 0.000000},
|
||||
{0.262866, -0.951056, -0.162460},
|
||||
{0.000000, -0.850651, 0.525731},
|
||||
{0.000000, -0.955423, 0.295242},
|
||||
{0.238856, -0.864188, 0.442863},
|
||||
{0.262866, -0.951056, 0.162460},
|
||||
{0.500000, -0.809017, 0.309017},
|
||||
{0.716567, -0.681718, 0.147621},
|
||||
{0.525731, -0.850651, 0.000000},
|
||||
{-0.238856, -0.864188, -0.442863},
|
||||
{-0.500000, -0.809017, -0.309017},
|
||||
{-0.262866, -0.951056, -0.162460},
|
||||
{-0.850651, -0.525731, 0.000000},
|
||||
{-0.716567, -0.681718, -0.147621},
|
||||
{-0.716567, -0.681718, 0.147621},
|
||||
{-0.525731, -0.850651, 0.000000},
|
||||
{-0.500000, -0.809017, 0.309017},
|
||||
{-0.238856, -0.864188, 0.442863},
|
||||
{-0.262866, -0.951056, 0.162460},
|
||||
{-0.864188, -0.442863, 0.238856},
|
||||
{-0.809017, -0.309017, 0.500000},
|
||||
{-0.688191, -0.587785, 0.425325},
|
||||
{-0.681718, -0.147621, 0.716567},
|
||||
{-0.442863, -0.238856, 0.864188},
|
||||
{-0.587785, -0.425325, 0.688191},
|
||||
{-0.309017, -0.500000, 0.809017},
|
||||
{-0.147621, -0.716567, 0.681718},
|
||||
{-0.425325, -0.688191, 0.587785},
|
||||
{-0.162460, -0.262866, 0.951056},
|
||||
{0.442863, -0.238856, 0.864188},
|
||||
{0.162460, -0.262866, 0.951056},
|
||||
{0.309017, -0.500000, 0.809017},
|
||||
{0.147621, -0.716567, 0.681718},
|
||||
{0.000000, -0.525731, 0.850651},
|
||||
{0.425325, -0.688191, 0.587785},
|
||||
{0.587785, -0.425325, 0.688191},
|
||||
{0.688191, -0.587785, 0.425325},
|
||||
{-0.955423, 0.295242, 0.000000},
|
||||
{-0.951056, 0.162460, 0.262866},
|
||||
{-1.000000, 0.000000, 0.000000},
|
||||
{-0.850651, 0.000000, 0.525731},
|
||||
{-0.955423, -0.295242, 0.000000},
|
||||
{-0.951056, -0.162460, 0.262866},
|
||||
{-0.864188, 0.442863, -0.238856},
|
||||
{-0.951056, 0.162460, -0.262866},
|
||||
{-0.809017, 0.309017, -0.500000},
|
||||
{-0.864188, -0.442863, -0.238856},
|
||||
{-0.951056, -0.162460, -0.262866},
|
||||
{-0.809017, -0.309017, -0.500000},
|
||||
{-0.681718, 0.147621, -0.716567},
|
||||
{-0.681718, -0.147621, -0.716567},
|
||||
{-0.850651, 0.000000, -0.525731},
|
||||
{-0.688191, 0.587785, -0.425325},
|
||||
{-0.587785, 0.425325, -0.688191},
|
||||
{-0.425325, 0.688191, -0.587785},
|
||||
{-0.425325, -0.688191, -0.587785},
|
||||
{-0.587785, -0.425325, -0.688191},
|
||||
{-0.688191, -0.587785, -0.425325},
|
||||
{-0.525731, 0.000000, 0.850651},
|
||||
{-0.442863, 0.238856, 0.864188},
|
||||
{-0.295242, 0.000000, 0.955423},
|
||||
{-0.309017, 0.500000, 0.809017},
|
||||
{-0.162460, 0.262866, 0.951056},
|
||||
{0.000000, 0.000000, 1.000000},
|
||||
{0.000000, 0.850651, 0.525731},
|
||||
{-0.147621, 0.716567, 0.681718},
|
||||
{0.147621, 0.716567, 0.681718},
|
||||
{0.000000, 0.525731, 0.850651},
|
||||
{0.309017, 0.500000, 0.809017},
|
||||
{0.525731, 0.000000, 0.850651},
|
||||
{0.295242, 0.000000, 0.955423},
|
||||
{0.442863, 0.238856, 0.864188},
|
||||
{0.162460, 0.262866, 0.951056},
|
||||
{-0.681718, 0.147621, 0.716567},
|
||||
{-0.809017, 0.309017, 0.500000},
|
||||
{-0.587785, 0.425325, 0.688191},
|
||||
{-0.850651, 0.525731, 0.000000},
|
||||
{-0.864188, 0.442863, 0.238856},
|
||||
{-0.716567, 0.681718, 0.147621},
|
||||
{-0.688191, 0.587785, 0.425325},
|
||||
{-0.500000, 0.809017, 0.309017},
|
||||
{-0.238856, 0.864188, 0.442863},
|
||||
{-0.425325, 0.688191, 0.587785},
|
||||
{-0.716567, 0.681718, -0.147621},
|
||||
{-0.500000, 0.809017, -0.309017},
|
||||
{-0.525731, 0.850651, 0.000000},
|
||||
{0.000000, 0.850651, -0.525731},
|
||||
{-0.238856, 0.864188, -0.442863},
|
||||
{0.000000, 0.955423, -0.295242},
|
||||
{-0.262866, 0.951056, -0.162460},
|
||||
{0.000000, 1.000000, 0.000000},
|
||||
{0.000000, 0.955423, 0.295242},
|
||||
{-0.262866, 0.951056, 0.162460},
|
||||
{0.238856, 0.864188, 0.442863},
|
||||
{0.262866, 0.951056, 0.162460},
|
||||
{0.500000, 0.809017, 0.309017},
|
||||
{0.238856, 0.864188, -0.442863},
|
||||
{0.262866, 0.951056, -0.162460},
|
||||
{0.500000, 0.809017, -0.309017},
|
||||
{0.850651, 0.525731, 0.000000},
|
||||
{0.716567, 0.681718, 0.147621},
|
||||
{0.716567, 0.681718, -0.147621},
|
||||
{0.525731, 0.850651, 0.000000},
|
||||
{0.425325, 0.688191, 0.587785},
|
||||
{0.864188, 0.442863, 0.238856},
|
||||
{0.688191, 0.587785, 0.425325},
|
||||
{0.809017, 0.309017, 0.500000},
|
||||
{0.681718, 0.147621, 0.716567},
|
||||
{0.587785, 0.425325, 0.688191},
|
||||
{0.955423, 0.295242, 0.000000},
|
||||
{1.000000, 0.000000, 0.000000},
|
||||
{0.951056, 0.162460, 0.262866},
|
||||
{0.850651, -0.525731, 0.000000},
|
||||
{0.955423, -0.295242, 0.000000},
|
||||
{0.864188, -0.442863, 0.238856},
|
||||
{0.951056, -0.162460, 0.262866},
|
||||
{0.809017, -0.309017, 0.500000},
|
||||
{0.681718, -0.147621, 0.716567},
|
||||
{0.850651, 0.000000, 0.525731},
|
||||
{0.864188, 0.442863, -0.238856},
|
||||
{0.809017, 0.309017, -0.500000},
|
||||
{0.951056, 0.162460, -0.262866},
|
||||
{0.525731, 0.000000, -0.850651},
|
||||
{0.681718, 0.147621, -0.716567},
|
||||
{0.681718, -0.147621, -0.716567},
|
||||
{0.850651, 0.000000, -0.525731},
|
||||
{0.809017, -0.309017, -0.500000},
|
||||
{0.864188, -0.442863, -0.238856},
|
||||
{0.951056, -0.162460, -0.262866},
|
||||
{0.147621, 0.716567, -0.681718},
|
||||
{0.309017, 0.500000, -0.809017},
|
||||
{0.425325, 0.688191, -0.587785},
|
||||
{0.442863, 0.238856, -0.864188},
|
||||
{0.587785, 0.425325, -0.688191},
|
||||
{0.688191, 0.587785, -0.425325},
|
||||
{-0.147621, 0.716567, -0.681718},
|
||||
{-0.309017, 0.500000, -0.809017},
|
||||
{0.000000, 0.525731, -0.850651},
|
||||
{-0.525731, 0.000000, -0.850651},
|
||||
{-0.442863, 0.238856, -0.864188},
|
||||
{-0.295242, 0.000000, -0.955423},
|
||||
{-0.162460, 0.262866, -0.951056},
|
||||
{0.000000, 0.000000, -1.000000},
|
||||
{0.295242, 0.000000, -0.955423},
|
||||
{0.162460, 0.262866, -0.951056},
|
||||
{-0.442863, -0.238856, -0.864188},
|
||||
{-0.309017, -0.500000, -0.809017},
|
||||
{-0.162460, -0.262866, -0.951056},
|
||||
{0.000000, -0.850651, -0.525731},
|
||||
{-0.147621, -0.716567, -0.681718},
|
||||
{0.147621, -0.716567, -0.681718},
|
||||
{0.000000, -0.525731, -0.850651},
|
||||
{0.309017, -0.500000, -0.809017},
|
||||
{0.442863, -0.238856, -0.864188},
|
||||
{0.162460, -0.262866, -0.951056},
|
||||
{0.238856, -0.864188, -0.442863},
|
||||
{0.500000, -0.809017, -0.309017},
|
||||
{0.425325, -0.688191, -0.587785},
|
||||
{0.716567, -0.681718, -0.147621},
|
||||
{0.688191, -0.587785, -0.425325},
|
||||
{0.587785, -0.425325, -0.688191},
|
||||
{0.000000, -0.955423, -0.295242},
|
||||
{0.000000, -1.000000, 0.000000},
|
||||
{0.262866, -0.951056, -0.162460},
|
||||
{0.000000, -0.850651, 0.525731},
|
||||
{0.000000, -0.955423, 0.295242},
|
||||
{0.238856, -0.864188, 0.442863},
|
||||
{0.262866, -0.951056, 0.162460},
|
||||
{0.500000, -0.809017, 0.309017},
|
||||
{0.716567, -0.681718, 0.147621},
|
||||
{0.525731, -0.850651, 0.000000},
|
||||
{-0.238856, -0.864188, -0.442863},
|
||||
{-0.500000, -0.809017, -0.309017},
|
||||
{-0.262866, -0.951056, -0.162460},
|
||||
{-0.850651, -0.525731, 0.000000},
|
||||
{-0.716567, -0.681718, -0.147621},
|
||||
{-0.716567, -0.681718, 0.147621},
|
||||
{-0.525731, -0.850651, 0.000000},
|
||||
{-0.500000, -0.809017, 0.309017},
|
||||
{-0.238856, -0.864188, 0.442863},
|
||||
{-0.262866, -0.951056, 0.162460},
|
||||
{-0.864188, -0.442863, 0.238856},
|
||||
{-0.809017, -0.309017, 0.500000},
|
||||
{-0.688191, -0.587785, 0.425325},
|
||||
{-0.681718, -0.147621, 0.716567},
|
||||
{-0.442863, -0.238856, 0.864188},
|
||||
{-0.587785, -0.425325, 0.688191},
|
||||
{-0.309017, -0.500000, 0.809017},
|
||||
{-0.147621, -0.716567, 0.681718},
|
||||
{-0.425325, -0.688191, 0.587785},
|
||||
{-0.162460, -0.262866, 0.951056},
|
||||
{0.442863, -0.238856, 0.864188},
|
||||
{0.162460, -0.262866, 0.951056},
|
||||
{0.309017, -0.500000, 0.809017},
|
||||
{0.147621, -0.716567, 0.681718},
|
||||
{0.000000, -0.525731, 0.850651},
|
||||
{0.425325, -0.688191, 0.587785},
|
||||
{0.587785, -0.425325, 0.688191},
|
||||
{0.688191, -0.587785, 0.425325},
|
||||
{-0.955423, 0.295242, 0.000000},
|
||||
{-0.951056, 0.162460, 0.262866},
|
||||
{-1.000000, 0.000000, 0.000000},
|
||||
{-0.850651, 0.000000, 0.525731},
|
||||
{-0.955423, -0.295242, 0.000000},
|
||||
{-0.951056, -0.162460, 0.262866},
|
||||
{-0.864188, 0.442863, -0.238856},
|
||||
{-0.951056, 0.162460, -0.262866},
|
||||
{-0.809017, 0.309017, -0.500000},
|
||||
{-0.864188, -0.442863, -0.238856},
|
||||
{-0.951056, -0.162460, -0.262866},
|
||||
{-0.809017, -0.309017, -0.500000},
|
||||
{-0.681718, 0.147621, -0.716567},
|
||||
{-0.681718, -0.147621, -0.716567},
|
||||
{-0.850651, 0.000000, -0.525731},
|
||||
{-0.688191, 0.587785, -0.425325},
|
||||
{-0.587785, 0.425325, -0.688191},
|
||||
{-0.425325, 0.688191, -0.587785},
|
||||
{-0.425325, -0.688191, -0.587785},
|
||||
{-0.587785, -0.425325, -0.688191},
|
||||
{-0.688191, -0.587785, -0.425325},
|
||||
|
||||
@@ -27,6 +27,7 @@ int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int leng
|
||||
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet );
|
||||
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio );
|
||||
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time );
|
||||
int AVI_GetVideoFrameCount( movie_state_t *Avi );
|
||||
void AVI_CloseVideo( movie_state_t *Avi );
|
||||
qboolean AVI_IsActive( movie_state_t *Avi );
|
||||
void AVI_FreeVideo( movie_state_t *Avi );
|
||||
|
||||
@@ -57,6 +57,11 @@ int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AVI_GetVideoFrameCount( movie_state_t *Avi )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AVI_CloseVideo( movie_state_t *Avi )
|
||||
{
|
||||
;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
avi_win.c - playing AVI files (based on original AVIKit code, Win32 version)
|
||||
Copyright (c) 2003-2004, Ruari O'Sullivan
|
||||
Copyright (C) 2010 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -64,7 +63,7 @@ static int (_stdcall *pAVIStreamTimeToSample)( PAVISTREAM pavi, LONG lTime );
|
||||
static void* (_stdcall *pAVIStreamGetFrame)( PGETFRAME pg, LONG lPos );
|
||||
static int (_stdcall *pAVIStreamGetFrameClose)( PGETFRAME pg );
|
||||
static dword (_stdcall *pAVIStreamRelease)( PAVISTREAM pavi );
|
||||
static int (_stdcall *pAVIFileOpenW)( PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode, LPCLSID lpHandler );
|
||||
static int (_stdcall *pAVIFileOpen)( PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, LPCLSID lpHandler );
|
||||
static int (_stdcall *pAVIFileGetStream)( PAVIFILE pfile, PAVISTREAM *ppavi, DWORD fccType, LONG lParam );
|
||||
static int (_stdcall *pAVIStreamReadFormat)( PAVISTREAM pavi, LONG lPos,LPVOID lpFormat, LONG *lpcbFormat );
|
||||
static int (_stdcall *pAVIStreamStart)( PAVISTREAM pavi );
|
||||
@@ -77,7 +76,7 @@ static dllfunc_t avifile_funcs[] =
|
||||
{ "AVIFileExit", (void **) &pAVIFileExit },
|
||||
{ "AVIFileGetStream", (void **) &pAVIFileGetStream },
|
||||
{ "AVIFileInit", (void **) &pAVIFileInit },
|
||||
{ "AVIFileOpenW", (void **) &pAVIFileOpenW },
|
||||
{ "AVIFileOpenA", (void **) &pAVIFileOpen },
|
||||
{ "AVIFileRelease", (void **) &pAVIFileRelease },
|
||||
{ "AVIStreamGetFrame", (void **) &pAVIStreamGetFrame },
|
||||
{ "AVIStreamGetFrameClose", (void **) &pAVIStreamGetFrameClose },
|
||||
@@ -279,6 +278,14 @@ int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
|
||||
return (time * Avi->video_fps);
|
||||
}
|
||||
|
||||
int AVI_GetVideoFrameCount( movie_state_t *Avi )
|
||||
{
|
||||
if( !Avi->active )
|
||||
return 0;
|
||||
|
||||
return Avi->video_frames;
|
||||
}
|
||||
|
||||
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
|
||||
{
|
||||
if( !Avi->active || !Avi->audio_stream )
|
||||
@@ -486,7 +493,6 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
|
||||
AVISTREAMINFO stream_info;
|
||||
int opened_streams = 0;
|
||||
LONG hr;
|
||||
wchar_t pathBuffer[MAX_PATH];
|
||||
|
||||
// default state: non-working.
|
||||
Avi->active = false;
|
||||
@@ -495,15 +501,8 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
|
||||
// can't load Video For Windows :-(
|
||||
if( !avi_initialized ) return;
|
||||
|
||||
// convert to wide char
|
||||
if( MultiByteToWideChar( CP_UTF8, 0, filename, -1, pathBuffer, ARRAYSIZE( pathBuffer )) <= 0 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "filename buffer limit exceeded\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// load the AVI
|
||||
hr = pAVIFileOpenW( &Avi->pfile, pathBuffer, OF_SHARE_DENY_WRITE, 0L );
|
||||
hr = pAVIFileOpen( &Avi->pfile, filename, OF_SHARE_DENY_WRITE, 0L );
|
||||
|
||||
if( hr != 0 ) // error opening AVI:
|
||||
{
|
||||
@@ -658,7 +657,7 @@ movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio )
|
||||
|
||||
// open cinematic
|
||||
Q_snprintf( path, sizeof( path ), "media/%s", filename );
|
||||
COM_DefaultExtension( path, ".avi", sizeof( path ));
|
||||
COM_DefaultExtension( path, ".avi" );
|
||||
fullpath = FS_GetDiskPath( path, false );
|
||||
|
||||
if( FS_FileExists( path, false ) && !fullpath )
|
||||
|
||||
@@ -85,12 +85,6 @@ void CL_PlayCDTrack_f( void )
|
||||
paused = false;
|
||||
looped = false;
|
||||
}
|
||||
else if( !Q_stricmp( command, "playfile" ))
|
||||
{
|
||||
S_StartBackgroundTrack( pszTrack, NULL, 0, true );
|
||||
paused = false;
|
||||
looped = false;
|
||||
}
|
||||
else if( !Q_stricmp( command, "loop" ))
|
||||
{
|
||||
if( Q_isdigit( pszTrack ))
|
||||
@@ -102,12 +96,6 @@ void CL_PlayCDTrack_f( void )
|
||||
paused = false;
|
||||
looped = true;
|
||||
}
|
||||
else if( !Q_stricmp( command, "loopfile" ))
|
||||
{
|
||||
S_StartBackgroundTrack( pszTrack, pszTrack, 0, true );
|
||||
paused = false;
|
||||
looped = true;
|
||||
}
|
||||
else if( !Q_stricmp( command, "pause" ))
|
||||
{
|
||||
S_StreamSetPause( true );
|
||||
@@ -146,7 +134,7 @@ void CL_PlayCDTrack_f( void )
|
||||
if( paused ) Con_Printf( "Paused %s track %u\n", looped ? "looping" : "playing", track );
|
||||
else Con_Printf( "Currently %s track %u\n", looped ? "looping" : "playing", track );
|
||||
}
|
||||
Con_Printf( "Volume is %f\n", s_musicvolume.value );
|
||||
Con_Printf( "Volume is %f\n", Cvar_VariableValue( "MP3Volume" ));
|
||||
return;
|
||||
}
|
||||
else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command );
|
||||
@@ -157,12 +145,36 @@ void CL_PlayCDTrack_f( void )
|
||||
CL_ScreenshotGetName
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filename, size_t size )
|
||||
qboolean CL_ScreenshotGetName( int lastnum, char *filename )
|
||||
{
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write screenshot\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return Q_snprintf( filename, size, fmt, clgame.mapname, lastnum ) > 0;
|
||||
Q_sprintf( filename, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SnapshotGetName
|
||||
==================
|
||||
*/
|
||||
qboolean CL_SnapshotGetName( int lastnum, char *filename )
|
||||
{
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write snapshot\n" );
|
||||
FS_AllowDirectPaths( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_sprintf( filename, "../%s_%04d.png", clgame.mapname, lastnum );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -172,6 +184,127 @@ static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filena
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
==================
|
||||
CL_ScreenShot_f
|
||||
|
||||
normal screenshot
|
||||
==================
|
||||
*/
|
||||
void CL_ScreenShot_f( void )
|
||||
{
|
||||
int i;
|
||||
string checkname;
|
||||
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
{
|
||||
// special case for write overview image and script file
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
||||
}
|
||||
else
|
||||
{
|
||||
// scan for a free filename
|
||||
for( i = 0; i < 9999; i++ )
|
||||
{
|
||||
if( !CL_ScreenshotGetName( i, checkname ))
|
||||
return; // no namespace
|
||||
|
||||
if( !FS_FileExists( checkname, false ))
|
||||
break;
|
||||
}
|
||||
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
||||
}
|
||||
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SnapShot_f
|
||||
|
||||
save screenshots into root dir
|
||||
==================
|
||||
*/
|
||||
void CL_SnapShot_f( void )
|
||||
{
|
||||
int i;
|
||||
string checkname;
|
||||
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
{
|
||||
// special case for write overview image and script file
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
||||
}
|
||||
else
|
||||
{
|
||||
FS_AllowDirectPaths( true );
|
||||
|
||||
// scan for a free filename
|
||||
for( i = 0; i < 9999; i++ )
|
||||
{
|
||||
if( !CL_SnapshotGetName( i, checkname ))
|
||||
return; // no namespace
|
||||
|
||||
if( !FS_FileExists( checkname, false ))
|
||||
break;
|
||||
}
|
||||
|
||||
FS_AllowDirectPaths( false );
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
cls.scrshot_action = scrshot_snapshot; // build new frame for screenshot
|
||||
}
|
||||
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_EnvShot_f
|
||||
|
||||
cubemap view
|
||||
==================
|
||||
*/
|
||||
void CL_EnvShot_f( void )
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "envshot <shotname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_sprintf( cls.shotname, "gfx/env/%s", Cmd_Argv( 1 ));
|
||||
cls.scrshot_action = scrshot_envshot; // build new frame for envshot
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SkyShot_f
|
||||
|
||||
skybox view
|
||||
==================
|
||||
*/
|
||||
void CL_SkyShot_f( void )
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "skyshot <shotname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_sprintf( cls.shotname, "gfx/env/%s", Cmd_Argv( 1 ));
|
||||
cls.scrshot_action = scrshot_skyshot; // build new frame for skyshot
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_LevelShot_f
|
||||
@@ -190,8 +323,7 @@ void CL_LevelShot_f( void )
|
||||
// check for exist
|
||||
if( cls.demoplayback && ( cls.demonum != -1 ))
|
||||
{
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ),
|
||||
"levelshots/%s_%s.bmp", cls.demoname, refState.wideScreen ? "16x9" : "4x3" );
|
||||
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", cls.demoname, refState.wideScreen ? "16x9" : "4x3" );
|
||||
Q_snprintf( filename, sizeof( filename ), "%s.dem", cls.demoname );
|
||||
|
||||
// make sure what levelshot is newer than demo
|
||||
@@ -200,8 +332,7 @@ void CL_LevelShot_f( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ),
|
||||
"levelshots/%s_%s.bmp", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" );
|
||||
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" );
|
||||
|
||||
// make sure what levelshot is newer than bsp
|
||||
ft1 = FS_FileTime( cl.worldmodel->name, false );
|
||||
@@ -214,107 +345,23 @@ void CL_LevelShot_f( void )
|
||||
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
||||
}
|
||||
|
||||
static scrshot_t CL_GetScreenshotTypeFromString( const char *string )
|
||||
/*
|
||||
==================
|
||||
CL_SaveShot_f
|
||||
|
||||
mini-pic in loadgame menu
|
||||
==================
|
||||
*/
|
||||
void CL_SaveShot_f( void )
|
||||
{
|
||||
if( !Q_stricmp( string, "snapshot" ))
|
||||
return scrshot_snapshot;
|
||||
|
||||
if( !Q_stricmp( string, "screenshot" ))
|
||||
return scrshot_normal;
|
||||
|
||||
if( !Q_stricmp( string, "saveshot" ))
|
||||
return scrshot_savegame;
|
||||
|
||||
if( !Q_stricmp( string, "envshot" ))
|
||||
return scrshot_envshot;
|
||||
|
||||
if( !Q_stricmp( string, "skyshot" ))
|
||||
return scrshot_skyshot;
|
||||
|
||||
return scrshot_inactive;
|
||||
}
|
||||
|
||||
void CL_GenericShot_f( void )
|
||||
{
|
||||
const char *argv0 = Cmd_Argv( 0 );
|
||||
scrshot_t type;
|
||||
|
||||
type = CL_GetScreenshotTypeFromString( argv0 );
|
||||
|
||||
if( type == scrshot_normal || type == scrshot_snapshot )
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
type = scrshot_mapshot;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "%s <shotname>\n", argv0 );
|
||||
return;
|
||||
}
|
||||
Con_Printf( S_USAGE "saveshot <savename>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case scrshot_envshot:
|
||||
case scrshot_skyshot:
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
||||
break;
|
||||
case scrshot_savegame:
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||
break;
|
||||
case scrshot_mapshot:
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
break;
|
||||
case scrshot_normal:
|
||||
case scrshot_snapshot:
|
||||
{
|
||||
const char *fmt;
|
||||
string checkname;
|
||||
int i;
|
||||
|
||||
// allow overriding screenshot by users request
|
||||
if( Cmd_Argc() > 1 )
|
||||
{
|
||||
Q_strncpy( cls.shotname, Cmd_Argv( 1 ), sizeof( cls.shotname ));
|
||||
break;
|
||||
}
|
||||
|
||||
if( type == scrshot_snapshot )
|
||||
{
|
||||
fmt = "../%s_%04d.png";
|
||||
FS_AllowDirectPaths( true );
|
||||
}
|
||||
else fmt = "scrshots/%s_shot%04d.png";
|
||||
|
||||
for( i = 0; i < 9999; i++ )
|
||||
{
|
||||
if( !CL_ScreenshotGetName( fmt, i, checkname, sizeof( checkname )))
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write %s\n", argv0 );
|
||||
FS_AllowDirectPaths( false );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !FS_FileExists( checkname, true ))
|
||||
break;
|
||||
}
|
||||
|
||||
FS_AllowDirectPaths( false );
|
||||
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
break;
|
||||
}
|
||||
case scrshot_inactive:
|
||||
case scrshot_plaque:
|
||||
default:
|
||||
return; // shouldn't happen
|
||||
}
|
||||
|
||||
cls.scrshot_action = type; // build new frame for saveshot
|
||||
cls.envshot_vieworg = NULL;
|
||||
cls.envshot_viewsize = 0;
|
||||
Q_sprintf( cls.shotname, DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -356,7 +403,7 @@ void CL_SetSky_f( void )
|
||||
return;
|
||||
}
|
||||
|
||||
R_SetupSky( Cmd_Argv( 1 ));
|
||||
ref.dllFuncs.R_SetupSky( Cmd_Argv( 1 ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -50,7 +50,7 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
||||
|
||||
if( !cl_allow_download.value )
|
||||
{
|
||||
Con_Reportf( "Download refused, cl_allowdownload is 0\n" );
|
||||
Con_Reportf( "Download refused, cl_allow_download is 0\n" );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -70,17 +70,16 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
||||
return true;
|
||||
}
|
||||
|
||||
host.downloadcount++;
|
||||
if( cl.downloadUrl[0] )
|
||||
{
|
||||
HTTP_AddDownload( filepath, pResource->nDownloadSize, true );
|
||||
host.downloadcount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( cl.http_download )
|
||||
{
|
||||
HTTP_AddDownload( filepath, pResource->nDownloadSize, true, pResource );
|
||||
}
|
||||
else
|
||||
{
|
||||
MSG_BeginClientCmd( msg, clc_stringcmd );
|
||||
MSG_WriteStringf( msg, "dlfile %s", filepath );
|
||||
}
|
||||
MSG_BeginClientCmd( msg, clc_stringcmd );
|
||||
MSG_WriteString( msg, va( "dlfile %s", filepath ));
|
||||
host.downloadcount++;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -105,9 +104,9 @@ void CL_AddToResourceList( resource_t *pResource, resource_t *pList )
|
||||
void CL_RemoveFromResourceList( resource_t *pResource )
|
||||
{
|
||||
if( pResource->pPrev == NULL || pResource->pNext == NULL )
|
||||
Host_Error( "mislinked resource in %s\n", __func__ );
|
||||
Host_Error( "mislinked resource in CL_RemoveFromResourceList\n" );
|
||||
|
||||
if( pResource->pNext == pResource || pResource->pPrev == pResource )
|
||||
if ( pResource->pNext == pResource || pResource->pPrev == pResource )
|
||||
Host_Error( "attempt to free last entry in list.\n" );
|
||||
|
||||
pResource->pPrev->pNext = pResource->pNext;
|
||||
@@ -120,7 +119,7 @@ void CL_MoveToOnHandList( resource_t *pResource )
|
||||
{
|
||||
if( !pResource )
|
||||
{
|
||||
Con_Reportf( "Null resource passed to %s\n", __func__ );
|
||||
Con_Reportf( "Null resource passed to CL_MoveToOnHandList\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,7 +127,7 @@ void CL_MoveToOnHandList( resource_t *pResource )
|
||||
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
||||
}
|
||||
|
||||
static void CL_ClearResourceList( resource_t *pList )
|
||||
void CL_ClearResourceList( resource_t *pList )
|
||||
{
|
||||
resource_t *p, *n;
|
||||
|
||||
|
||||
@@ -25,6 +25,70 @@ GNU General Public License for more details.
|
||||
#define MSG_COUNT 32 // last 32 messages parsed
|
||||
#define MSG_MASK (MSG_COUNT - 1)
|
||||
|
||||
const char *svc_strings[svc_lastmsg+1] =
|
||||
{
|
||||
"svc_bad",
|
||||
"svc_nop",
|
||||
"svc_disconnect",
|
||||
"svc_event",
|
||||
"svc_changing",
|
||||
"svc_setview",
|
||||
"svc_sound",
|
||||
"svc_time",
|
||||
"svc_print",
|
||||
"svc_stufftext",
|
||||
"svc_setangle",
|
||||
"svc_serverdata",
|
||||
"svc_lightstyle",
|
||||
"svc_updateuserinfo",
|
||||
"svc_deltatable",
|
||||
"svc_clientdata",
|
||||
"svc_resource",
|
||||
"svc_pings",
|
||||
"svc_particle",
|
||||
"svc_restoresound",
|
||||
"svc_spawnstatic",
|
||||
"svc_event_reliable",
|
||||
"svc_spawnbaseline",
|
||||
"svc_temp_entity",
|
||||
"svc_setpause",
|
||||
"svc_signonnum",
|
||||
"svc_centerprint",
|
||||
"svc_unused27",
|
||||
"svc_unused28",
|
||||
"svc_unused29",
|
||||
"svc_intermission",
|
||||
"svc_finale",
|
||||
"svc_cdtrack",
|
||||
"svc_restore",
|
||||
"svc_cutscene",
|
||||
"svc_weaponanim",
|
||||
"svc_bspdecal",
|
||||
"svc_roomtype",
|
||||
"svc_addangle",
|
||||
"svc_usermessage",
|
||||
"svc_packetentities",
|
||||
"svc_deltapacketentities",
|
||||
"svc_choke",
|
||||
"svc_resourcelist",
|
||||
"svc_deltamovevars",
|
||||
"svc_resourcerequest",
|
||||
"svc_customization",
|
||||
"svc_crosshairangle",
|
||||
"svc_soundfade",
|
||||
"svc_filetxferfailed",
|
||||
"svc_hltv",
|
||||
"svc_director",
|
||||
"svc_voiceinit",
|
||||
"svc_voicedata",
|
||||
"svc_deltapacketbones",
|
||||
"svc_unused55",
|
||||
"svc_resourcelocation",
|
||||
"svc_querycvarvalue",
|
||||
"svc_querycvarvalue2",
|
||||
"svc_exec",
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int command;
|
||||
@@ -45,34 +109,12 @@ const char *CL_MsgInfo( int cmd )
|
||||
{
|
||||
static string sz;
|
||||
|
||||
Q_strncpy( sz, "???", sizeof( sz ));
|
||||
Q_strcpy( sz, "???" );
|
||||
|
||||
if( cmd >= 0 && cmd <= svc_lastmsg )
|
||||
{
|
||||
// get engine message name
|
||||
const char *svc_string = NULL;
|
||||
|
||||
switch( cls.legacymode )
|
||||
{
|
||||
case PROTO_CURRENT:
|
||||
svc_string = svc_strings[cmd];
|
||||
break;
|
||||
case PROTO_LEGACY:
|
||||
svc_string = svc_legacy_strings[cmd];
|
||||
break;
|
||||
case PROTO_QUAKE:
|
||||
svc_string = svc_quake_strings[cmd];
|
||||
break;
|
||||
case PROTO_GOLDSRC:
|
||||
svc_string = svc_goldsrc_strings[cmd];
|
||||
break;
|
||||
}
|
||||
|
||||
// fall back to current protocol strings
|
||||
if( !svc_string )
|
||||
svc_string = svc_strings[cmd];
|
||||
|
||||
Q_strncpy( sz, svc_string, sizeof( sz ));
|
||||
Q_strncpy( sz, svc_strings[cmd], sizeof( sz ));
|
||||
}
|
||||
else if( cmd > svc_lastmsg && cmd <= ( svc_lastmsg + MAX_USER_MESSAGES ))
|
||||
{
|
||||
|
||||
@@ -40,8 +40,6 @@ GNU General Public License for more details.
|
||||
#define IDEMOHEADER (('M'<<24)+('E'<<16)+('D'<<8)+'I') // little-endian "IDEM"
|
||||
#define DEMO_PROTOCOL 3
|
||||
|
||||
#define PROTOCOL_GOLDSRC_VERSION_DEMO (PROTOCOL_GOLDSRC_VERSION | (BIT( 7 ))) // should be 48, only to differentiate it from PROTOCOL_LEGACY_VERSION
|
||||
|
||||
const char *demo_cmd[dem_lastcmd+1] =
|
||||
{
|
||||
"dem_unknown",
|
||||
@@ -81,7 +79,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
demoentry_t *entries; // track entry info
|
||||
int32_t numentries; // number of tracks
|
||||
int numentries; // number of tracks
|
||||
} demodirectory_t;
|
||||
|
||||
// add angles
|
||||
@@ -109,42 +107,6 @@ struct
|
||||
int angle_position;
|
||||
} demo;
|
||||
|
||||
static qboolean CL_NextDemo( void );
|
||||
|
||||
static int CL_GetDemoNetProtocol( connprotocol_t proto )
|
||||
{
|
||||
switch( proto )
|
||||
{
|
||||
case PROTO_CURRENT:
|
||||
return PROTOCOL_VERSION;
|
||||
case PROTO_LEGACY:
|
||||
return PROTOCOL_LEGACY_VERSION;
|
||||
case PROTO_QUAKE:
|
||||
return PROTOCOL_VERSION_QUAKE;
|
||||
case PROTO_GOLDSRC:
|
||||
return PROTOCOL_GOLDSRC_VERSION_DEMO;
|
||||
}
|
||||
|
||||
return PROTOCOL_VERSION;
|
||||
}
|
||||
|
||||
static connprotocol_t CL_GetProtocolFromDemo( int net_protocol )
|
||||
{
|
||||
switch( net_protocol )
|
||||
{
|
||||
case PROTOCOL_VERSION:
|
||||
return PROTO_CURRENT;
|
||||
case PROTOCOL_LEGACY_VERSION:
|
||||
return PROTO_LEGACY;
|
||||
case PROTOCOL_VERSION_QUAKE:
|
||||
return PROTO_QUAKE;
|
||||
case PROTOCOL_GOLDSRC_VERSION_DEMO:
|
||||
return PROTO_GOLDSRC;
|
||||
}
|
||||
|
||||
return PROTO_CURRENT;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_StartupDemoHeader
|
||||
@@ -155,8 +117,12 @@ we record a demo on this level
|
||||
*/
|
||||
void CL_StartupDemoHeader( void )
|
||||
{
|
||||
CL_CloseDemoHeader();
|
||||
if( cls.demoheader )
|
||||
{
|
||||
FS_Close( cls.demoheader );
|
||||
}
|
||||
|
||||
// Note: this is replacing tmpfile()
|
||||
cls.demoheader = FS_Open( "demoheader.tmp", "w+b", true );
|
||||
|
||||
if( !cls.demoheader )
|
||||
@@ -190,7 +156,7 @@ CL_GetDemoRecordClock
|
||||
write time while demo is recording
|
||||
====================
|
||||
*/
|
||||
static float CL_GetDemoRecordClock( void )
|
||||
float CL_GetDemoRecordClock( void )
|
||||
{
|
||||
return cl.mtime[0];
|
||||
}
|
||||
@@ -202,7 +168,7 @@ CL_GetDemoPlaybackClock
|
||||
overwrite host.realtime
|
||||
====================
|
||||
*/
|
||||
static float CL_GetDemoPlaybackClock( void )
|
||||
float CL_GetDemoPlaybackClock( void )
|
||||
{
|
||||
return host.realtime + host.frametime;
|
||||
}
|
||||
@@ -228,7 +194,7 @@ CL_WriteDemoCmdHeader
|
||||
Writes the demo command header and time-delta
|
||||
====================
|
||||
*/
|
||||
static void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
||||
void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
||||
{
|
||||
float dt;
|
||||
|
||||
@@ -285,7 +251,7 @@ void CL_WriteDemoUserCmd( int cmdnumber )
|
||||
|
||||
// write usercmd_t
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
CL_WriteUsercmd( PROTO_CURRENT, &buf, -1, cmdnumber ); // always no delta, always in current protocol
|
||||
CL_WriteUsercmd( &buf, -1, cmdnumber ); // always no delta
|
||||
|
||||
bytes = MSG_GetNumBytesWritten( &buf );
|
||||
|
||||
@@ -301,7 +267,7 @@ Save state of cls.netchan sequences
|
||||
so that we can play the demo correctly.
|
||||
====================
|
||||
*/
|
||||
static void CL_WriteDemoSequence( file_t *file )
|
||||
void CL_WriteDemoSequence( file_t *file )
|
||||
{
|
||||
Assert( file != NULL );
|
||||
|
||||
@@ -329,6 +295,10 @@ void CL_WriteDemoMessage( qboolean startup, int start, sizebuf_t *msg )
|
||||
|
||||
if( !file ) return;
|
||||
|
||||
// past the start but not recording a demo.
|
||||
if( !startup && !cls.demorecording )
|
||||
return;
|
||||
|
||||
swlen = MSG_GetNumBytesWritten( msg ) - start;
|
||||
if( swlen <= 0 ) return;
|
||||
|
||||
@@ -378,7 +348,7 @@ CL_WriteDemoHeader
|
||||
Write demo header
|
||||
====================
|
||||
*/
|
||||
static void CL_WriteDemoHeader( const char *name )
|
||||
void CL_WriteDemoHeader( const char *name )
|
||||
{
|
||||
int copysize;
|
||||
int savepos;
|
||||
@@ -401,8 +371,8 @@ static void CL_WriteDemoHeader( const char *name )
|
||||
|
||||
demo.header.id = IDEMOHEADER;
|
||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||
demo.header.net_protocol = CL_GetDemoNetProtocol( cls.legacymode );
|
||||
demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, MAX_FPS ) : MAX_FPS;
|
||||
demo.header.net_protocol = cls.legacymode ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION;
|
||||
demo.header.host_fps = bound( MIN_FPS, host_maxfps->value, MAX_FPS );
|
||||
Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
||||
Q_strncpy( demo.header.gamedir, FS_Gamedir(), sizeof( demo.header.gamedir ));
|
||||
@@ -421,7 +391,6 @@ static void CL_WriteDemoHeader( const char *name )
|
||||
|
||||
// finish off the startup info.
|
||||
CL_WriteDemoCmdHeader( dem_stop, cls.demoheader );
|
||||
FS_Flush( cls.demoheader );
|
||||
|
||||
// now copy the stuff we cached from the server.
|
||||
copysize = savepos = FS_Tell( cls.demoheader );
|
||||
@@ -467,7 +436,7 @@ CL_StopRecord
|
||||
finish recording demo
|
||||
=================
|
||||
*/
|
||||
static void CL_StopRecord( void )
|
||||
void CL_StopRecord( void )
|
||||
{
|
||||
int i, curpos;
|
||||
float stoptime;
|
||||
@@ -549,26 +518,14 @@ CL_ReadDemoCmdHeader
|
||||
read the demo command
|
||||
=================
|
||||
*/
|
||||
static qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||
void CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||
{
|
||||
// read the command
|
||||
// HACKHACK: skip NOPs
|
||||
do
|
||||
{
|
||||
FS_Read( cls.demofile, cmd, sizeof( byte ));
|
||||
} while( *cmd == dem_unknown );
|
||||
|
||||
if( *cmd > dem_lastcmd )
|
||||
{
|
||||
Con_Printf( S_ERROR "Demo cmd %d > %d, file offset = %d\n", *cmd, dem_lastcmd, (int)FS_Tell( cls.demofile ));
|
||||
CL_DemoCompleted();
|
||||
return false;
|
||||
}
|
||||
FS_Read( cls.demofile, cmd, sizeof( byte ));
|
||||
Assert( *cmd >= 1 && *cmd <= dem_lastcmd );
|
||||
|
||||
// read the timestamp
|
||||
FS_Read( cls.demofile, dt, sizeof( float ));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -579,7 +536,7 @@ read the demo usercmd for predicting
|
||||
and smooth movement during playback the demo
|
||||
=================
|
||||
*/
|
||||
static void CL_ReadDemoUserCmd( qboolean discard )
|
||||
void CL_ReadDemoUserCmd( qboolean discard )
|
||||
{
|
||||
byte data[1024];
|
||||
int cmdnumber;
|
||||
@@ -601,9 +558,6 @@ static void CL_ReadDemoUserCmd( qboolean discard )
|
||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
|
||||
// a1ba: I have no proper explanation why
|
||||
cmdnumber++;
|
||||
|
||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||
pcmd->processedfuncs = false;
|
||||
pcmd->senttime = 0.0f;
|
||||
@@ -644,7 +598,7 @@ CL_ReadDemoSequence
|
||||
read netchan sequences
|
||||
=================
|
||||
*/
|
||||
static void CL_ReadDemoSequence( qboolean discard )
|
||||
void CL_ReadDemoSequence( qboolean discard )
|
||||
{
|
||||
int incoming_sequence;
|
||||
int incoming_acknowledged;
|
||||
@@ -678,17 +632,15 @@ static void CL_ReadDemoSequence( qboolean discard )
|
||||
CL_DemoStartPlayback
|
||||
=================
|
||||
*/
|
||||
static void CL_DemoStartPlayback( int mode )
|
||||
void CL_DemoStartPlayback( int mode )
|
||||
{
|
||||
if( cls.changedemo )
|
||||
{
|
||||
int maxclients = cl.maxclients;
|
||||
|
||||
S_StopAllSounds( true );
|
||||
SCR_BeginLoadingPlaque( false );
|
||||
|
||||
CL_ClearState( );
|
||||
CL_InitEdicts( maxclients ); // re-arrange edicts
|
||||
CL_ClearState ();
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -708,7 +660,7 @@ static void CL_DemoStartPlayback( int mode )
|
||||
|
||||
demo.starttime = CL_GetDemoPlaybackClock(); // for determining whether to read another message
|
||||
|
||||
CL_SetupNetchanForProtocol( cls.legacymode );
|
||||
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableInteger( "net_qport" ), NULL, CL_GetFragmentSize );
|
||||
|
||||
memset( demo.cmds, 0, sizeof( demo.cmds ));
|
||||
demo.angle_position = 1;
|
||||
@@ -723,7 +675,7 @@ static void CL_DemoStartPlayback( int mode )
|
||||
CL_DemoAborted
|
||||
=================
|
||||
*/
|
||||
static void CL_DemoAborted( void )
|
||||
void CL_DemoAborted( void )
|
||||
{
|
||||
if( cls.demofile )
|
||||
FS_Close( cls.demofile );
|
||||
@@ -734,7 +686,7 @@ static void CL_DemoAborted( void )
|
||||
cls.demofile = NULL;
|
||||
cls.demonum = -1;
|
||||
|
||||
Cvar_DirectSet( &v_dark, "0" );
|
||||
Cvar_SetValue( "v_dark", 0.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -752,7 +704,7 @@ void CL_DemoCompleted( void )
|
||||
if( !CL_NextDemo() && !cls.changedemo )
|
||||
UI_SetActiveMenu( true );
|
||||
|
||||
Cvar_DirectSet( &v_dark, "0" );
|
||||
Cvar_SetValue( "v_dark", 0.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -763,7 +715,7 @@ returns true on success, false on failure
|
||||
g-cont. probably captain obvious mode is ON
|
||||
=================
|
||||
*/
|
||||
static qboolean CL_DemoMoveToNextSection( void )
|
||||
qboolean CL_DemoMoveToNextSection( void )
|
||||
{
|
||||
if( ++demo.entryIndex >= demo.directory.numentries )
|
||||
{
|
||||
@@ -785,7 +737,7 @@ static qboolean CL_DemoMoveToNextSection( void )
|
||||
return true;
|
||||
}
|
||||
|
||||
static qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||
{
|
||||
int msglen = 0;
|
||||
|
||||
@@ -836,7 +788,7 @@ CL_DemoReadMessageQuake
|
||||
reads demo data and write it to client
|
||||
=================
|
||||
*/
|
||||
static qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
||||
qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
||||
{
|
||||
vec3_t viewangles;
|
||||
int msglen = 0;
|
||||
@@ -936,7 +888,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
||||
qboolean swallowmessages = true;
|
||||
static int tdlastdemoframe = 0;
|
||||
byte *userbuf = NULL;
|
||||
size_t size = 0;
|
||||
size_t size;
|
||||
byte cmd;
|
||||
|
||||
if( !cls.demofile )
|
||||
@@ -961,8 +913,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
||||
if( !cls.demofile ) break;
|
||||
curpos = FS_Tell( cls.demofile );
|
||||
|
||||
if( !CL_ReadDemoCmdHeader( &cmd, &demo.timestamp ))
|
||||
return false;
|
||||
CL_ReadDemoCmdHeader( &cmd, &demo.timestamp );
|
||||
|
||||
fElapsedTime = CL_GetDemoPlaybackClock() - demo.starttime;
|
||||
if( !cls.timedemo ) bSkipMessage = ((demo.timestamp - cl_serverframetime()) >= fElapsedTime) ? true : false;
|
||||
@@ -1051,7 +1002,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
||||
return CL_ReadRawNetworkData( buffer, length );
|
||||
}
|
||||
|
||||
static void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||
void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||
{
|
||||
int i, i0, i1, imod;
|
||||
float at;
|
||||
@@ -1146,9 +1097,8 @@ CL_FinishTimeDemo
|
||||
show stats
|
||||
==============
|
||||
*/
|
||||
static void CL_FinishTimeDemo( void )
|
||||
void CL_FinishTimeDemo( void )
|
||||
{
|
||||
qboolean temp = host.allow_console;
|
||||
int frames;
|
||||
double time;
|
||||
|
||||
@@ -1159,12 +1109,7 @@ static void CL_FinishTimeDemo( void )
|
||||
time = host.realtime - cls.td_starttime;
|
||||
if( !time ) time = 1.0;
|
||||
|
||||
host.allow_console = true;
|
||||
Con_Printf( "timedemo result: %i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
|
||||
host.allow_console = temp;
|
||||
|
||||
if( Sys_CheckParm( "-timedemo" ))
|
||||
CL_Quit_f();
|
||||
Con_Printf( "%i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1298,7 +1243,7 @@ CL_NextDemo
|
||||
Called when a demo finishes
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_NextDemo( void )
|
||||
qboolean CL_NextDemo( void )
|
||||
{
|
||||
char str[MAX_QPATH];
|
||||
|
||||
@@ -1348,7 +1293,7 @@ void CL_CheckStartupDemos( void )
|
||||
}
|
||||
|
||||
// run demos loop in background mode
|
||||
Cvar_DirectSet( &v_dark, "1" );
|
||||
Cvar_SetValue( "v_dark", 1.0f );
|
||||
cls.demos_pending = false;
|
||||
cls.demonum = 0;
|
||||
CL_NextDemo ();
|
||||
@@ -1359,16 +1304,16 @@ void CL_CheckStartupDemos( void )
|
||||
CL_DemoGetName
|
||||
==================
|
||||
*/
|
||||
static void CL_DemoGetName( int lastnum, char *filename, size_t size )
|
||||
static void CL_DemoGetName( int lastnum, char *filename )
|
||||
{
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
// bound
|
||||
Q_strncpy( filename, "demo9999", size );
|
||||
Q_strcpy( filename, "demo9999" );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_snprintf( filename, size, "demo%04d", lastnum );
|
||||
Q_sprintf( filename, "demo%04d", lastnum );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1422,10 +1367,8 @@ void CL_Record_f( void )
|
||||
// scan for a free filename
|
||||
for( n = 0; n < 10000; n++ )
|
||||
{
|
||||
CL_DemoGetName( n, demoname, sizeof( demoname ));
|
||||
Q_snprintf( demopath, sizeof( demopath ), "%s.dem", demoname );
|
||||
|
||||
if( !FS_FileExists( demopath, true ))
|
||||
CL_DemoGetName( n, demoname );
|
||||
if( !FS_FileExists( va( "%s.dem", demoname ), true ))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1438,7 +1381,7 @@ void CL_Record_f( void )
|
||||
else Q_strncpy( demoname, name, sizeof( demoname ));
|
||||
|
||||
// open the demo file
|
||||
Q_snprintf( demopath, sizeof( demopath ), "%s.dem", demoname );
|
||||
Q_sprintf( demopath, "%s.dem", demoname );
|
||||
|
||||
// make sure that old demo is removed
|
||||
if( FS_FileExists( demopath, false ))
|
||||
@@ -1450,51 +1393,6 @@ void CL_Record_f( void )
|
||||
CL_WriteDemoHeader( demopath );
|
||||
}
|
||||
|
||||
static qboolean CL_ParseDemoHeader( const char *callee, const char *filename, file_t *f, demoheader_t *hdr, int32_t *numentries )
|
||||
{
|
||||
if( FS_Read( f, hdr, sizeof( *hdr )) != sizeof( *hdr ) || hdr->id != IDEMOHEADER )
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: %s is not in supported format or not a demo file\n", callee, filename );
|
||||
return false;
|
||||
}
|
||||
|
||||
// force null terminate strings
|
||||
hdr->mapname[sizeof( hdr->mapname ) - 1] = 0;
|
||||
hdr->comment[sizeof( hdr->comment ) - 1] = 0;
|
||||
hdr->gamedir[sizeof( hdr->gamedir ) - 1] = 0;
|
||||
|
||||
if( hdr->dem_protocol != DEMO_PROTOCOL )
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: demo protocol outdated (%i should be %i)\n",
|
||||
callee, hdr->net_protocol, DEMO_PROTOCOL );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( hdr->net_protocol != PROTOCOL_VERSION && hdr->net_protocol != PROTOCOL_LEGACY_VERSION && hdr->net_protocol != PROTOCOL_GOLDSRC_VERSION_DEMO )
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: net protocol outdated (%i should be %i or %i)\n",
|
||||
callee, hdr->net_protocol, PROTOCOL_VERSION, PROTOCOL_LEGACY_VERSION );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( FS_Seek( f, hdr->directory_offset, SEEK_SET ) < 0
|
||||
|| FS_Read( f, numentries, sizeof( *numentries )) != sizeof( *numentries ))
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: can't find directory offset in %s, demo file corrupted\n",
|
||||
callee, filename );
|
||||
return false;
|
||||
}
|
||||
|
||||
if(( *numentries < 1 ) || ( *numentries > 1024 ))
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: demo have bogus # of directory entries: %i\n",
|
||||
callee, *numentries );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_PlayDemo_f
|
||||
@@ -1510,12 +1408,14 @@ void CL_PlayDemo_f( void )
|
||||
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "%s <demoname>\n", Cmd_Argv( 0 ));
|
||||
Con_Printf( S_USAGE "playdemo <demoname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( cls.demoplayback )
|
||||
{
|
||||
CL_StopPlayback();
|
||||
}
|
||||
|
||||
if( cls.demorecording )
|
||||
{
|
||||
@@ -1555,7 +1455,7 @@ void CL_PlayDemo_f( void )
|
||||
{
|
||||
int c, neg = false;
|
||||
|
||||
demo.header.host_fps = host_maxfps.value;
|
||||
demo.header.host_fps = host_maxfps->value;
|
||||
|
||||
while(( c = FS_Getc( cls.demofile )) != '\n' )
|
||||
{
|
||||
@@ -1565,32 +1465,51 @@ void CL_PlayDemo_f( void )
|
||||
|
||||
if( neg ) cls.forcetrack = -cls.forcetrack;
|
||||
CL_DemoStartPlayback( DEMO_QUAKE1 );
|
||||
cls.legacymode = PROTO_QUAKE;
|
||||
return; // quake demo is started
|
||||
}
|
||||
|
||||
// read in the demo header
|
||||
if( !CL_ParseDemoHeader( Cmd_Argv( 0 ), filename, cls.demofile, &demo.header, &demo.directory.numentries ))
|
||||
FS_Read( cls.demofile, &demo.header, sizeof( demoheader_t ));
|
||||
|
||||
if( demo.header.id != IDEMOHEADER )
|
||||
{
|
||||
Con_Printf( S_ERROR "%s is not a demo file\n", demoname );
|
||||
CL_DemoAborted();
|
||||
return;
|
||||
}
|
||||
|
||||
if( demo.header.dem_protocol != DEMO_PROTOCOL )
|
||||
{
|
||||
Con_Printf( S_ERROR "playdemo: demo protocol outdated (%i should be %i)\n", demo.header.dem_protocol, DEMO_PROTOCOL );
|
||||
CL_DemoAborted();
|
||||
return;
|
||||
}
|
||||
|
||||
if( demo.header.net_protocol != PROTOCOL_VERSION &&
|
||||
demo.header.net_protocol != PROTOCOL_LEGACY_VERSION )
|
||||
{
|
||||
Con_Printf( S_ERROR "playdemo: net protocol outdated (%i should be %i)\n", demo.header.net_protocol, PROTOCOL_VERSION );
|
||||
CL_DemoAborted();
|
||||
return;
|
||||
}
|
||||
|
||||
// now read in the directory structure.
|
||||
FS_Seek( cls.demofile, demo.header.directory_offset, SEEK_SET );
|
||||
FS_Read( cls.demofile, &demo.directory.numentries, sizeof( int ));
|
||||
|
||||
if( demo.directory.numentries < 1 || demo.directory.numentries > 1024 )
|
||||
{
|
||||
Con_Printf( S_ERROR "demo had bogus # of directory entries: %i\n", demo.directory.numentries );
|
||||
CL_DemoAborted();
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate demo entries
|
||||
demo.directory.entries = Mem_Malloc( cls.mempool, sizeof( *demo.directory.entries ) * demo.directory.numentries );
|
||||
demo.directory.entries = Mem_Malloc( cls.mempool, sizeof( demoentry_t ) * demo.directory.numentries );
|
||||
|
||||
for( i = 0; i < demo.directory.numentries; i++ )
|
||||
{
|
||||
demoentry_t *entry = &demo.directory.entries[i];
|
||||
|
||||
if( FS_Read( cls.demofile, entry, sizeof( *entry )) != sizeof( *entry ))
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: demo entry %i of %s corrupted", Cmd_Argv( 0 ), i, filename );
|
||||
CL_DemoAborted();
|
||||
return;
|
||||
}
|
||||
|
||||
entry->description[sizeof( entry->description ) - 1] = 0;
|
||||
FS_Read( cls.demofile, &demo.directory.entries[i], sizeof( demoentry_t ));
|
||||
}
|
||||
|
||||
demo.entryIndex = 0;
|
||||
@@ -1600,11 +1519,9 @@ void CL_PlayDemo_f( void )
|
||||
|
||||
CL_DemoStartPlayback( DEMO_XASH3D );
|
||||
|
||||
// must be after DemoStartPlayback, as CL_Disconnect_f resets the protocol
|
||||
cls.legacymode = CL_GetProtocolFromDemo( demo.header.net_protocol );
|
||||
|
||||
// g-cont. is this need?
|
||||
Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));
|
||||
cls.legacymode = demo.header.net_protocol == PROTOCOL_LEGACY_VERSION;
|
||||
|
||||
// begin a playback demo
|
||||
}
|
||||
@@ -1618,6 +1535,12 @@ timedemo <demoname>
|
||||
*/
|
||||
void CL_TimeDemo_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "timedemo <demoname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
CL_PlayDemo_f ();
|
||||
|
||||
// cls.td_starttime will be grabbed at the second frame of the demo, so
|
||||
@@ -1646,7 +1569,7 @@ void CL_StartDemos_f( void )
|
||||
c = Cmd_Argc() - 1;
|
||||
if( c > MAX_DEMOS )
|
||||
{
|
||||
Con_DPrintf( S_WARN "%s: max %i demos in demoloop\n", __func__, MAX_DEMOS );
|
||||
Con_DPrintf( S_WARN "Host_StartDemos: max %i demos in demoloop\n", MAX_DEMOS );
|
||||
c = MAX_DEMOS;
|
||||
}
|
||||
|
||||
@@ -1704,78 +1627,3 @@ void CL_Stop_f( void )
|
||||
S_StopBackgroundTrack();
|
||||
}
|
||||
}
|
||||
|
||||
void CL_ListDemo_f( void )
|
||||
{
|
||||
demoheader_t hdr;
|
||||
int32_t num_entries;
|
||||
file_t *f;
|
||||
char filename[MAX_QPATH];
|
||||
char demoname[MAX_QPATH];
|
||||
int i;
|
||||
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "%s <demoname>\n", Cmd_Argv( 0 ));
|
||||
return;
|
||||
}
|
||||
|
||||
Q_strncpy( demoname, Cmd_Argv( 1 ), sizeof( demoname ));
|
||||
COM_StripExtension( demoname );
|
||||
Q_snprintf( filename, sizeof( filename ), "%s.dem", demoname );
|
||||
|
||||
f = FS_Open( filename, "rb", true );
|
||||
if( !f )
|
||||
{
|
||||
Con_Printf( S_ERROR "couldn't open %s\n", filename );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !CL_ParseDemoHeader( Cmd_Argv( 0 ), filename, f, &hdr, &num_entries ))
|
||||
{
|
||||
FS_Close( f );
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf( "Demo contents for %s:\n"
|
||||
"\tProtocol: %i net/%i demo\n"
|
||||
"\tFPS: %g\n"
|
||||
"\tMap: %s\n"
|
||||
"\tComment: %s\n"
|
||||
"\tGame: %s\n",
|
||||
filename, hdr.net_protocol, hdr.dem_protocol, hdr.host_fps, hdr.mapname,
|
||||
hdr.comment, hdr.gamedir );
|
||||
|
||||
for( i = 0; i < num_entries; i++ )
|
||||
{
|
||||
demoentry_t entry;
|
||||
|
||||
Con_Printf( "Demo entry #%i:\n", i );
|
||||
|
||||
if( FS_Read( f, &entry, sizeof( entry )) != sizeof( entry ))
|
||||
{
|
||||
Con_Printf( S_ERROR "can't read demo entry\n" );
|
||||
FS_Close( f );
|
||||
return;
|
||||
}
|
||||
|
||||
entry.description[sizeof( entry.description ) - 1] = 0;
|
||||
|
||||
if( entry.entrytype == DEMO_STARTUP )
|
||||
{
|
||||
// startup entries don't have anything useful
|
||||
Con_Printf( "\tEntry type: " S_YELLOW "startup" S_DEFAULT "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf( "\tEntry type: " S_GREEN "normal" S_DEFAULT " (%i)\n"
|
||||
"\tEntry playback time/frames: %.2f seconds/%i frames\n"
|
||||
"\tEntry flags: 0x%x\n"
|
||||
"\tEntry description: %s\n",
|
||||
entry.entrytype, entry.playback_time, entry.playback_frames,
|
||||
entry.flags, entry.description );
|
||||
}
|
||||
}
|
||||
|
||||
FS_Close( f );
|
||||
}
|
||||
|
||||
@@ -28,50 +28,49 @@ GNU General Public License for more details.
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
#define NUM_EFRAGS_ALLOC 64 // alloc 64 efrags (1-2kb each alloc)
|
||||
|
||||
static efrag_t **lastlink;
|
||||
static mnode_t *r_pefragtopnode;
|
||||
static vec3_t r_emins, r_emaxs;
|
||||
static cl_entity_t *r_addent;
|
||||
static int cl_efrags_num;
|
||||
static efrag_t *cl_efrags;
|
||||
|
||||
static efrag_t *CL_AllocEfrags( int num )
|
||||
{
|
||||
int i;
|
||||
efrag_t *efrags;
|
||||
|
||||
if( !cl.worldmodel )
|
||||
{
|
||||
Host_Error( "%s: called with NULL world\n", __func__ );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( num == 0 )
|
||||
return NULL;
|
||||
|
||||
// set world to be the owner, so it will get automatically cleaned up
|
||||
efrags = Mem_Calloc( cl.worldmodel->mempool, sizeof( *efrags ) * num );
|
||||
|
||||
// initialize linked list
|
||||
for( i = 0; i < num - 1; i++ )
|
||||
efrags[i].entnext = &efrags[i + 1];
|
||||
|
||||
cl_efrags_num += num;
|
||||
|
||||
return efrags;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_ClearEfrags
|
||||
==============
|
||||
================
|
||||
R_RemoveEfrags
|
||||
|
||||
Call when removing an object from the world or moving it to another position
|
||||
================
|
||||
*/
|
||||
void CL_ClearEfrags( void )
|
||||
void R_RemoveEfrags( cl_entity_t *ent )
|
||||
{
|
||||
cl_efrags_num = 0;
|
||||
cl_efrags = NULL;
|
||||
efrag_t *ef, *old, *walk, **prev;
|
||||
|
||||
ef = ent->efrag;
|
||||
|
||||
while( ef )
|
||||
{
|
||||
prev = &ef->leaf->efrags;
|
||||
while( 1 )
|
||||
{
|
||||
walk = *prev;
|
||||
if( !walk ) break;
|
||||
|
||||
if( walk == ef )
|
||||
{
|
||||
// remove this fragment
|
||||
*prev = ef->leafnext;
|
||||
break;
|
||||
}
|
||||
else prev = &walk->leafnext;
|
||||
}
|
||||
|
||||
old = ef;
|
||||
ef = ef->entnext;
|
||||
|
||||
// put it on the free list
|
||||
old->entnext = clgame.free_efrags;
|
||||
clgame.free_efrags = old;
|
||||
}
|
||||
ent->efrag = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -97,11 +96,14 @@ static void R_SplitEntityOnNode( mnode_t *node )
|
||||
leaf = (mleaf_t *)node;
|
||||
|
||||
// grab an efrag off the free list
|
||||
ef = cl_efrags;
|
||||
ef = clgame.free_efrags;
|
||||
if( !ef )
|
||||
ef = CL_AllocEfrags( NUM_EFRAGS_ALLOC );
|
||||
{
|
||||
Con_Printf( S_ERROR "too many efrags!\n" );
|
||||
return; // no free fragments...
|
||||
}
|
||||
|
||||
cl_efrags = ef->entnext;
|
||||
clgame.free_efrags = ef->entnext;
|
||||
ef->entity = r_addent;
|
||||
|
||||
// add the entity link
|
||||
@@ -171,29 +173,37 @@ R_StoreEfrags
|
||||
*/
|
||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount )
|
||||
{
|
||||
efrag_t *pefrag;
|
||||
cl_entity_t *pent;
|
||||
model_t *clmodel;
|
||||
cl_entity_t *pent;
|
||||
model_t *clmodel;
|
||||
efrag_t *pefrag;
|
||||
|
||||
while(( pefrag = *ppefrag ) != NULL )
|
||||
{
|
||||
pent = pefrag->entity;
|
||||
clmodel = pent->model;
|
||||
|
||||
// how this could happen?
|
||||
if( unlikely( clmodel->type < mod_brush || clmodel->type > mod_studio ))
|
||||
continue;
|
||||
|
||||
if( pent->visframe != framecount )
|
||||
switch( clmodel->type )
|
||||
{
|
||||
if( CL_AddVisibleEntity( pent, ET_FRAGMENTED ))
|
||||
{
|
||||
// mark that we've recorded this entity for this frame
|
||||
pent->curstate.messagenum = cl.parsecount;
|
||||
pent->visframe = framecount;
|
||||
}
|
||||
}
|
||||
case mod_alias:
|
||||
case mod_brush:
|
||||
case mod_studio:
|
||||
case mod_sprite:
|
||||
pent = pefrag->entity;
|
||||
|
||||
ppefrag = &pefrag->leafnext;
|
||||
if( pent->visframe != framecount )
|
||||
{
|
||||
if( CL_AddVisibleEntity( pent, ET_FRAGMENTED ))
|
||||
{
|
||||
// mark that we've recorded this entity for this frame
|
||||
pent->curstate.messagenum = cl.parsecount;
|
||||
pent->visframe = framecount;
|
||||
}
|
||||
}
|
||||
|
||||
ppefrag = &pefrag->leafnext;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "r_efx.h"
|
||||
#include "cl_tent.h"
|
||||
#include "pm_local.h"
|
||||
#define PART_SIZE Q_max( 0.5f, cl_draw_particles.value )
|
||||
#define PART_SIZE Q_max( 0.5f, cl_draw_particles->value )
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
@@ -21,20 +21,17 @@ static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
|
||||
static int ramp3[6] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
||||
static int gSparkRamp[9] = { 0xfe, 0xfd, 0xfc, 0x6f, 0x6e, 0x6d, 0x6c, 0x67, 0x60 };
|
||||
|
||||
static CVAR_DEFINE_AUTO( tracerspeed, "6000", 0, "tracer speed" );
|
||||
static CVAR_DEFINE_AUTO( tracerlength, "0.8", 0, "tracer length factor" );
|
||||
static CVAR_DEFINE_AUTO( traceroffset, "30", 0, "tracer starting offset" );
|
||||
convar_t *tracerspeed;
|
||||
convar_t *tracerlength;
|
||||
convar_t *traceroffset;
|
||||
|
||||
static particle_t *cl_active_particles;
|
||||
static particle_t *cl_active_tracers;
|
||||
static particle_t *cl_free_particles;
|
||||
static particle_t *cl_particles = NULL; // particle pool
|
||||
particle_t *cl_active_particles;
|
||||
particle_t *cl_active_tracers;
|
||||
particle_t *cl_free_particles;
|
||||
particle_t *cl_particles = NULL; // particle pool
|
||||
static vec3_t cl_avelocities[NUMVERTEXNORMALS];
|
||||
static float cl_lasttimewarn = 0.0f;
|
||||
|
||||
// expand debugging BBOX particle hulls by this many units.
|
||||
#define BOX_GAP 0.0f
|
||||
|
||||
/*
|
||||
================
|
||||
R_LookupColor
|
||||
@@ -49,7 +46,7 @@ short GAME_EXPORT R_LookupColor( byte r, byte g, byte b )
|
||||
float rf, gf, bf;
|
||||
|
||||
bestdiff = 999999;
|
||||
best = -1;
|
||||
best = 65535;
|
||||
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
@@ -103,9 +100,9 @@ void CL_InitParticles( void )
|
||||
cl_avelocities[i][2] = COM_RandomFloat( 0.0f, 2.55f );
|
||||
}
|
||||
|
||||
Cvar_RegisterVariable( &tracerspeed );
|
||||
Cvar_RegisterVariable( &tracerlength );
|
||||
Cvar_RegisterVariable( &traceroffset );
|
||||
tracerspeed = Cvar_Get( "tracerspeed", "6000", 0, "tracer speed" );
|
||||
tracerlength = Cvar_Get( "tracerlength", "0.8", 0, "tracer length factor" );
|
||||
traceroffset = Cvar_Get( "traceroffset", "30", 0, "tracer starting offset" );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -143,6 +140,26 @@ void CL_FreeParticles( void )
|
||||
cl_particles = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CL_FreeParticle
|
||||
|
||||
move particle to freelist
|
||||
================
|
||||
*/
|
||||
void CL_FreeParticle( particle_t *p )
|
||||
{
|
||||
if( p->deathfunc )
|
||||
{
|
||||
// call right the deathfunc before die
|
||||
p->deathfunc( p );
|
||||
p->deathfunc = NULL;
|
||||
}
|
||||
|
||||
p->next = cl_free_particles;
|
||||
cl_free_particles = p;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CL_AllocParticleFast
|
||||
@@ -174,11 +191,11 @@ particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float )
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
if( !cl_draw_particles.value )
|
||||
if( !cl_draw_particles->value )
|
||||
return NULL;
|
||||
|
||||
// never alloc particles when we not in game
|
||||
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||
// if( tr.frametime == 0.0 ) return NULL;
|
||||
|
||||
if( !cl_free_particles )
|
||||
{
|
||||
@@ -221,15 +238,15 @@ R_AllocTracer
|
||||
can return NULL if particles is out
|
||||
================
|
||||
*/
|
||||
static particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||
particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
if( !cl_draw_tracers.value )
|
||||
if( !cl_draw_tracers->value )
|
||||
return NULL;
|
||||
|
||||
// never alloc particles when we not in game
|
||||
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||
//if( tr.frametime == 0.0 ) return NULL;
|
||||
|
||||
if( !cl_free_particles )
|
||||
{
|
||||
@@ -252,8 +269,8 @@ static particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life
|
||||
VectorCopy( org, p->org );
|
||||
VectorCopy( vel, p->vel );
|
||||
p->die = cl.time + life;
|
||||
p->ramp = tracerlength.value;
|
||||
p->color = TRACER_COLORINDEX_DEFAULT; // select custom color
|
||||
p->ramp = tracerlength->value;
|
||||
p->color = 4; // select custom color
|
||||
p->packedColor = 255; // alpha
|
||||
|
||||
return p;
|
||||
@@ -265,9 +282,9 @@ VIEWBEAMS MANAGEMENT
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
static BEAM *cl_active_beams;
|
||||
static BEAM *cl_free_beams;
|
||||
static BEAM *cl_viewbeams = NULL; // beams pool
|
||||
BEAM *cl_active_beams;
|
||||
BEAM *cl_free_beams;
|
||||
BEAM *cl_viewbeams = NULL; // beams pool
|
||||
|
||||
|
||||
/*
|
||||
@@ -303,7 +320,7 @@ R_BeamAlloc
|
||||
|
||||
==============
|
||||
*/
|
||||
static BEAM *R_BeamAlloc( void )
|
||||
BEAM *R_BeamAlloc( void )
|
||||
{
|
||||
BEAM *pBeam;
|
||||
|
||||
@@ -326,7 +343,7 @@ R_BeamFree
|
||||
|
||||
==============
|
||||
*/
|
||||
static void R_BeamFree( BEAM *pBeam )
|
||||
void R_BeamFree( BEAM *pBeam )
|
||||
{
|
||||
// free particles that have died off.
|
||||
R_FreeDeadParticles( &pBeam->particles );
|
||||
@@ -608,7 +625,7 @@ CL_BeamAttemptToDie
|
||||
Check for expired beams
|
||||
==============
|
||||
*/
|
||||
static qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||
qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||
{
|
||||
Assert( pBeam != NULL );
|
||||
|
||||
@@ -639,24 +656,12 @@ and all particle trails (if this is a beamfollow)
|
||||
*/
|
||||
void GAME_EXPORT R_BeamKill( int deadEntity )
|
||||
{
|
||||
BEAM *beam;
|
||||
cl_entity_t *pDeadEntity;
|
||||
|
||||
for( beam = cl_active_beams; beam; beam = beam->next )
|
||||
{
|
||||
if( FBitSet( beam->flags, FBEAM_STARTENTITY ) && beam->startEntity == deadEntity )
|
||||
{
|
||||
if( beam->type != TE_BEAMFOLLOW )
|
||||
beam->die = cl.time;
|
||||
pDeadEntity = R_BeamGetEntity( deadEntity );
|
||||
if( !pDeadEntity ) return;
|
||||
|
||||
ClearBits( beam->flags, FBEAM_STARTENTITY );
|
||||
}
|
||||
|
||||
if( FBitSet( beam->flags, FBEAM_ENDENTITY ) && beam->endEntity == deadEntity )
|
||||
{
|
||||
beam->die = cl.time;
|
||||
ClearBits( beam->flags, FBEAM_ENDENTITY );
|
||||
}
|
||||
}
|
||||
CL_KillDeadBeams( pDeadEntity );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -678,46 +683,42 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
||||
switch( beamType )
|
||||
{
|
||||
case TE_BEAMPOINTS:
|
||||
case TE_BEAMENTPOINT:
|
||||
case TE_BEAMENTS:
|
||||
if( beamType == TE_BEAMENTS )
|
||||
{
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
endEnt = MSG_ReadShort( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( beamType == TE_BEAMENTPOINT )
|
||||
{
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
start[1] = MSG_ReadCoord( msg );
|
||||
start[2] = MSG_ReadCoord( msg );
|
||||
}
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
}
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
start[1] = MSG_ReadCoord( msg );
|
||||
start[2] = MSG_ReadCoord( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
life = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
width = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
noise = (float)MSG_ReadByte( msg ) * 0.01f;
|
||||
frameRate = (float)MSG_ReadByte( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
r = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
g = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
b = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
a = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
speed = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
if( beamType == TE_BEAMENTS )
|
||||
R_BeamEnts( startEnt, endEnt, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
else if( beamType == TE_BEAMENTPOINT )
|
||||
R_BeamEntPoint( startEnt, end, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
else
|
||||
R_BeamPoints( start, end, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
R_BeamPoints( start, end, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
break;
|
||||
case TE_BEAMENTPOINT:
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
r = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
g = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
b = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
a = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
R_BeamEntPoint( startEnt, end, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
break;
|
||||
case TE_LIGHTNING:
|
||||
start[0] = MSG_ReadCoord( msg );
|
||||
@@ -726,11 +727,27 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
||||
end[0] = MSG_ReadCoord( msg );
|
||||
end[1] = MSG_ReadCoord( msg );
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
life = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
width = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
noise = (float)MSG_ReadByte( msg ) * 0.01f;
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
R_BeamLightning( start, end, modelIndex, life, width, noise, 0.6f, 3.5f );
|
||||
R_BeamLightning( start, end, modelIndex, life, width, noise, 0.6F, 3.5f );
|
||||
break;
|
||||
case TE_BEAMENTS:
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
endEnt = MSG_ReadShort( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
r = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
g = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
b = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
a = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
R_BeamEnts( startEnt, endEnt, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
break;
|
||||
case TE_BEAM:
|
||||
break;
|
||||
@@ -756,21 +773,21 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
||||
end[2] = MSG_ReadCoord( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
life = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
width = (float)MSG_ReadByte( msg );
|
||||
noise = (float)MSG_ReadByte( msg ) * 0.01f;
|
||||
frameRate = (float)(MSG_ReadByte( msg ));
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ));
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
r = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
g = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
b = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
a = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
speed = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
speed = (float)(MSG_ReadByte( msg ) / 0.1f);
|
||||
R_BeamCirclePoints( beamType, start, end, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
break;
|
||||
case TE_BEAMFOLLOW:
|
||||
startEnt = MSG_ReadShort( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
life = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)MSG_ReadByte( msg );
|
||||
r = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
g = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
@@ -783,15 +800,15 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
|
||||
endEnt = MSG_ReadShort( msg );
|
||||
modelIndex = MSG_ReadShort( msg );
|
||||
startFrame = MSG_ReadByte( msg );
|
||||
frameRate = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
life = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
width = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
noise = (float)MSG_ReadByte( msg ) * 0.01f;
|
||||
frameRate = (float)MSG_ReadByte( msg );
|
||||
life = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
width = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
|
||||
r = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
g = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
b = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
a = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
speed = (float)MSG_ReadByte( msg ) * 0.1f;
|
||||
speed = (float)(MSG_ReadByte( msg ) * 0.1f);
|
||||
R_BeamRing( startEnt, endEnt, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
|
||||
break;
|
||||
case TE_BEAMHOSE:
|
||||
@@ -1106,11 +1123,9 @@ R_ParticleExplosion2
|
||||
void GAME_EXPORT R_ParticleExplosion2( const vec3_t org, int colorStart, int colorLength )
|
||||
{
|
||||
int i, j;
|
||||
int colorMod = 0, packedColor;
|
||||
int colorMod = 0;
|
||||
particle_t *p;
|
||||
|
||||
packedColor = Host_IsQuakeCompatible( ) ? 255 : 0; // use old code for blob particles
|
||||
|
||||
for( i = 0; i < 512; i++ )
|
||||
{
|
||||
p = R_AllocParticle( NULL );
|
||||
@@ -1118,7 +1133,7 @@ void GAME_EXPORT R_ParticleExplosion2( const vec3_t org, int colorStart, int col
|
||||
|
||||
p->die = cl.time + 0.3f;
|
||||
p->color = colorStart + ( colorMod % colorLength );
|
||||
p->packedColor = packedColor;
|
||||
p->packedColor = 255; // use old code for blob particles
|
||||
colorMod++;
|
||||
|
||||
p->type = pt_blob;
|
||||
@@ -1140,17 +1155,15 @@ R_BlobExplosion
|
||||
void GAME_EXPORT R_BlobExplosion( const vec3_t org )
|
||||
{
|
||||
particle_t *p;
|
||||
int i, j, packedColor;
|
||||
|
||||
packedColor = Host_IsQuakeCompatible( ) ? 255 : 0; // use old code for blob particles
|
||||
int i, j;
|
||||
|
||||
for( i = 0; i < 1024; i++ )
|
||||
{
|
||||
p = R_AllocParticle( NULL );
|
||||
if( !p ) return;
|
||||
|
||||
p->die = cl.time + COM_RandomFloat( 1.0f, 1.4f );
|
||||
p->packedColor = packedColor;
|
||||
p->die = cl.time + COM_RandomFloat( 2.0f, 2.4f );
|
||||
p->packedColor = 255; // use old code for blob particles
|
||||
|
||||
if( i & 1 )
|
||||
{
|
||||
@@ -1247,15 +1260,12 @@ R_BloodStream
|
||||
particle spray 2
|
||||
===============
|
||||
*/
|
||||
void GAME_EXPORT R_BloodStream( const vec3_t org, const vec3_t ndir, int pcolor, int speed )
|
||||
void GAME_EXPORT R_BloodStream( const vec3_t org, const vec3_t dir, int pcolor, int speed )
|
||||
{
|
||||
particle_t *p;
|
||||
int i, j;
|
||||
float arc;
|
||||
int accel = speed; // must be integer due to bug in GoldSrc
|
||||
vec3_t dir;
|
||||
|
||||
VectorNormalize2( ndir, dir );
|
||||
float accel = speed;
|
||||
|
||||
for( arc = 0.05f, i = 0; i < 100; i++ )
|
||||
{
|
||||
@@ -1604,73 +1614,6 @@ void GAME_EXPORT R_RocketTrail( vec3_t start, vec3_t end, int type )
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
PM_ParticleLine
|
||||
|
||||
draw line from particles
|
||||
================
|
||||
*/
|
||||
static void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
|
||||
{
|
||||
float len, curdist;
|
||||
vec3_t diff, pos;
|
||||
|
||||
// determine distance
|
||||
VectorSubtract( end, start, diff );
|
||||
len = VectorNormalizeLength( diff );
|
||||
curdist = 0;
|
||||
|
||||
while( curdist <= len )
|
||||
{
|
||||
VectorMA( start, curdist, diff, pos );
|
||||
CL_Particle( pos, pcolor, life, 0, zvel );
|
||||
curdist += 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
PM_DrawRectangle
|
||||
|
||||
================
|
||||
*/
|
||||
static void PM_DrawRectangle( const vec3_t tl, const vec3_t bl, const vec3_t tr, const vec3_t br, int pcolor, float life )
|
||||
{
|
||||
PM_ParticleLine( tl, bl, pcolor, life, 0 );
|
||||
PM_ParticleLine( bl, br, pcolor, life, 0 );
|
||||
PM_ParticleLine( br, tr, pcolor, life, 0 );
|
||||
PM_ParticleLine( tr, tl, pcolor, life, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
PM_DrawBBox
|
||||
|
||||
================
|
||||
*/
|
||||
static void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life )
|
||||
{
|
||||
vec3_t p[8], tmp;
|
||||
float gap = BOX_GAP;
|
||||
int i;
|
||||
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
tmp[0] = (i & 1) ? mins[0] - gap : maxs[0] + gap;
|
||||
tmp[1] = (i & 2) ? mins[1] - gap : maxs[1] + gap ;
|
||||
tmp[2] = (i & 4) ? mins[2] - gap : maxs[2] + gap ;
|
||||
|
||||
VectorAdd( tmp, origin, tmp );
|
||||
VectorCopy( tmp, p[i] );
|
||||
}
|
||||
|
||||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
PM_DrawRectangle( p[boxpnt[i][1]], p[boxpnt[i][0]], p[boxpnt[i][2]], p[boxpnt[i][3]], pcolor, life );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_ParticleLine
|
||||
@@ -1834,6 +1777,25 @@ void GAME_EXPORT R_StreakSplash( const vec3_t pos, const vec3_t dir, int color,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DebugParticle
|
||||
|
||||
just for debug purposes
|
||||
===============
|
||||
*/
|
||||
void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b )
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
p = R_AllocParticle( NULL );
|
||||
if( !p ) return;
|
||||
|
||||
VectorCopy( pos, p->org );
|
||||
p->color = R_LookupColor( r, g, b );
|
||||
p->die = cl.time + 0.01f;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_Particle
|
||||
@@ -1866,14 +1828,14 @@ void GAME_EXPORT R_TracerEffect( const vec3_t start, const vec3_t end )
|
||||
float len, speed;
|
||||
float offset;
|
||||
|
||||
speed = Q_max( tracerspeed.value, 3.0f );
|
||||
speed = Q_max( tracerspeed->value, 3.0f );
|
||||
|
||||
VectorSubtract( end, start, dir );
|
||||
len = VectorLength( dir );
|
||||
if( len == 0.0f ) return;
|
||||
|
||||
VectorScale( dir, 1.0f / len, dir ); // normalize
|
||||
offset = COM_RandomFloat( -10.0f, 9.0f ) + traceroffset.value;
|
||||
offset = COM_RandomFloat( -10.0f, 9.0f ) + traceroffset->value;
|
||||
VectorScale( dir, offset, vel );
|
||||
VectorAdd( start, vel, pos );
|
||||
VectorScale( dir, speed, vel );
|
||||
@@ -2099,7 +2061,7 @@ void CL_ReadPointFile_f( void )
|
||||
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
||||
}
|
||||
|
||||
static void CL_FreeDeadBeams( void )
|
||||
void CL_FreeDeadBeams( void )
|
||||
{
|
||||
BEAM *pBeam, *pNext, *pPrev = NULL;
|
||||
// draw temporary entity beams
|
||||
@@ -2129,16 +2091,16 @@ static void CL_FreeDeadBeams( void )
|
||||
void CL_DrawEFX( float time, qboolean fTrans )
|
||||
{
|
||||
CL_FreeDeadBeams();
|
||||
if( cl_draw_beams.value )
|
||||
if( CVAR_TO_BOOL( cl_draw_beams ))
|
||||
ref.dllFuncs.CL_DrawBeams( fTrans, cl_active_beams );
|
||||
|
||||
if( fTrans )
|
||||
{
|
||||
R_FreeDeadParticles( &cl_active_particles );
|
||||
if( cl_draw_particles.value )
|
||||
if( CVAR_TO_BOOL( cl_draw_particles ))
|
||||
ref.dllFuncs.CL_DrawParticles( time, cl_active_particles, PART_SIZE );
|
||||
R_FreeDeadParticles( &cl_active_tracers );
|
||||
if( cl_draw_tracers.value )
|
||||
if( CVAR_TO_BOOL( cl_draw_tracers ))
|
||||
ref.dllFuncs.CL_DrawTracers( time, cl_active_tracers );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ CL_CalcPlayerVelocity
|
||||
compute velocity for a given client
|
||||
=============
|
||||
*/
|
||||
static void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||
void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||
{
|
||||
clientdata_t *pcd;
|
||||
vec3_t delta;
|
||||
@@ -78,13 +78,13 @@ CL_DescribeEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
static void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||
void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||
{
|
||||
int idx = (slot & 63) * 2;
|
||||
con_nprint_t info;
|
||||
string origin_str = { 0 }; //, angles_str = { 0 };
|
||||
|
||||
if( !cl_showevents.value )
|
||||
if( !cl_showevents->value )
|
||||
return;
|
||||
|
||||
info.time_to_live = 1.0f;
|
||||
@@ -158,7 +158,7 @@ CL_EventIndex
|
||||
*/
|
||||
word CL_EventIndex( const char *name )
|
||||
{
|
||||
word i;
|
||||
int i;
|
||||
|
||||
if( !COM_CheckString( name ))
|
||||
return 0;
|
||||
@@ -192,7 +192,7 @@ void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func )
|
||||
ev = clgame.events[lastnum];
|
||||
|
||||
// NOTE: ev->index will be set later
|
||||
Q_strncpy( ev->name, szEvName, sizeof( ev->name ));
|
||||
Q_strncpy( ev->name, szEvName, MAX_QPATH );
|
||||
ev->func = func;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ CL_FireEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
static qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||
qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||
{
|
||||
cl_user_event_t *ev;
|
||||
const char *name;
|
||||
@@ -219,24 +219,12 @@ static qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||
if( !ev )
|
||||
{
|
||||
idx = bound( 1, ei->index, ( MAX_EVENTS - 1 ));
|
||||
Con_Reportf( S_ERROR "%s: %s not precached\n", __func__, cl.event_precache[idx] );
|
||||
Con_Reportf( S_ERROR "CL_FireEvent: %s not precached\n", cl.event_precache[idx] );
|
||||
break;
|
||||
}
|
||||
|
||||
if( ev->index == ei->index )
|
||||
{
|
||||
name = cl.event_precache[ei->index];
|
||||
|
||||
if( cl_trace_events.value )
|
||||
{
|
||||
Con_Printf( "^3EVENT %s AT %.2f %.2f %.2f\n" // event name
|
||||
"\t%.2f %.2f %i %i %s %s\n", // bool params
|
||||
name, ei->args.origin[0], ei->args.origin[1], ei->args.origin[2],
|
||||
ei->args.fparam1, ei->args.fparam2,
|
||||
ei->args.iparam1, ei->args.iparam2,
|
||||
ei->args.bparam1 ? "TRUE" : "FALSE", ei->args.bparam2 ? "TRUE" : "FALSE" );
|
||||
}
|
||||
|
||||
if( ev->func )
|
||||
{
|
||||
CL_DescribeEvent( ei, slot );
|
||||
@@ -244,7 +232,8 @@ static qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||
return true;
|
||||
}
|
||||
|
||||
Con_Reportf( S_ERROR "%s: %s not hooked\n", __func__, name );
|
||||
name = cl.event_precache[ei->index];
|
||||
Con_Reportf( S_ERROR "CL_FireEvent: %s not hooked\n", name );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -292,7 +281,7 @@ CL_FindEvent
|
||||
find first empty event
|
||||
=============
|
||||
*/
|
||||
static event_info_t *CL_FindEmptyEvent( void )
|
||||
event_info_t *CL_FindEmptyEvent( void )
|
||||
{
|
||||
int i;
|
||||
event_state_t *es;
|
||||
@@ -320,7 +309,7 @@ CL_FindEvent
|
||||
replace only unreliable events
|
||||
=============
|
||||
*/
|
||||
static event_info_t *CL_FindUnreliableEvent( void )
|
||||
event_info_t *CL_FindUnreliableEvent( void )
|
||||
{
|
||||
event_state_t *es;
|
||||
event_info_t *ei;
|
||||
@@ -350,7 +339,7 @@ CL_QueueEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
static void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
||||
{
|
||||
event_info_t *ei;
|
||||
|
||||
@@ -380,7 +369,7 @@ CL_ParseReliableEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
void CL_ParseReliableEvent( sizebuf_t *msg, connprotocol_t proto )
|
||||
void CL_ParseReliableEvent( sizebuf_t *msg )
|
||||
{
|
||||
int event_index;
|
||||
event_args_t nullargs, args;
|
||||
@@ -390,19 +379,11 @@ void CL_ParseReliableEvent( sizebuf_t *msg, connprotocol_t proto )
|
||||
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
|
||||
// reliable events not use delta-compression just null-compression
|
||||
if( proto == PROTO_GOLDSRC )
|
||||
{
|
||||
Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f );
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||
}
|
||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||
|
||||
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
||||
args.angles[PITCH] *= -3.0f;
|
||||
@@ -417,43 +398,34 @@ CL_ParseEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto )
|
||||
void CL_ParseEvent( sizebuf_t *msg )
|
||||
{
|
||||
int event_index;
|
||||
int i, num_events;
|
||||
int packet_index;
|
||||
const event_args_t nullargs = { 0 };
|
||||
event_args_t args = { 0 };
|
||||
event_args_t nullargs, args;
|
||||
entity_state_t *state;
|
||||
float delay;
|
||||
int entity_bits;
|
||||
|
||||
memset( &nullargs, 0, sizeof( nullargs ));
|
||||
memset( &args, 0, sizeof( args ));
|
||||
|
||||
num_events = MSG_ReadUBitLong( msg, 5 );
|
||||
|
||||
if( proto == PROTO_GOLDSRC )
|
||||
entity_bits = MAX_GOLDSRC_ENTITY_BITS;
|
||||
else if( proto == PROTO_LEGACY )
|
||||
entity_bits = MAX_LEGACY_ENTITY_BITS;
|
||||
else entity_bits = MAX_ENTITY_BITS;
|
||||
|
||||
// parse events queue
|
||||
for( i = 0 ; i < num_events; i++ )
|
||||
{
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
packet_index = MSG_ReadUBitLong( msg, entity_bits );
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
if( proto == PROTO_GOLDSRC )
|
||||
Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f );
|
||||
else MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||
}
|
||||
}
|
||||
packet_index = MSG_ReadUBitLong( msg, cls.legacymode ? MAX_LEGACY_ENTITY_BITS : MAX_ENTITY_BITS );
|
||||
else packet_index = -1;
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||
}
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||
else delay = 0.0f;
|
||||
@@ -512,16 +484,16 @@ void GAME_EXPORT CL_PlaybackEvent( int flags, const edict_t *pInvoker, word even
|
||||
return;
|
||||
|
||||
// first check event for out of bounds
|
||||
if( eventindex < 1 || eventindex >= MAX_EVENTS )
|
||||
if( eventindex < 1 || eventindex > MAX_EVENTS )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: invalid eventindex %i\n", __func__, eventindex );
|
||||
Con_DPrintf( S_ERROR "CL_PlaybackEvent: invalid eventindex %i\n", eventindex );
|
||||
return;
|
||||
}
|
||||
|
||||
// check event for precached
|
||||
if( !CL_EventIndex( cl.event_precache[eventindex] ))
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: event %i was not precached\n", __func__, eventindex );
|
||||
Con_DPrintf( S_ERROR "CL_PlaybackEvent: event %i was not precached\n", eventindex );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,377 +0,0 @@
|
||||
/*
|
||||
cl_font.c - bare bones engine font manager
|
||||
Copyright (C) 2023 Alibek Omarov
|
||||
|
||||
This program is free software: you can redistribute it and/or 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 your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "filesystem.h"
|
||||
#include "client.h"
|
||||
#include "qfont.h"
|
||||
|
||||
qboolean CL_FixedFont( cl_font_t *font )
|
||||
{
|
||||
return font && font->valid && font->type == FONT_FIXED;
|
||||
}
|
||||
|
||||
static int CL_LoadFontTexture( const char *fontname, uint texFlags, int *width )
|
||||
{
|
||||
int font_width;
|
||||
int tex;
|
||||
|
||||
if( !g_fsapi.FileExists( fontname, false ))
|
||||
return 0;
|
||||
|
||||
tex = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, texFlags );
|
||||
if( !tex )
|
||||
return 0;
|
||||
|
||||
font_width = REF_GET_PARM( PARM_TEX_WIDTH, tex );
|
||||
if( !font_width )
|
||||
{
|
||||
ref.dllFuncs.GL_FreeTexture( tex );
|
||||
return 0;
|
||||
}
|
||||
|
||||
*width = font_width;
|
||||
return tex;
|
||||
}
|
||||
|
||||
static int CL_FontRenderMode( convar_t *fontrender )
|
||||
{
|
||||
switch((int)fontrender->value )
|
||||
{
|
||||
case 0:
|
||||
return kRenderTransAdd;
|
||||
case 1:
|
||||
return kRenderTransAlpha;
|
||||
case 2:
|
||||
return kRenderTransTexture;
|
||||
default:
|
||||
Cvar_DirectSet( fontrender, fontrender->def_string );
|
||||
}
|
||||
|
||||
return kRenderTransTexture;
|
||||
}
|
||||
|
||||
void CL_SetFontRendermode( cl_font_t *font )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( CL_FontRenderMode( font->rendermode ));
|
||||
}
|
||||
|
||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||
{
|
||||
int font_width, i;
|
||||
|
||||
if( !rendermode )
|
||||
return false;
|
||||
|
||||
if( font->valid )
|
||||
return true; // already loaded
|
||||
|
||||
font->hFontTexture = CL_LoadFontTexture( fontname, texFlags, &font_width );
|
||||
if( !font->hFontTexture )
|
||||
return false;
|
||||
|
||||
font->type = FONT_FIXED;
|
||||
font->valid = true;
|
||||
font->scale = scale;
|
||||
font->rendermode = rendermode;
|
||||
font->charHeight = Q_rint( font_width / 16 * scale );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( font->fontRc ); i++ )
|
||||
{
|
||||
font->fontRc[i].left = ( i * font_width / 16 ) % font_width;
|
||||
font->fontRc[i].right = font->fontRc[i].left + font_width / 16;
|
||||
font->fontRc[i].top = ( i / 16 ) * ( font_width / 16 );
|
||||
font->fontRc[i].bottom = font->fontRc[i].top + font_width / 16;
|
||||
|
||||
font->charWidths[i] = Q_rint( font_width / 16 * scale );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||
{
|
||||
fs_offset_t length;
|
||||
qfont_t src;
|
||||
byte *pfile;
|
||||
int font_width, i;
|
||||
|
||||
if( !rendermode )
|
||||
return false;
|
||||
|
||||
if( font->valid )
|
||||
return true;
|
||||
|
||||
pfile = g_fsapi.LoadFile( fontname, &length, false );
|
||||
if( !pfile )
|
||||
return false;
|
||||
|
||||
if( length < sizeof( src ))
|
||||
{
|
||||
Mem_Free( pfile );
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy( &src, pfile, sizeof( src ));
|
||||
Mem_Free( pfile );
|
||||
|
||||
font->hFontTexture = CL_LoadFontTexture( fontname, texFlags, &font_width );
|
||||
if( !font->hFontTexture )
|
||||
return false;
|
||||
|
||||
font->type = FONT_VARIABLE;
|
||||
font->valid = true;
|
||||
font->scale = scale ? scale : 1.0f;
|
||||
font->rendermode = rendermode;
|
||||
font->charHeight = Q_rint( src.rowheight * scale );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( font->fontRc ); i++ )
|
||||
{
|
||||
const charinfo *ci = &src.fontinfo[i];
|
||||
|
||||
font->fontRc[i].left = (word)ci->startoffset % font_width;
|
||||
font->fontRc[i].right = font->fontRc[i].left + ci->charwidth;
|
||||
font->fontRc[i].top = (word)ci->startoffset / font_width;
|
||||
font->fontRc[i].bottom = font->fontRc[i].top + src.rowheight;
|
||||
|
||||
font->charWidths[i] = Q_rint( src.fontinfo[i].charwidth * scale );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CL_FreeFont( cl_font_t *font )
|
||||
{
|
||||
if( !font || !font->valid )
|
||||
return;
|
||||
|
||||
ref.dllFuncs.GL_FreeTexture( font->hFontTexture );
|
||||
memset( font, 0, sizeof( *font ));
|
||||
}
|
||||
|
||||
static int CL_CalcTabStop( const cl_font_t *font, int x )
|
||||
{
|
||||
int space = font->charWidths[' '];
|
||||
int tab = space * 6; // 6 spaces
|
||||
int stop = tab - x % tab;
|
||||
|
||||
if( stop < space )
|
||||
return tab * 2 - x % tab; // select next
|
||||
|
||||
return stop;
|
||||
}
|
||||
|
||||
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags )
|
||||
{
|
||||
wrect_t *rc;
|
||||
float w, h;
|
||||
float s1, t1, s2, t2, half = 0.5f;
|
||||
int texw, texh;
|
||||
|
||||
if( !font || !font->valid || y < -font->charHeight )
|
||||
return 0;
|
||||
|
||||
// check if printable
|
||||
if( number <= 32 )
|
||||
{
|
||||
if( number == ' ' )
|
||||
return font->charWidths[' '];
|
||||
else if( number == '\t' )
|
||||
return CL_CalcTabStop( font, x );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( FBitSet( flags, FONT_DRAW_UTF8 ))
|
||||
number = Con_UtfProcessChar( number & 255 );
|
||||
else number &= 255;
|
||||
|
||||
if( !number || !font->charWidths[number])
|
||||
return 0;
|
||||
|
||||
R_GetTextureParms( &texw, &texh, font->hFontTexture );
|
||||
if( !texw || !texh )
|
||||
return font->charWidths[number];
|
||||
|
||||
rc = &font->fontRc[number];
|
||||
|
||||
if( font->scale <= 1.f || !REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture ))
|
||||
half = 0;
|
||||
|
||||
s1 = ((float)rc->left + half ) / texw;
|
||||
t1 = ((float)rc->top + half ) / texh;
|
||||
s2 = ((float)rc->right - half ) / texw;
|
||||
t2 = ((float)rc->bottom - half ) / texh;
|
||||
w = ( rc->right - rc->left ) * font->scale;
|
||||
h = ( rc->bottom - rc->top ) * font->scale;
|
||||
|
||||
if( FBitSet( flags, FONT_DRAW_HUD ))
|
||||
SPR_AdjustSize( &x, &y, &w, &h );
|
||||
|
||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||
CL_SetFontRendermode( font );
|
||||
|
||||
// don't apply color to fixed fonts it's already colored
|
||||
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
||||
ref.dllFuncs.Color4ub( color[0], color[1], color[2], color[3] );
|
||||
else ref.dllFuncs.Color4ub( 255, 255, 255, color[3] );
|
||||
ref.dllFuncs.R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, font->hFontTexture );
|
||||
|
||||
return font->charWidths[number];
|
||||
}
|
||||
|
||||
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags )
|
||||
{
|
||||
rgba_t current_color;
|
||||
int draw_len = 0;
|
||||
|
||||
if( !font || !font->valid )
|
||||
return 0;
|
||||
|
||||
if( FBitSet( flags, FONT_DRAW_UTF8 ))
|
||||
Con_UtfProcessChar( 0 ); // clear utf state
|
||||
|
||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||
CL_SetFontRendermode( font );
|
||||
|
||||
Vector4Copy( color, current_color );
|
||||
|
||||
while( *s )
|
||||
{
|
||||
if( *s == '\n' )
|
||||
{
|
||||
s++;
|
||||
|
||||
if( !*s )
|
||||
break;
|
||||
|
||||
// some client functions ignore newlines
|
||||
if( !FBitSet( flags, FONT_DRAW_NOLF ))
|
||||
{
|
||||
draw_len = 0;
|
||||
y += font->charHeight;
|
||||
}
|
||||
|
||||
if( FBitSet( flags, FONT_DRAW_RESETCOLORONLF ))
|
||||
Vector4Copy( color, current_color );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( IsColorString( s ))
|
||||
{
|
||||
// don't copy alpha
|
||||
if( !FBitSet( flags, FONT_DRAW_FORCECOL ))
|
||||
VectorCopy( g_color_table[ColorIndex(*( s + 1 ))], current_color );
|
||||
|
||||
s += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip setting rendermode, it was changed for this string already
|
||||
draw_len += CL_DrawCharacter( x + draw_len, y, (byte)*s, current_color, font, flags | FONT_DRAW_NORENDERMODE );
|
||||
|
||||
s++;
|
||||
}
|
||||
|
||||
return draw_len;
|
||||
}
|
||||
|
||||
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... )
|
||||
{
|
||||
va_list va;
|
||||
char buf[MAX_VA_STRING];
|
||||
|
||||
va_start( va, fmt );
|
||||
Q_vsnprintf( buf, sizeof( buf ), fmt, va );
|
||||
va_end( va );
|
||||
|
||||
return CL_DrawString( x, y, buf, color, font, flags );
|
||||
}
|
||||
|
||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height )
|
||||
{
|
||||
if( !font || !font->valid ) return;
|
||||
if( width )
|
||||
{
|
||||
if( number == '\t' )
|
||||
*width = CL_CalcTabStop( font, 0 ); // at least return max tabstop
|
||||
else *width = font->charWidths[number & 255];
|
||||
}
|
||||
if( height ) *height = font->charHeight;
|
||||
}
|
||||
|
||||
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags )
|
||||
{
|
||||
int draw_len = 0;
|
||||
|
||||
if( !font || !font->valid )
|
||||
return;
|
||||
|
||||
if( height )
|
||||
*height = font->charHeight;
|
||||
|
||||
if( width )
|
||||
*width = 0;
|
||||
|
||||
if( !COM_CheckString( s ))
|
||||
return;
|
||||
|
||||
if( FBitSet( flags, FONT_DRAW_UTF8 ))
|
||||
Con_UtfProcessChar( 0 ); // reset utf state
|
||||
|
||||
while( *s )
|
||||
{
|
||||
int number;
|
||||
|
||||
if( *s == '\n' )
|
||||
{
|
||||
// BUG: no check for end string here
|
||||
// but high chances somebody's relying on this
|
||||
s++;
|
||||
draw_len = 0;
|
||||
if( !FBitSet( flags, FONT_DRAW_NOLF ))
|
||||
{
|
||||
if( height )
|
||||
*height += font->charHeight;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if( *s == '\t' )
|
||||
{
|
||||
draw_len += CL_CalcTabStop( font, 0 ); // at least return max tabstop
|
||||
s++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( IsColorString( s ))
|
||||
{
|
||||
s += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( FBitSet( flags, FONT_DRAW_UTF8 ))
|
||||
number = Con_UtfProcessChar( (byte)*s );
|
||||
else number = (byte)*s;
|
||||
|
||||
if( number )
|
||||
{
|
||||
draw_len += font->charWidths[number];
|
||||
|
||||
if( draw_len > *width )
|
||||
*width = draw_len;
|
||||
}
|
||||
|
||||
s++;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ GNU General Public License for more details.
|
||||
#include "sound.h"
|
||||
#include "input.h"
|
||||
|
||||
// #define STUDIO_INTERPOLATION_FIX
|
||||
#define STUDIO_INTERPOLATION_FIX
|
||||
|
||||
/*
|
||||
==================
|
||||
@@ -52,30 +52,16 @@ CL_UpdatePositions
|
||||
Store another position into interpolation circular buffer
|
||||
==================
|
||||
*/
|
||||
static void CL_UpdatePositions( cl_entity_t *ent )
|
||||
void CL_UpdatePositions( cl_entity_t *ent )
|
||||
{
|
||||
position_history_t *ph, *prev;
|
||||
|
||||
prev = &ent->ph[ent->current_position];
|
||||
position_history_t *ph;
|
||||
|
||||
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
||||
ph = &ent->ph[ent->current_position];
|
||||
|
||||
VectorCopy( ent->curstate.origin, ph->origin );
|
||||
VectorCopy( ent->curstate.angles, ph->angles );
|
||||
|
||||
ph->animtime = ent->curstate.animtime;
|
||||
|
||||
// a1ba: for some reason, this sometimes still may happen
|
||||
// at this time, I'm not sure whether this bug happens in delta readwrite code
|
||||
// or server just decides to go backwards and really sends these values
|
||||
if( ph->animtime < prev->animtime )
|
||||
{
|
||||
// try to deduce real animtime by looking up the difference between
|
||||
// server messages (cl.mtime is never modified ny the interpolation code)
|
||||
float diff = Q_max( 0, ent->curstate.msg_time - ent->prevstate.msg_time );
|
||||
|
||||
ph->animtime = prev->animtime + diff;
|
||||
}
|
||||
ph->animtime = ent->curstate.animtime; // !!!
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -85,7 +71,7 @@ CL_ResetPositions
|
||||
Interpolation init or reset after teleporting
|
||||
==================
|
||||
*/
|
||||
static void CL_ResetPositions( cl_entity_t *ent )
|
||||
void CL_ResetPositions( cl_entity_t *ent )
|
||||
{
|
||||
position_history_t store;
|
||||
|
||||
@@ -95,7 +81,8 @@ static void CL_ResetPositions( cl_entity_t *ent )
|
||||
ent->current_position = 1;
|
||||
|
||||
memset( ent->ph, 0, sizeof( position_history_t ) * HISTORY_MAX );
|
||||
ent->ph[1] = ent->ph[0] = store;
|
||||
memcpy( &ent->ph[1], &store, sizeof( position_history_t ));
|
||||
memcpy( &ent->ph[0], &store, sizeof( position_history_t ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -106,7 +93,7 @@ check for instant movement in case
|
||||
we don't want interpolate this
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||
qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||
{
|
||||
float len, maxlen;
|
||||
vec3_t delta;
|
||||
@@ -127,7 +114,7 @@ CL_CompareTimestamps
|
||||
round-off floating errors
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||
qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||
{
|
||||
int iTime1 = t1 * 1000;
|
||||
int iTime2 = t2 * 1000;
|
||||
@@ -142,9 +129,9 @@ CL_EntityIgnoreLerp
|
||||
some ents will be ignore lerping
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||
qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||
{
|
||||
if( cl_nointerp.value > 0.f )
|
||||
if( cl_nointerp->value > 0.f )
|
||||
return true;
|
||||
|
||||
if( e->model && e->model->type == mod_alias )
|
||||
@@ -159,7 +146,7 @@ CL_EntityCustomLerp
|
||||
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
{
|
||||
switch( e->curstate.movetype )
|
||||
{
|
||||
@@ -169,13 +156,6 @@ static qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
case MOVETYPE_FLY:
|
||||
case MOVETYPE_COMPOUND:
|
||||
return false;
|
||||
|
||||
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||
case MOVETYPE_TOSS:
|
||||
if( cls.legacymode == PROTO_LEGACY && e->model && e->model->type == mod_studio )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -188,7 +168,7 @@ CL_ParametricMove
|
||||
check for parametrical moved entities
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||
qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||
{
|
||||
float frac, dt, t;
|
||||
vec3_t delta;
|
||||
@@ -225,7 +205,7 @@ CL_UpdateLatchedVars
|
||||
|
||||
====================
|
||||
*/
|
||||
static void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
{
|
||||
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
||||
return; // below fields used only for alias and studio interpolation
|
||||
@@ -239,7 +219,7 @@ static void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
|
||||
if( ent->curstate.sequence != ent->prevstate.sequence )
|
||||
{
|
||||
memcpy( ent->latched.prevseqblending, ent->prevstate.blending, sizeof( ent->latched.prevseqblending ));
|
||||
memcpy( ent->prevstate.blending, ent->latched.prevseqblending, sizeof( ent->prevstate.blending ));
|
||||
ent->latched.prevsequence = ent->prevstate.sequence;
|
||||
ent->latched.sequencetime = ent->curstate.animtime;
|
||||
}
|
||||
@@ -258,7 +238,7 @@ CL_GetStudioEstimatedFrame
|
||||
|
||||
====================
|
||||
*/
|
||||
static float CL_GetStudioEstimatedFrame( cl_entity_t *ent )
|
||||
float CL_GetStudioEstimatedFrame( cl_entity_t *ent )
|
||||
{
|
||||
studiohdr_t *pstudiohdr;
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
@@ -272,7 +252,7 @@ static float CL_GetStudioEstimatedFrame( cl_entity_t *ent )
|
||||
{
|
||||
sequence = bound( 0, ent->curstate.sequence, pstudiohdr->numseq - 1 );
|
||||
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + sequence;
|
||||
return ref.dllFuncs.R_StudioEstimateFrame( ent, pseqdesc, cl.time );
|
||||
return ref.dllFuncs.R_StudioEstimateFrame( ent, pseqdesc );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +300,7 @@ CL_ProcessEntityUpdate
|
||||
apply changes since new frame received
|
||||
==================
|
||||
*/
|
||||
static void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||
void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||
{
|
||||
qboolean parametric;
|
||||
|
||||
@@ -330,7 +310,7 @@ static void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||
if( FBitSet( ent->curstate.entityType, ENTITY_NORMAL ))
|
||||
COM_NormalizeAngles( ent->curstate.angles );
|
||||
|
||||
parametric = ent->curstate.starttime != 0.0f && ent->curstate.impacttime != 0.0f;
|
||||
parametric = CL_ParametricMove( ent );
|
||||
|
||||
// allow interpolation on bmodels too
|
||||
if( ent->model && ent->model->type == mod_brush )
|
||||
@@ -366,10 +346,11 @@ CL_FindInterpolationUpdates
|
||||
find two timestamps
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, double targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||
qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||
{
|
||||
qboolean extrapolate = true;
|
||||
uint i, i0, i1, imod;
|
||||
int i, i0, i1, imod;
|
||||
float at;
|
||||
|
||||
imod = ent->current_position;
|
||||
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
||||
@@ -377,10 +358,8 @@ static qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, double targettime
|
||||
|
||||
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
||||
{
|
||||
double at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
|
||||
if( at == 0.0f )
|
||||
break;
|
||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
if( at == 0.0f ) break;
|
||||
|
||||
if( targettime > at )
|
||||
{
|
||||
@@ -405,14 +384,15 @@ CL_PureOrigin
|
||||
non-local players interpolation
|
||||
==================
|
||||
*/
|
||||
static void CL_PureOrigin( cl_entity_t *ent, double t, vec3_t outorigin, vec3_t outangles )
|
||||
void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangles )
|
||||
{
|
||||
double t1, t0, frac;
|
||||
qboolean extrapolate;
|
||||
float t1, t0, frac;
|
||||
position_history_t *ph0, *ph1;
|
||||
vec3_t delta;
|
||||
|
||||
// NOTE: ph0 is next, ph1 is a prev
|
||||
CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||
extrapolate = CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||
|
||||
if ( !ph0 || !ph1 )
|
||||
return;
|
||||
@@ -420,17 +400,17 @@ static void CL_PureOrigin( cl_entity_t *ent, double t, vec3_t outorigin, vec3_t
|
||||
t0 = ph0->animtime;
|
||||
t1 = ph1->animtime;
|
||||
|
||||
if( t0 != 0.0 )
|
||||
if( t0 != 0.0f )
|
||||
{
|
||||
vec4_t q, q1, q2;
|
||||
|
||||
VectorSubtract( ph0->origin, ph1->origin, delta );
|
||||
|
||||
if( !Q_equal( t0, t1 ))
|
||||
if( t0 != t1 )
|
||||
frac = ( t - t1 ) / ( t0 - t1 );
|
||||
else frac = 1.0;
|
||||
else frac = 1.0f;
|
||||
|
||||
frac = bound( 0.0, frac, 1.2 );
|
||||
frac = bound( 0.0f, frac, 1.2f );
|
||||
|
||||
VectorMA( ph1->origin, frac, delta, outorigin );
|
||||
|
||||
@@ -454,11 +434,11 @@ CL_InterpolateModel
|
||||
non-players interpolation
|
||||
==================
|
||||
*/
|
||||
static int CL_InterpolateModel( cl_entity_t *e )
|
||||
int CL_InterpolateModel( cl_entity_t *e )
|
||||
{
|
||||
position_history_t *ph0 = NULL, *ph1 = NULL;
|
||||
vec3_t origin, angles, delta;
|
||||
double t, t1, t2, frac;
|
||||
float t, t1, t2, frac;
|
||||
vec4_t q, q1, q2;
|
||||
|
||||
VectorCopy( e->curstate.origin, e->origin );
|
||||
@@ -481,13 +461,13 @@ static int CL_InterpolateModel( cl_entity_t *e )
|
||||
if( cl.maxclients <= 1 )
|
||||
return 1;
|
||||
|
||||
if( e->model->type == mod_brush && !cl_bmodelinterp.value )
|
||||
if( e->model->type == mod_brush && !cl_bmodelinterp->value )
|
||||
return 1;
|
||||
|
||||
if( cl.local.moving && cl.local.onground == e->index )
|
||||
return 1;
|
||||
|
||||
t = cl.time - cl_interp.value;
|
||||
t = cl.time - cl_interp->value;
|
||||
CL_FindInterpolationUpdates( e, t, &ph0, &ph1 );
|
||||
|
||||
if( ph0 == NULL || ph1 == NULL )
|
||||
@@ -506,7 +486,7 @@ static int CL_InterpolateModel( cl_entity_t *e )
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( Q_equal( t2, t1 ))
|
||||
if( t2 == t1 )
|
||||
{
|
||||
VectorCopy( ph0->origin, e->origin );
|
||||
VectorCopy( ph0->angles, e->angles );
|
||||
@@ -544,15 +524,15 @@ interpolate non-local clients
|
||||
*/
|
||||
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||
{
|
||||
double targettime;
|
||||
float targettime;
|
||||
vec4_t q, q1, q2;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
|
||||
if( !ent->player )
|
||||
if( !ent->player || ent->index == ( cl.playernum + 1 ))
|
||||
return;
|
||||
|
||||
if( cl_nointerp.value > 0.f )
|
||||
if( cl_nointerp->value > 0.f )
|
||||
{
|
||||
VectorCopy( ent->curstate.angles, ent->angles );
|
||||
VectorCopy( ent->curstate.origin, ent->origin );
|
||||
@@ -570,7 +550,7 @@ void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||
return;
|
||||
}
|
||||
|
||||
targettime = cl.time - cl_interp.value;
|
||||
targettime = cl.time - cl_interp->value;
|
||||
CL_PureOrigin( ent, targettime, origin, angles );
|
||||
|
||||
VectorCopy( angles, ent->angles );
|
||||
@@ -584,7 +564,7 @@ CL_ProcessPlayerState
|
||||
process player states after the new packet has received
|
||||
=================
|
||||
*/
|
||||
static void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
||||
void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
||||
{
|
||||
entity_state_t *ps;
|
||||
|
||||
@@ -604,7 +584,7 @@ reset latched state if this frame entity was teleported
|
||||
or just EF_NOINTERP was set
|
||||
=================
|
||||
*/
|
||||
static void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
||||
void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
||||
{
|
||||
if( CHECKVISBIT( frame->flags, pnum ))
|
||||
{
|
||||
@@ -669,24 +649,6 @@ FRAME PARSING
|
||||
|
||||
=========================================================================
|
||||
*/
|
||||
static qboolean CL_ParseEntityNumFromPacket( sizebuf_t *msg, int *newnum, connprotocol_t proto )
|
||||
{
|
||||
if( proto == PROTO_LEGACY )
|
||||
{
|
||||
*newnum = MSG_ReadWord( msg );
|
||||
if( *newnum == 0 )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
*newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
if( *newnum == LAST_EDICT )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_FlushEntityPacket
|
||||
@@ -694,7 +656,7 @@ CL_FlushEntityPacket
|
||||
Read and ignore whole entity packet.
|
||||
=================
|
||||
*/
|
||||
static void CL_FlushEntityPacket( sizebuf_t *msg, connprotocol_t proto )
|
||||
void CL_FlushEntityPacket( sizebuf_t *msg )
|
||||
{
|
||||
int newnum;
|
||||
entity_state_t from, to;
|
||||
@@ -707,57 +669,16 @@ static void CL_FlushEntityPacket( sizebuf_t *msg, connprotocol_t proto )
|
||||
// read it all, but ignore it
|
||||
while( 1 )
|
||||
{
|
||||
if( !CL_ParseEntityNumFromPacket( msg, &newnum, proto ))
|
||||
break; // done
|
||||
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
if( newnum == LAST_EDICT ) break; // done
|
||||
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "%s: overflow\n", __func__ );
|
||||
Host_Error( "CL_FlushEntityPacket: overflow\n" );
|
||||
|
||||
MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ) ? DELTA_PLAYER : DELTA_ENTITY, cl.mtime[0] );
|
||||
}
|
||||
}
|
||||
|
||||
qboolean CL_ValidateDeltaPacket( uint oldpacket, frame_t *oldframe )
|
||||
{
|
||||
int subtracted = ( cls.netchan.incoming_sequence - oldpacket ) & 0xFF;
|
||||
|
||||
if( subtracted == 0 )
|
||||
{
|
||||
Con_NPrintf( 2, "^3Warning:^1 update too old\n^7\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( subtracted >= CL_UPDATE_MASK )
|
||||
{
|
||||
// we can't use this, it is too old
|
||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if(( cls.next_client_entities - oldframe->first_entity ) > ( cls.num_client_entities - NUM_PACKET_ENTITIES ))
|
||||
{
|
||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CL_UpdateOldEntNum( int oldindex, frame_t *oldframe, entity_state_t **oldent )
|
||||
{
|
||||
if( !oldframe )
|
||||
{
|
||||
*oldent = NULL;
|
||||
return MAX_ENTNUMBER;
|
||||
}
|
||||
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
return MAX_ENTNUMBER;
|
||||
|
||||
*oldent = &cls.packet_entities[(oldframe->first_entity + oldindex) % cls.num_client_entities];
|
||||
return (*oldent)->number;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_DeltaEntity
|
||||
@@ -765,7 +686,7 @@ CL_DeltaEntity
|
||||
processing delta update
|
||||
=================
|
||||
*/
|
||||
static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
||||
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
entity_state_t *state;
|
||||
@@ -780,7 +701,7 @@ static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_s
|
||||
|
||||
if(( newnum < 0 ) || ( newnum >= clgame.maxEntities ))
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: invalid newnum: %d\n", __func__, newnum );
|
||||
Con_DPrintf( S_ERROR "CL_DeltaEntity: invalid newnum: %d\n", newnum );
|
||||
if( has_update )
|
||||
MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
|
||||
return;
|
||||
@@ -792,7 +713,7 @@ static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_s
|
||||
|
||||
if( has_update )
|
||||
alive = MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
|
||||
else *state = *old;
|
||||
else memcpy( state, old, sizeof( entity_state_t ));
|
||||
|
||||
if( !alive )
|
||||
{
|
||||
@@ -828,7 +749,7 @@ An svc_packetentities has just been parsed, deal with the
|
||||
rest of the data stream.
|
||||
==================
|
||||
*/
|
||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto )
|
||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||
{
|
||||
frame_t *newframe, *oldframe;
|
||||
int oldindex, newnum, oldnum;
|
||||
@@ -844,7 +765,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto
|
||||
CL_WriteDemoJumpTime();
|
||||
|
||||
// sentinel count. save it for debug checking
|
||||
if( proto == PROTO_LEGACY )
|
||||
if( cls.legacymode )
|
||||
count = MSG_ReadWord( msg );
|
||||
else count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1;
|
||||
|
||||
@@ -858,12 +779,32 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto
|
||||
|
||||
if( delta )
|
||||
{
|
||||
uint oldpacket = MSG_ReadByte( msg );
|
||||
int subtracted;
|
||||
|
||||
oldpacket = MSG_ReadByte( msg );
|
||||
subtracted = ( cls.netchan.incoming_sequence - oldpacket ) & 0xFF;
|
||||
|
||||
if( subtracted == 0 )
|
||||
{
|
||||
Con_NPrintf( 2, "^3Warning:^1 update too old\n^7\n" );
|
||||
CL_FlushEntityPacket( msg );
|
||||
return playerbytes;
|
||||
}
|
||||
|
||||
if( subtracted >= CL_UPDATE_MASK )
|
||||
{
|
||||
// we can't use this, it is too old
|
||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||
CL_FlushEntityPacket( msg );
|
||||
return playerbytes;
|
||||
}
|
||||
|
||||
oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];
|
||||
|
||||
if( !CL_ValidateDeltaPacket( oldpacket, oldframe ))
|
||||
if(( cls.next_client_entities - oldframe->first_entity ) > ( cls.num_client_entities - NUM_PACKET_ENTITIES ))
|
||||
{
|
||||
CL_FlushEntityPacket( msg, proto );
|
||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||
CL_FlushEntityPacket( msg );
|
||||
return playerbytes;
|
||||
}
|
||||
}
|
||||
@@ -881,23 +822,58 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto
|
||||
|
||||
oldent = NULL;
|
||||
oldindex = 0;
|
||||
oldnum = CL_UpdateOldEntNum( oldindex, oldframe, &oldent );
|
||||
|
||||
if( !oldframe )
|
||||
{
|
||||
oldnum = MAX_ENTNUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
{
|
||||
oldnum = MAX_ENTNUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
||||
oldnum = oldent->number;
|
||||
}
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( !CL_ParseEntityNumFromPacket( msg, &newnum, proto ))
|
||||
break; // done
|
||||
int lastedict;
|
||||
if( cls.legacymode )
|
||||
{
|
||||
newnum = MSG_ReadWord( msg );
|
||||
lastedict = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
lastedict = LAST_EDICT;
|
||||
}
|
||||
|
||||
if( newnum == lastedict ) break; // end of packet entities
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "%s: overflow\n", __func__ );
|
||||
|
||||
Host_Error( "CL_ParsePacketEntities: overflow\n" );
|
||||
player = CL_IsPlayerIndex( newnum );
|
||||
|
||||
while( oldnum < newnum )
|
||||
{
|
||||
// one or more entities from the old packet are unchanged
|
||||
CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
|
||||
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||
oldindex++;
|
||||
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
{
|
||||
oldnum = MAX_ENTNUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
||||
oldnum = oldent->number;
|
||||
}
|
||||
}
|
||||
|
||||
if( oldnum == newnum )
|
||||
@@ -906,7 +882,17 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
CL_DeltaEntity( msg, newframe, newnum, oldent, true );
|
||||
if( player ) playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||
oldindex++;
|
||||
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
{
|
||||
oldnum = MAX_ENTNUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
||||
oldnum = oldent->number;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -925,11 +911,21 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto
|
||||
{
|
||||
// one or more entities from the old packet are unchanged
|
||||
CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
|
||||
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||
oldindex++;
|
||||
|
||||
if( oldindex >= oldframe->num_entities )
|
||||
{
|
||||
oldnum = MAX_ENTNUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
||||
oldnum = oldent->number;
|
||||
}
|
||||
}
|
||||
|
||||
if( newframe->num_entities != count && newframe->num_entities != 0 )
|
||||
Con_Reportf( S_WARN "%s%s: (%i should be %i)\n", __func__, delta ? "Delta" : "", newframe->num_entities, count );
|
||||
Con_Reportf( S_WARN "CL_Parse%sPacketEntities: (%i should be %i)\n", delta ? "Delta" : "", newframe->num_entities, count );
|
||||
|
||||
if( !newframe->valid )
|
||||
return playerbytes; // frame is not valid but message was parsed
|
||||
@@ -947,7 +943,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto
|
||||
cls.signon = SIGNONS;
|
||||
|
||||
// Clear loading plaque.
|
||||
CL_SignonReply( proto );
|
||||
CL_SignonReply ();
|
||||
}
|
||||
|
||||
return playerbytes;
|
||||
@@ -969,25 +965,9 @@ all the visible entities should pass this filter
|
||||
*/
|
||||
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
||||
{
|
||||
qboolean draw_player = true;
|
||||
|
||||
if( !ent || !ent->model )
|
||||
return false;
|
||||
|
||||
// don't add the player in firstperson mode
|
||||
if( RP_LOCALCLIENT( ent ))
|
||||
{
|
||||
cl.local.apply_effects = true;
|
||||
|
||||
if( !CL_IsThirdPerson( ) && ( ent->index == cl.viewentity ))
|
||||
{
|
||||
// we don't draw player in default renderer in firstperson mode
|
||||
// but let the client.dll know about player entity anyway
|
||||
// for use in custom renderers
|
||||
draw_player = false;
|
||||
}
|
||||
}
|
||||
|
||||
// check for adding this entity
|
||||
if( !clgame.dllFuncs.pfnAddEntity( entityType, ent, ent->model->name ))
|
||||
{
|
||||
@@ -997,7 +977,8 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !draw_player )
|
||||
// don't add the player in firstperson mode
|
||||
if( RP_LOCALCLIENT( ent ) && !CL_IsThirdPerson( ) && ( ent->index == cl.viewentity ))
|
||||
return false;
|
||||
|
||||
if( entityType == ET_BEAM )
|
||||
@@ -1012,8 +993,12 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
||||
|
||||
// because pTemp->entity.curstate.effects
|
||||
// is already occupied by FTENT_FLICKER
|
||||
if( entityType != ET_TEMPENTITY && !RP_LOCALCLIENT( ent ) )
|
||||
if( entityType != ET_TEMPENTITY )
|
||||
{
|
||||
// no reason to do it twice
|
||||
if( RP_LOCALCLIENT( ent ))
|
||||
cl.local.apply_effects = false;
|
||||
|
||||
// apply client-side effects
|
||||
CL_AddEntityEffects( ent );
|
||||
|
||||
@@ -1031,7 +1016,7 @@ CL_LinkCustomEntity
|
||||
Add server beam to draw list
|
||||
=============
|
||||
*/
|
||||
static void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
||||
void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
||||
{
|
||||
ent->curstate.movetype = state->modelindex; // !!!
|
||||
|
||||
@@ -1054,7 +1039,7 @@ Create visible entities in the correct position
|
||||
for all current players
|
||||
=============
|
||||
*/
|
||||
static void CL_LinkPlayers( frame_t *frame )
|
||||
void CL_LinkPlayers( frame_t *frame )
|
||||
{
|
||||
entity_state_t *state;
|
||||
cl_entity_t *ent;
|
||||
@@ -1065,6 +1050,7 @@ static void CL_LinkPlayers( frame_t *frame )
|
||||
// apply muzzleflash to weaponmodel
|
||||
if( ent && FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ))
|
||||
SetBits( clgame.viewent.curstate.effects, EF_MUZZLEFLASH );
|
||||
cl.local.apply_effects = true;
|
||||
|
||||
// check all the clients but add only visible
|
||||
for( i = 0, state = frame->playerstate; i < MAX_CLIENTS; i++, state++ )
|
||||
@@ -1103,9 +1089,6 @@ static void CL_LinkPlayers( frame_t *frame )
|
||||
|
||||
if ( i == cl.playernum )
|
||||
{
|
||||
// using interpolation only for local player angles
|
||||
CL_ComputePlayerOrigin( ent );
|
||||
|
||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||
VectorLerp( ent->prevstate.origin, cl.lerpFrac, ent->curstate.origin, cl.simorg );
|
||||
VectorCopy( cl.simorg, ent->origin );
|
||||
@@ -1137,7 +1120,7 @@ CL_LinkPacketEntities
|
||||
|
||||
===============
|
||||
*/
|
||||
static void CL_LinkPacketEntities( frame_t *frame )
|
||||
void CL_LinkPacketEntities( frame_t *frame )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
entity_state_t *state;
|
||||
@@ -1161,7 +1144,7 @@ static void CL_LinkPacketEntities( frame_t *frame )
|
||||
|
||||
if( !ent )
|
||||
{
|
||||
Con_Reportf( S_ERROR "%s: bad entity %i\n", __func__, state->number );
|
||||
Con_Reportf( S_ERROR "CL_LinkPacketEntity: bad entity %i\n", state->number );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1202,33 +1185,17 @@ static void CL_LinkPacketEntities( frame_t *frame )
|
||||
#else
|
||||
if( ent->lastmove >= cl.time )
|
||||
{
|
||||
float at = ent->curstate.animtime;
|
||||
|
||||
CL_ResetLatchedVars( ent, true );
|
||||
|
||||
if( cl_fixmodelinterpolationartifacts.value )
|
||||
ent->latched.prevanimtime = ent->curstate.animtime = at;
|
||||
|
||||
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
||||
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
||||
|
||||
if( !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
// disable step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_NONE;
|
||||
}
|
||||
// disable step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
interpolate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_STEP;
|
||||
}
|
||||
// restore step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_STEP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1253,24 +1220,11 @@ static void CL_LinkPacketEntities( frame_t *frame )
|
||||
if ( !CL_InterpolateModel( ent ))
|
||||
continue;
|
||||
}
|
||||
// a1ba: in GoldSrc this is done for cstrike and czero
|
||||
// but let modders use this as an engine feature
|
||||
else if( FBitSet( host.features, ENGINE_STEP_POSHISTORY_LERP ) &&
|
||||
ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||
else if( ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||
{
|
||||
if( !CL_InterpolateModel( ent ))
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||
else if( cls.legacymode == PROTO_LEGACY && ent->model->type == mod_studio && ent->curstate.movetype == MOVETYPE_TOSS )
|
||||
{
|
||||
if( !CL_InterpolateModel( ent ))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
// no interpolation right now
|
||||
@@ -1466,3 +1420,9 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CL_ExtraUpdate( void )
|
||||
{
|
||||
clgame.dllFuncs.IN_Accumulate();
|
||||
S_ExtraUpdate();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,14 +25,6 @@ static void UI_UpdateUserinfo( void );
|
||||
|
||||
gameui_static_t gameui;
|
||||
|
||||
static void UI_ToggleAllowConsole_f( void )
|
||||
{
|
||||
host.allow_console = host.allow_console_init = true;
|
||||
|
||||
if( gameui.globals )
|
||||
gameui.globals->developer = true;
|
||||
}
|
||||
|
||||
void UI_UpdateMenu( float realtime )
|
||||
{
|
||||
if( !gameui.hInstance ) return;
|
||||
@@ -224,14 +216,12 @@ UI_ShowConnectionWarning
|
||||
show message box
|
||||
=================
|
||||
*/
|
||||
qboolean UI_ShowMessageBox( const char *text )
|
||||
void UI_ShowMessageBox( const char *text )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnShowMessageBox )
|
||||
{
|
||||
gameui.dllFuncs2.pfnShowMessageBox( text );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_Disconnect( void )
|
||||
@@ -319,7 +309,7 @@ static void GAME_EXPORT UI_DrawLogo( const char *filename, float x, float y, flo
|
||||
|
||||
// run cinematic if not
|
||||
Q_snprintf( path, sizeof( path ), "media/%s", filename );
|
||||
COM_DefaultExtension( path, ".avi", sizeof( path ));
|
||||
COM_DefaultExtension( path, ".avi" );
|
||||
fullpath = FS_GetDiskPath( path, false );
|
||||
|
||||
if( FS_FileExists( path, false ) && !fullpath )
|
||||
@@ -407,61 +397,74 @@ void Host_Credits( void )
|
||||
gameui.dllFuncs.pfnFinalCredits();
|
||||
}
|
||||
|
||||
static void UI_ConvertGameInfo( gameinfo2_t *out, const gameinfo_t *in )
|
||||
static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
||||
{
|
||||
out->gi_version = GAMEINFO_VERSION;
|
||||
|
||||
Q_strncpy( out->gamefolder, in->gamefolder, sizeof( out->gamefolder ));
|
||||
Q_strncpy( out->startmap, in->startmap, sizeof( out->startmap ));
|
||||
Q_strncpy( out->trainmap, in->trainmap, sizeof( out->trainmap ));
|
||||
Q_strncpy( out->demomap, in->demomap, sizeof( out->demomap ));
|
||||
Q_strncpy( out->title, in->title, sizeof( out->title ));
|
||||
Q_snprintf( out->version, sizeof( out->version ), "%g", in->version );
|
||||
Q_strncpy( out->iconpath, in->iconpath, sizeof( out->iconpath ));
|
||||
|
||||
Q_strncpy( out->game_url, in->game_url, sizeof( out->game_url ));
|
||||
Q_strncpy( out->update_url, in->update_url, sizeof( out->update_url ));
|
||||
out->size = in->size;
|
||||
Q_strncpy( out->size, Q_pretifymem( in->size, 0 ), sizeof( out->size ));
|
||||
Q_strncpy( out->type, in->type, sizeof( out->type ));
|
||||
Q_strncpy( out->date, in->date, sizeof( out->date ));
|
||||
|
||||
out->gamemode = in->gamemode;
|
||||
|
||||
if( in->nomodels )
|
||||
SetBits( out->flags, GFL_NOMODELS );
|
||||
out->flags |= GFL_NOMODELS;
|
||||
if( in->noskills )
|
||||
SetBits( out->flags, GFL_NOSKILLS );
|
||||
if( in->render_picbutton_text )
|
||||
SetBits( out->flags, GFL_RENDER_PICBUTTON_TEXT );
|
||||
if( in->hd_background )
|
||||
SetBits( out->flags, GFL_HD_BACKGROUND );
|
||||
if( in->animated_title )
|
||||
SetBits( out->flags, GFL_ANIMATED_TITLE );
|
||||
out->flags |= GFL_NOSKILLS;
|
||||
}
|
||||
|
||||
static void UI_ToOldGameInfo( GAMEINFO *out, const gameinfo2_t *in )
|
||||
static qboolean PIC_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
|
||||
{
|
||||
Q_strncpy( out->gamefolder, in->gamefolder, sizeof( out->gamefolder ));
|
||||
Q_strncpy( out->startmap, in->startmap, sizeof( out->startmap ));
|
||||
Q_strncpy( out->trainmap, in->trainmap, sizeof( out->trainmap ));
|
||||
Q_strncpy( out->title, in->title, sizeof( out->title ));
|
||||
Q_strncpy( out->version, in->version, sizeof( out->version ));
|
||||
out->flags = in->flags & 0xFFFF;
|
||||
Q_strncpy( out->game_url, in->game_url, sizeof( out->game_url ));
|
||||
Q_strncpy( out->update_url, in->update_url, sizeof( out->update_url ));
|
||||
Q_strncpy( out->size, Q_memprint( in->size ), sizeof( out->size ));
|
||||
Q_strncpy( out->type, in->type, sizeof( out->type ));
|
||||
Q_strncpy( out->date, in->date, sizeof( out->date ));
|
||||
out->gamemode = in->gamemode;
|
||||
}
|
||||
float dudx, dvdy;
|
||||
|
||||
static void UI_GetModsInfo( void )
|
||||
{
|
||||
int i;
|
||||
// clip sub rect to sprite
|
||||
if(( width == 0 ) || ( height == 0 ))
|
||||
return false;
|
||||
|
||||
gameui.modsInfo = Mem_Calloc( gameui.mempool, sizeof( *gameui.modsInfo ) * FI->numgames );
|
||||
for( i = 0; i < FI->numgames; i++ )
|
||||
UI_ConvertGameInfo( &gameui.modsInfo[i], FI->games[i] );
|
||||
if( *x + *width <= gameui.ds.scissor_x )
|
||||
return false;
|
||||
if( *x >= gameui.ds.scissor_x + gameui.ds.scissor_width )
|
||||
return false;
|
||||
if( *y + *height <= gameui.ds.scissor_y )
|
||||
return false;
|
||||
if( *y >= gameui.ds.scissor_y + gameui.ds.scissor_height )
|
||||
return false;
|
||||
|
||||
dudx = (*u1 - *u0) / *width;
|
||||
dvdy = (*v1 - *v0) / *height;
|
||||
|
||||
if( *x < gameui.ds.scissor_x )
|
||||
{
|
||||
*u0 += (gameui.ds.scissor_x - *x) * dudx;
|
||||
*width -= gameui.ds.scissor_x - *x;
|
||||
*x = gameui.ds.scissor_x;
|
||||
}
|
||||
|
||||
if( *x + *width > gameui.ds.scissor_x + gameui.ds.scissor_width )
|
||||
{
|
||||
*u1 -= (*x + *width - (gameui.ds.scissor_x + gameui.ds.scissor_width)) * dudx;
|
||||
*width = gameui.ds.scissor_x + gameui.ds.scissor_width - *x;
|
||||
}
|
||||
|
||||
if( *y < gameui.ds.scissor_y )
|
||||
{
|
||||
*v0 += (gameui.ds.scissor_y - *y) * dvdy;
|
||||
*height -= gameui.ds.scissor_y - *y;
|
||||
*y = gameui.ds.scissor_y;
|
||||
}
|
||||
|
||||
if( *y + *height > gameui.ds.scissor_y + gameui.ds.scissor_height )
|
||||
{
|
||||
*v1 -= (*y + *height - (gameui.ds.scissor_y + gameui.ds.scissor_height)) * dvdy;
|
||||
*height = gameui.ds.scissor_y + gameui.ds.scissor_height - *y;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -482,10 +485,10 @@ static void PIC_DrawGeneric( float x, float y, float width, float height, const
|
||||
if( prc )
|
||||
{
|
||||
// calc user-defined rectangle
|
||||
s1 = prc->left / (float)w;
|
||||
t1 = prc->top / (float)h;
|
||||
s2 = prc->right / (float)w;
|
||||
t2 = prc->bottom / (float)h;
|
||||
s1 = (float)prc->left / (float)w;
|
||||
t1 = (float)prc->top / (float)h;
|
||||
s2 = (float)prc->right / (float)w;
|
||||
t2 = (float)prc->bottom / (float)h;
|
||||
|
||||
if( width == -1 && height == -1 )
|
||||
{
|
||||
@@ -506,9 +509,10 @@ static void PIC_DrawGeneric( float x, float y, float width, float height, const
|
||||
}
|
||||
|
||||
// pass scissor test if supposed
|
||||
if( !CL_Scissor( &gameui.ds.scissor, &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
if( gameui.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
return;
|
||||
|
||||
PicAdjustSize( &x, &y, &width, &height );
|
||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, gameui.ds.gl_texturenum );
|
||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
@@ -531,7 +535,7 @@ static HIMAGE GAME_EXPORT pfnPIC_Load( const char *szPicName, const byte *image_
|
||||
|
||||
if( !COM_CheckString( szPicName ))
|
||||
{
|
||||
Con_Reportf( S_ERROR "%s: refusing to load image with empty name\n", __func__ );
|
||||
Con_Reportf( S_ERROR "CL_LoadImage: refusing to load image with empty name\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -581,7 +585,7 @@ pfnPIC_Set
|
||||
|
||||
=========
|
||||
*/
|
||||
static void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
{
|
||||
gameui.ds.gl_texturenum = hPic;
|
||||
r = bound( 0, r, 255 );
|
||||
@@ -597,7 +601,7 @@ pfnPIC_Draw
|
||||
|
||||
=========
|
||||
*/
|
||||
static void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -609,7 +613,7 @@ pfnPIC_DrawTrans
|
||||
|
||||
=========
|
||||
*/
|
||||
static void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||
void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -621,7 +625,7 @@ pfnPIC_DrawHoles
|
||||
|
||||
=========
|
||||
*/
|
||||
static void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||
void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -633,7 +637,7 @@ pfnPIC_DrawAdditive
|
||||
|
||||
=========
|
||||
*/
|
||||
static void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||
void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -653,7 +657,11 @@ static void GAME_EXPORT pfnPIC_EnableScissor( int x, int y, int width, int heigh
|
||||
width = bound( 0, width, gameui.globals->scrWidth - x );
|
||||
height = bound( 0, height, gameui.globals->scrHeight - y );
|
||||
|
||||
CL_EnableScissor( &gameui.ds.scissor, x, y, width, height );
|
||||
gameui.ds.scissor_x = x;
|
||||
gameui.ds.scissor_width = width;
|
||||
gameui.ds.scissor_y = y;
|
||||
gameui.ds.scissor_height = height;
|
||||
gameui.ds.scissor_test = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -664,7 +672,11 @@ pfnPIC_DisableScissor
|
||||
*/
|
||||
static void GAME_EXPORT pfnPIC_DisableScissor( void )
|
||||
{
|
||||
CL_DisableScissor( &gameui.ds.scissor );
|
||||
gameui.ds.scissor_x = 0;
|
||||
gameui.ds.scissor_width = 0;
|
||||
gameui.ds.scissor_y = 0;
|
||||
gameui.ds.scissor_height = 0;
|
||||
gameui.ds.scissor_test = false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -685,17 +697,6 @@ static void GAME_EXPORT pfnFillRGBA( int x, int y, int width, int height, int r,
|
||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnCvar_RegisterVariable
|
||||
|
||||
=============
|
||||
*/
|
||||
static cvar_t *GAME_EXPORT pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags )
|
||||
{
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_GAMEUIDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_GAMEUIDLL ));
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnClientCmd
|
||||
@@ -763,7 +764,7 @@ static void GAME_EXPORT pfnDrawCharacter( int ix, int iy, int iwidth, int iheigh
|
||||
t2 = t1 + size;
|
||||
|
||||
// pass scissor test if supposed
|
||||
if( !CL_Scissor( &gameui.ds.scissor, &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
if( gameui.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
return;
|
||||
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
@@ -892,7 +893,7 @@ send client connect
|
||||
*/
|
||||
static void GAME_EXPORT pfnClientJoin( const netadr_t adr )
|
||||
{
|
||||
Cbuf_AddTextf( "connect %s\n", NET_AdrToString( adr ));
|
||||
Cbuf_AddText( va( "connect %s\n", NET_AdrToString( adr )));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -961,12 +962,11 @@ pfnGetGameInfo
|
||||
|
||||
=========
|
||||
*/
|
||||
static int GAME_EXPORT pfnGetOldGameInfo( GAMEINFO *pgameinfo )
|
||||
static int GAME_EXPORT pfnGetGameInfo( GAMEINFO *pgameinfo )
|
||||
{
|
||||
if( !pgameinfo )
|
||||
return 0;
|
||||
if( !pgameinfo ) return 0;
|
||||
|
||||
UI_ToOldGameInfo( pgameinfo, &gameui.gameInfo );
|
||||
*pgameinfo = gameui.gameInfo;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -978,26 +978,8 @@ pfnGetGamesList
|
||||
*/
|
||||
static GAMEINFO ** GAME_EXPORT pfnGetGamesList( int *numGames )
|
||||
{
|
||||
if( numGames )
|
||||
*numGames = FI->numgames;
|
||||
|
||||
if( !gameui.oldModsInfo )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !gameui.modsInfo )
|
||||
UI_GetModsInfo();
|
||||
|
||||
// first allocate array of pointers
|
||||
gameui.oldModsInfo = Mem_Calloc( gameui.mempool, sizeof( *gameui.oldModsInfo ) * FI->numgames );
|
||||
for( i = 0; i < FI->numgames; i++ )
|
||||
{
|
||||
gameui.oldModsInfo[i] = Mem_Calloc( gameui.mempool, sizeof( *gameui.oldModsInfo[i] ));
|
||||
UI_ToOldGameInfo( gameui.oldModsInfo[i], &gameui.modsInfo[i] );
|
||||
}
|
||||
}
|
||||
|
||||
return gameui.oldModsInfo;
|
||||
if( numGames ) *numGames = SI.numgames;
|
||||
return gameui.modsInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1042,23 +1024,30 @@ pfnCheckGameDll
|
||||
|
||||
=========
|
||||
*/
|
||||
static int GAME_EXPORT pfnCheckGameDll( void )
|
||||
int GAME_EXPORT pfnCheckGameDll( void )
|
||||
{
|
||||
#ifdef XASH_INTERNAL_GAMELIBS
|
||||
return true;
|
||||
#else
|
||||
string dllpath;
|
||||
void *hInst;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// loading server library drains too many ram
|
||||
// so 512MB iPod Touch cannot even connect to
|
||||
// to servers in cstrike
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if( svgame.hInstance )
|
||||
return true;
|
||||
|
||||
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||
|
||||
if( FS_FileExists( dllpath, false ))
|
||||
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
|
||||
{
|
||||
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
|
||||
return true;
|
||||
|
||||
}
|
||||
Con_Reportf( S_WARN "Could not load server library: %s\n", COM_GetLibraryError() );
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1069,7 +1058,10 @@ pfnChangeInstance
|
||||
*/
|
||||
static void GAME_EXPORT pfnChangeInstance( const char *newInstance, const char *szFinalMessage )
|
||||
{
|
||||
Con_Reportf( S_ERROR "%s menu call is deprecated!\n", __func__ );
|
||||
if( !szFinalMessage ) szFinalMessage = "";
|
||||
if( !newInstance || !*newInstance ) return;
|
||||
|
||||
Host_NewInstance( newInstance, szFinalMessage );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1126,51 +1118,8 @@ static char *pfnParseFile( char *buf, char *token )
|
||||
return COM_ParseFile( buf, token, INT_MAX );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnFileExists
|
||||
|
||||
legacy wrapper
|
||||
=============
|
||||
*/
|
||||
static int pfnFileExists( const char *path, int gamedironly )
|
||||
{
|
||||
return FS_FileExists( path, gamedironly );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnDelete
|
||||
|
||||
legacy wrapper
|
||||
=============
|
||||
*/
|
||||
static int pfnDelete( const char *path )
|
||||
{
|
||||
return FS_Delete( path );
|
||||
}
|
||||
|
||||
static void GAME_EXPORT pfnCon_DefaultColor( int r, int g, int b )
|
||||
{
|
||||
Con_DefaultColor( r, g, b, true );
|
||||
}
|
||||
|
||||
static void GAME_EXPORT pfnSetCursor( void *hCursor )
|
||||
{
|
||||
uintptr_t cursor;
|
||||
|
||||
if( !gameui.use_extended_api )
|
||||
return; // ignore original Xash menus
|
||||
|
||||
cursor = (uintptr_t)hCursor;
|
||||
if( cursor < dc_user || cursor > dc_last )
|
||||
return;
|
||||
|
||||
Platform_SetCursorType( cursor );
|
||||
}
|
||||
|
||||
// engine callbacks
|
||||
static const ui_enginefuncs_t gEngfuncs =
|
||||
static ui_enginefuncs_t gEngfuncs =
|
||||
{
|
||||
pfnPIC_Load,
|
||||
GL_FreeImage,
|
||||
@@ -1208,14 +1157,14 @@ static const ui_enginefuncs_t gEngfuncs =
|
||||
UI_DrawConsoleString,
|
||||
UI_DrawSetTextColor,
|
||||
Con_DrawStringLen,
|
||||
pfnCon_DefaultColor,
|
||||
Con_DefaultColor,
|
||||
pfnGetPlayerModel,
|
||||
pfnSetPlayerModel,
|
||||
pfnClearScene,
|
||||
pfnRenderScene,
|
||||
pfnAddEntity,
|
||||
Host_Error,
|
||||
pfnFileExists,
|
||||
FS_FileExists,
|
||||
pfnGetGameDir,
|
||||
Cmd_CheckMapsList,
|
||||
CL_Active,
|
||||
@@ -1234,7 +1183,7 @@ static const ui_enginefuncs_t gEngfuncs =
|
||||
pfnKeyGetState,
|
||||
pfnMemAlloc,
|
||||
pfnMemFree,
|
||||
pfnGetOldGameInfo,
|
||||
pfnGetGameInfo,
|
||||
pfnGetGamesList,
|
||||
pfnGetFilesList,
|
||||
SV_GetSaveComment,
|
||||
@@ -1248,13 +1197,13 @@ static const ui_enginefuncs_t gEngfuncs =
|
||||
pfnHostEndGame,
|
||||
COM_RandomFloat,
|
||||
COM_RandomLong,
|
||||
pfnSetCursor,
|
||||
IN_SetCursor,
|
||||
pfnIsMapValid,
|
||||
GL_ProcessTexture,
|
||||
COM_CompareFileTime,
|
||||
VID_GetModeString,
|
||||
(void*)COM_SaveFile,
|
||||
pfnDelete
|
||||
(void*)FS_Delete
|
||||
};
|
||||
|
||||
static void pfnEnableTextInput( int enable )
|
||||
@@ -1276,43 +1225,6 @@ static int pfnGetRenderers( unsigned int num, char *shortName, size_t size1, cha
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned int flags, int *len )
|
||||
{
|
||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||
}
|
||||
|
||||
static gameinfo2_t *pfnGetGameInfo( int gi_version )
|
||||
{
|
||||
if( gi_version != gameui.gameInfo.gi_version )
|
||||
return NULL;
|
||||
|
||||
return &gameui.gameInfo;
|
||||
}
|
||||
|
||||
static gameinfo2_t *pfnGetModInfo( int gi_version, int i )
|
||||
{
|
||||
if( i < 0 || i >= FI->numgames )
|
||||
return NULL;
|
||||
|
||||
if( !gameui.modsInfo )
|
||||
UI_GetModsInfo();
|
||||
|
||||
if( gi_version != gameui.modsInfo[i].gi_version )
|
||||
return NULL;
|
||||
|
||||
return &gameui.modsInfo[i];
|
||||
}
|
||||
|
||||
static int pfnIsCvarReadOnly( const char *name )
|
||||
{
|
||||
convar_t *cv = Cvar_FindVar( name );
|
||||
|
||||
if( !cv )
|
||||
return -1;
|
||||
|
||||
return FBitSet( cv->flags, FCVAR_READ_ONLY ) ? 1 : 0;
|
||||
}
|
||||
|
||||
static ui_extendedfuncs_t gExtendedfuncs =
|
||||
{
|
||||
pfnEnableTextInput,
|
||||
@@ -1321,14 +1233,7 @@ static ui_extendedfuncs_t gExtendedfuncs =
|
||||
Con_UtfMoveRight,
|
||||
pfnGetRenderers,
|
||||
Sys_DoubleTime,
|
||||
pfnParseFileSafe,
|
||||
NET_AdrToString,
|
||||
NET_CompareAdrSort,
|
||||
Sys_GetNativeObject,
|
||||
&gNetApi,
|
||||
pfnGetGameInfo,
|
||||
pfnGetModInfo,
|
||||
pfnIsCvarReadOnly,
|
||||
_COM_ParseFileSafe
|
||||
};
|
||||
|
||||
void UI_UnloadProgs( void )
|
||||
@@ -1338,15 +1243,14 @@ void UI_UnloadProgs( void )
|
||||
// deinitialize game
|
||||
gameui.dllFuncs.pfnShutdown();
|
||||
|
||||
Cmd_RemoveCommand( "ui_allowconsole" );
|
||||
Cvar_FullSet( "host_gameuiloaded", "0", FCVAR_READ_ONLY );
|
||||
|
||||
Cvar_Unlink( FCVAR_GAMEUIDLL );
|
||||
Cmd_Unlink( CMD_GAMEUIDLL );
|
||||
|
||||
COM_FreeLibrary( gameui.hInstance );
|
||||
Mem_FreePool( &gameui.mempool );
|
||||
memset( &gameui, 0, sizeof( gameui ));
|
||||
|
||||
Cvar_Unlink( FCVAR_GAMEUIDLL );
|
||||
Cmd_Unlink( CMD_GAMEUIDLL );
|
||||
}
|
||||
|
||||
qboolean UI_LoadProgs( void )
|
||||
@@ -1389,67 +1293,73 @@ qboolean UI_LoadProgs( void )
|
||||
if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL )
|
||||
{
|
||||
COM_FreeLibrary( gameui.hInstance );
|
||||
Con_Reportf( "%s: can't init menu API\n", __func__ );
|
||||
Con_Reportf( "UI_LoadProgs: can't init menu API\n" );
|
||||
gameui.hInstance = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
gameui.use_extended_api = false;
|
||||
gameui.use_text_api = false;
|
||||
|
||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||
gpEngfuncs = gEngfuncs;
|
||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
|
||||
gameui.mempool = Mem_AllocPool( "Menu Pool" );
|
||||
|
||||
if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals ))
|
||||
{
|
||||
COM_FreeLibrary( gameui.hInstance );
|
||||
Con_Reportf( "%s: can't init menu API\n", __func__ );
|
||||
Con_Reportf( "UI_LoadProgs: can't init menu API\n" );
|
||||
Mem_FreePool( &gameui.mempool );
|
||||
gameui.hInstance = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||
gpExtendedfuncs = gExtendedfuncs;
|
||||
memcpy( &gpExtendedfuncs, &gExtendedfuncs, sizeof( gExtendedfuncs ));
|
||||
memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 ));
|
||||
|
||||
// try to initialize new extended API
|
||||
if( ( GetExtAPI = (UIEXTENEDEDAPI)COM_GetProcAddress( gameui.hInstance, "GetExtAPI" ) ) )
|
||||
{
|
||||
Con_Reportf( "%s: extended Menu API found\n", __func__ );
|
||||
Con_Reportf( "UI_LoadProgs: extended Menu API found\n" );
|
||||
if( GetExtAPI( MENU_EXTENDED_API_VERSION, &gameui.dllFuncs2, &gpExtendedfuncs ) )
|
||||
{
|
||||
Con_Reportf( "%s: extended Menu API initialized\n", __func__ );
|
||||
gameui.use_extended_api = true;
|
||||
Con_Reportf( "UI_LoadProgs: extended Menu API initialized\n" );
|
||||
gameui.use_text_api = true;
|
||||
}
|
||||
}
|
||||
else // otherwise, fallback to old and deprecated extensions
|
||||
{
|
||||
if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) )
|
||||
{
|
||||
Con_Reportf( "%s: extended text API found\n", __func__ );
|
||||
Con_Reportf( "UI_LoadProgs: extended text API found\n" );
|
||||
Con_Reportf( S_WARN "Text API is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
||||
if( GiveTextApi( &gpExtendedfuncs ) ) // they are binary compatible, so we can just pass extended funcs API to menu
|
||||
{
|
||||
Con_Reportf( "%s: extended text API initialized\n", __func__ );
|
||||
gameui.use_extended_api = true;
|
||||
Con_Reportf( "UI_LoadProgs: extended text API initialized\n" );
|
||||
gameui.use_text_api = true;
|
||||
}
|
||||
}
|
||||
|
||||
gameui.dllFuncs2.pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" );
|
||||
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
|
||||
{
|
||||
Con_Reportf( "%s: AddTouchButtonToList call found\n", __func__ );
|
||||
Con_Reportf( "UI_LoadProgs: AddTouchButtonToList call found\n" );
|
||||
Con_Reportf( S_WARN "AddTouchButtonToList is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY );
|
||||
Cmd_AddRestrictedCommand( "ui_allowconsole", UI_ToggleAllowConsole_f, "unlocks developer console" );
|
||||
|
||||
UI_ConvertGameInfo( &gameui.gameInfo, FI->GameInfo ); // current gameinfo
|
||||
// setup gameinfo
|
||||
for( i = 0; i < SI.numgames; i++ )
|
||||
{
|
||||
gameui.modsInfo[i] = Mem_Calloc( gameui.mempool, sizeof( GAMEINFO ));
|
||||
UI_ConvertGameInfo( gameui.modsInfo[i], SI.games[i] );
|
||||
}
|
||||
|
||||
UI_ConvertGameInfo( &gameui.gameInfo, SI.GameInfo ); // current gameinfo
|
||||
|
||||
// setup globals
|
||||
gameui.globals->developer = host.allow_console;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,19 +20,26 @@ GNU General Public License for more details.
|
||||
#include "input.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
static CVAR_DEFINE_AUTO( vibration_length, "1.0", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "vibration length" );
|
||||
static CVAR_DEFINE_AUTO( vibration_enable, "1", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "enable vibration" );
|
||||
mobile_engfuncs_t *gMobileEngfuncs;
|
||||
|
||||
static cl_font_t g_scaled_font;
|
||||
static float g_font_scale;
|
||||
convar_t *vibration_length;
|
||||
convar_t *vibration_enable;
|
||||
|
||||
static void pfnVibrate( float life, char flags )
|
||||
{
|
||||
if( !vibration_enable.value || life < 0.0f )
|
||||
if( !vibration_enable->value )
|
||||
return;
|
||||
|
||||
if( life < 0.0f )
|
||||
{
|
||||
Con_Reportf( S_WARN "Negative vibrate time: %f\n", life );
|
||||
return;
|
||||
}
|
||||
|
||||
//Con_Reportf( "Vibrate: %f %d\n", life, flags );
|
||||
|
||||
// here goes platform-specific backends
|
||||
Platform_Vibrate( life * vibration_length.value, flags );
|
||||
Platform_Vibrate( life * vibration_length->value, flags );
|
||||
}
|
||||
|
||||
static void Vibrate_f( void )
|
||||
@@ -43,7 +50,7 @@ static void Vibrate_f( void )
|
||||
return;
|
||||
}
|
||||
|
||||
pfnVibrate( Q_atof( Cmd_Argv( 1 )), VIBRATE_NORMAL );
|
||||
pfnVibrate( Q_atof( Cmd_Argv(1) ), VIBRATE_NORMAL );
|
||||
}
|
||||
|
||||
static void pfnEnableTextInput( int enable )
|
||||
@@ -53,97 +60,75 @@ static void pfnEnableTextInput( int enable )
|
||||
|
||||
static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b, float scale )
|
||||
{
|
||||
// this call is very ineffective and possibly broken!
|
||||
rgba_t color = { r, g, b, 255 };
|
||||
int flags = FONT_DRAW_HUD;
|
||||
int width = clgame.scrInfo.charWidths[number] * scale * hud_scale->value;
|
||||
int height = clgame.scrInfo.iCharHeight * scale * hud_scale->value;
|
||||
|
||||
if( hud_utf8.value )
|
||||
SetBits( flags, FONT_DRAW_UTF8 );
|
||||
if( !cls.creditsFont.valid )
|
||||
return 0;
|
||||
|
||||
if( fabs( g_font_scale - scale ) > 0.1f ||
|
||||
g_scaled_font.hFontTexture != cls.creditsFont.hFontTexture )
|
||||
{
|
||||
int i;
|
||||
x *= hud_scale->value;
|
||||
y *= hud_scale->value;
|
||||
|
||||
g_scaled_font = cls.creditsFont;
|
||||
g_scaled_font.scale *= scale;
|
||||
g_scaled_font.charHeight *= scale;
|
||||
for( i = 0; i < ARRAYSIZE( g_scaled_font.charWidths ); i++ )
|
||||
g_scaled_font.charWidths[i] *= scale;
|
||||
number &= 255;
|
||||
number = Con_UtfProcessChar( number );
|
||||
|
||||
g_font_scale = scale;
|
||||
}
|
||||
if( number < 32 )
|
||||
return 0;
|
||||
|
||||
return CL_DrawCharacter( x, y, number, color, &g_scaled_font, flags );
|
||||
if( y < -height )
|
||||
return 0;
|
||||
|
||||
pfnPIC_Set( cls.creditsFont.hFontTexture, r, g, b, 255 );
|
||||
pfnPIC_DrawAdditive( x, y, width, height, &cls.creditsFont.fontRc[number] );
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
static void pfnTouch_HideButtons( const char *name, byte state )
|
||||
static void *pfnGetNativeObject( const char *obj )
|
||||
{
|
||||
Touch_HideButtons( name, state, true );
|
||||
if( !obj )
|
||||
return NULL;
|
||||
|
||||
// Backend should consider that obj is case-sensitive
|
||||
return Platform_GetNativeObject( obj );
|
||||
}
|
||||
|
||||
static void pfnTouch_RemoveButton( const char *name )
|
||||
{
|
||||
Touch_RemoveButton( name, true );
|
||||
}
|
||||
|
||||
static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned int flags, int *len )
|
||||
{
|
||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||
}
|
||||
|
||||
static const mobile_engfuncs_t gMobileEngfuncs =
|
||||
static mobile_engfuncs_t gpMobileEngfuncs =
|
||||
{
|
||||
MOBILITY_API_VERSION,
|
||||
pfnVibrate,
|
||||
pfnEnableTextInput,
|
||||
Touch_AddClientButton,
|
||||
Touch_AddDefaultButton,
|
||||
pfnTouch_HideButtons,
|
||||
pfnTouch_RemoveButton,
|
||||
Touch_SetClientOnly,
|
||||
Touch_HideButtons,
|
||||
Touch_RemoveButton,
|
||||
(void*)Touch_SetClientOnly,
|
||||
Touch_ResetDefaultButtons,
|
||||
pfnDrawScaledCharacter,
|
||||
Sys_Warn,
|
||||
Sys_GetNativeObject,
|
||||
pfnGetNativeObject,
|
||||
ID_SetCustomClientID,
|
||||
pfnParseFileSafe
|
||||
_COM_ParseFileSafe
|
||||
};
|
||||
|
||||
qboolean Mobile_Init( void )
|
||||
{
|
||||
qboolean success = false;
|
||||
pfnMobilityInterface ExportToClient;
|
||||
|
||||
Cmd_AddCommand( "vibrate", Vibrate_f, "Vibrate for specified time");
|
||||
Cvar_RegisterVariable( &vibration_length );
|
||||
Cvar_RegisterVariable( &vibration_enable );
|
||||
// find a mobility interface
|
||||
ExportToClient = COM_GetProcAddress( clgame.hInstance, MOBILITY_CLIENT_EXPORT );
|
||||
gMobileEngfuncs = &gpMobileEngfuncs;
|
||||
|
||||
// find mobility interface
|
||||
if(( ExportToClient = COM_GetProcAddress( clgame.hInstance, MOBILITY_CLIENT_EXPORT )))
|
||||
{
|
||||
static mobile_engfuncs_t mobile_engfuncs; // keep a copy, don't let user change engine pointers
|
||||
if( ExportToClient && !ExportToClient( gMobileEngfuncs ) )
|
||||
success = true;
|
||||
|
||||
mobile_engfuncs = gMobileEngfuncs;
|
||||
Cmd_AddCommand( "vibrate", (xcommand_t)Vibrate_f, "Vibrate for specified time");
|
||||
vibration_length = Cvar_Get( "vibration_length", "1.0", FCVAR_ARCHIVE, "Vibration length");
|
||||
vibration_enable = Cvar_Get( "vibration_enable", "1", FCVAR_ARCHIVE, "Enable vibration");
|
||||
|
||||
if( !ExportToClient( &mobile_engfuncs ))
|
||||
{
|
||||
Con_Reportf( "%s: ^2initailized extended MobilityAPI ^7ver. %i\n", __func__, MOBILITY_API_VERSION );
|
||||
return true;
|
||||
}
|
||||
|
||||
// make sure that mobile functions are cleared
|
||||
#if 1
|
||||
// some SDKs define export as returning void, breaking the contract
|
||||
// ignore result for now...
|
||||
return true;
|
||||
#else
|
||||
memset( &mobile_engfuncs, 0, sizeof( mobile_engfuncs ));
|
||||
|
||||
return false; // just tell user about problems
|
||||
#endif
|
||||
}
|
||||
|
||||
return true; // mobile interface is missed
|
||||
return success;
|
||||
}
|
||||
|
||||
void Mobile_Shutdown( void )
|
||||
|
||||
@@ -33,12 +33,12 @@ GNU General Public License for more details.
|
||||
#define NETGRAPH_NET_COLORS 5
|
||||
#define NUM_LATENCY_SAMPLES 8
|
||||
|
||||
CVAR_DEFINE_AUTO( net_graph, "0", FCVAR_ARCHIVE, "draw network usage graph" );
|
||||
static CVAR_DEFINE_AUTO( net_graphpos, "1", FCVAR_ARCHIVE, "network usage graph position" );
|
||||
static CVAR_DEFINE_AUTO( net_scale, "5", FCVAR_ARCHIVE, "network usage graph scale level" );
|
||||
static CVAR_DEFINE_AUTO( net_graphwidth, "192", FCVAR_ARCHIVE, "network usage graph width" );
|
||||
static CVAR_DEFINE_AUTO( net_graphheight, "64", FCVAR_ARCHIVE, "network usage graph height" );
|
||||
static CVAR_DEFINE_AUTO( net_graphsolid, "1", FCVAR_ARCHIVE, "fill segments in network usage graph" );
|
||||
convar_t *net_graph;
|
||||
static convar_t *net_graphpos;
|
||||
static convar_t *net_graphwidth;
|
||||
static convar_t *net_graphheight;
|
||||
static convar_t *net_graphsolid;
|
||||
static convar_t *net_scale;
|
||||
|
||||
static struct packet_latency_t
|
||||
{
|
||||
@@ -63,9 +63,9 @@ static byte netcolors[NETGRAPH_NET_COLORS+NETGRAPH_LERP_HEIGHT][4] =
|
||||
// other will be generated through NetGraph_InitColors()
|
||||
};
|
||||
|
||||
static const byte sendcolor[4] = { 88, 29, 130, 255 };
|
||||
static const byte holdcolor[4] = { 255, 0, 0, 200 };
|
||||
static const byte extrap_base_color[4] = { 255, 255, 255, 255 };
|
||||
static byte sendcolor[4] = { 88, 29, 130, 255 };
|
||||
static byte holdcolor[4] = { 255, 0, 0, 200 };
|
||||
static byte extrap_base_color[4] = { 255, 255, 255, 255 };
|
||||
static netbandwidthgraph_t netstat_graph[NET_TIMINGS];
|
||||
static float packet_loss;
|
||||
static float packet_choke;
|
||||
@@ -79,7 +79,7 @@ NetGraph_DrawRect
|
||||
NetGraph_FillRGBA shortcut
|
||||
==========
|
||||
*/
|
||||
static void NetGraph_DrawRect( const wrect_t *rect, const byte colors[4] )
|
||||
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
|
||||
{
|
||||
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
|
||||
|
||||
@@ -158,7 +158,6 @@ static void NetGraph_InitColors( void )
|
||||
f = (float)(i - hfrac) / (float)(NETGRAPH_LERP_HEIGHT - hfrac );
|
||||
VectorMA( mincolor[1], f, dc[1], netcolors[NETGRAPH_NET_COLORS + i] );
|
||||
}
|
||||
netcolors[NETGRAPH_NET_COLORS + i][3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +210,7 @@ static void NetGraph_GetFrameData( float *latency, int *latency_count )
|
||||
else
|
||||
{
|
||||
int frame_latency = Q_min( 1.0f, f->latency );
|
||||
p->latency = (( frame_latency + 0.1f ) / 1.1f ) * ( net_graphheight.value - NETGRAPH_LERP_HEIGHT - 2 );
|
||||
p->latency = (( frame_latency + 0.1f ) / 1.1f ) * ( net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 );
|
||||
|
||||
if( i > cls.netchan.incoming_sequence - NUM_LATENCY_SAMPLES )
|
||||
{
|
||||
@@ -260,7 +259,7 @@ static void NetGraph_DrawTimes( wrect_t rect, int x, int w )
|
||||
for( a = 0; a < w; a++ )
|
||||
{
|
||||
i = ( cls.netchan.outgoing_sequence - a ) & NET_TIMINGS_MASK;
|
||||
h = Q_min(( netstat_cmdinfo[i].cmd_lerp / 3.0f ) * NETGRAPH_LERP_HEIGHT, net_graphheight.value * 0.7f);
|
||||
h = ( netstat_cmdinfo[i].cmd_lerp / 3.0f ) * NETGRAPH_LERP_HEIGHT;
|
||||
|
||||
fill.left = x + w - a - 1;
|
||||
fill.right = fill.bottom = 1;
|
||||
@@ -273,7 +272,7 @@ static void NetGraph_DrawTimes( wrect_t rect, int x, int w )
|
||||
h -= extrap_point;
|
||||
fill.top -= extrap_point;
|
||||
|
||||
if( !net_graphsolid.value )
|
||||
if( !net_graphsolid->value )
|
||||
{
|
||||
fill.top -= (h - 1);
|
||||
start = (h - 1);
|
||||
@@ -281,10 +280,7 @@ static void NetGraph_DrawTimes( wrect_t rect, int x, int w )
|
||||
|
||||
for( j = start; j < h; j++ )
|
||||
{
|
||||
int color = NETGRAPH_NET_COLORS + j + extrap_point;
|
||||
color = Q_min( color, ARRAYSIZE( netcolors ) - 1 );
|
||||
|
||||
NetGraph_DrawRect( &fill, netcolors[color] );
|
||||
NetGraph_DrawRect( &fill, netcolors[NETGRAPH_NET_COLORS + j + extrap_point] );
|
||||
fill.top--;
|
||||
}
|
||||
}
|
||||
@@ -295,15 +291,12 @@ static void NetGraph_DrawTimes( wrect_t rect, int x, int w )
|
||||
fill.top -= h;
|
||||
h = extrap_point - h;
|
||||
|
||||
if( !net_graphsolid.value )
|
||||
if( !net_graphsolid->value )
|
||||
h = 1;
|
||||
|
||||
for( j = 0; j < h; j++ )
|
||||
{
|
||||
int color = NETGRAPH_NET_COLORS + j + oldh;
|
||||
color = Q_min( color, ARRAYSIZE( netcolors ) - 1 );
|
||||
|
||||
NetGraph_DrawRect( &fill, netcolors[color] );
|
||||
NetGraph_DrawRect( &fill, netcolors[NETGRAPH_NET_COLORS + j + oldh] );
|
||||
fill.top--;
|
||||
}
|
||||
}
|
||||
@@ -334,7 +327,7 @@ NetGraph_DrawHatches
|
||||
*/
|
||||
static void NetGraph_DrawHatches( int x, int y )
|
||||
{
|
||||
int ystep = (int)( 10.0f / net_scale.value );
|
||||
int ystep = (int)( 10.0f / net_scale->value );
|
||||
byte colorminor[4] = { 0, 63, 63, 200 };
|
||||
byte color[4] = { 0, 200, 0, 255 };
|
||||
wrect_t hatch = { x, 4, y, 1 };
|
||||
@@ -342,9 +335,9 @@ static void NetGraph_DrawHatches( int x, int y )
|
||||
|
||||
ystep = Q_max( ystep, 1 );
|
||||
|
||||
for( starty = hatch.top; hatch.top > 0 && ((starty - hatch.top) * net_scale.value < (maxmsgbytes + 50)); hatch.top -= ystep )
|
||||
for( starty = hatch.top; hatch.top > 0 && ((starty - hatch.top) * net_scale->value < (maxmsgbytes + 50)); hatch.top -= ystep )
|
||||
{
|
||||
if(!((int)((starty - hatch.top) * net_scale.value ) % 50 ))
|
||||
if(!((int)((starty - hatch.top) * net_scale->value ) % 50 ))
|
||||
{
|
||||
NetGraph_DrawRect( &hatch, color );
|
||||
}
|
||||
@@ -364,20 +357,19 @@ NetGraph_DrawTextFields
|
||||
static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, float avg, int packet_loss, int packet_choke, int graphtype )
|
||||
{
|
||||
static int lastout;
|
||||
cl_font_t *font = Con_GetFont( 0 );
|
||||
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
||||
int ptx = Q_max( x + w - NETGRAPH_LERP_HEIGHT - 1, 1 );
|
||||
int pty = Q_max( rect.top + rect.bottom - NETGRAPH_LERP_HEIGHT - 3, 1 );
|
||||
int out, i = ( cls.netchan.outgoing_sequence - 1 ) & NET_TIMINGS_MASK;
|
||||
int j = cls.netchan.incoming_sequence & NET_TIMINGS_MASK;
|
||||
int last_y = y - net_graphheight.value;
|
||||
int last_y = y - net_graphheight->value;
|
||||
|
||||
if( count > 0 )
|
||||
{
|
||||
avg = avg / (float)( count - ( host.frametime * FRAMERATE_AVG_FRAC ));
|
||||
|
||||
if( cl_updaterate.value > 0.0f )
|
||||
avg -= 1000.0f / cl_updaterate.value;
|
||||
if( cl_updaterate->value > 0.0f )
|
||||
avg -= 1000.0f / cl_updaterate->value;
|
||||
|
||||
// can't be below zero
|
||||
avg = Q_max( 0.0f, avg );
|
||||
@@ -386,17 +378,16 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
||||
|
||||
// move rolling average
|
||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
||||
|
||||
CL_SetFontRendermode( font );
|
||||
Con_SetFont( 0 );
|
||||
|
||||
if( framerate > 0.0f )
|
||||
{
|
||||
y -= net_graphheight.value;
|
||||
y -= net_graphheight->value;
|
||||
|
||||
CL_DrawStringf( font, x, y, colors, FONT_DRAW_NORENDERMODE, "%.1f fps" , 1.0f / framerate);
|
||||
Con_DrawString( x, y, va( "%.1f fps" , 1.0f / framerate ), colors );
|
||||
|
||||
if( avg > 1.0f )
|
||||
CL_DrawStringf( font, x + 75, y, colors, FONT_DRAW_NORENDERMODE, "%i ms" , (int)avg );
|
||||
Con_DrawString( x + 75, y, va( "%i ms" , (int)avg ), colors );
|
||||
|
||||
y += 15;
|
||||
|
||||
@@ -404,12 +395,10 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
||||
if( !out ) out = lastout;
|
||||
else lastout = out;
|
||||
|
||||
CL_DrawStringf( font, x, y, colors, FONT_DRAW_NORENDERMODE,
|
||||
"in : %i %.2f kb/s", netstat_graph[j].msgbytes, cls.netchan.flow[FLOW_INCOMING].avgkbytespersec );
|
||||
Con_DrawString( x, y, va( "in : %i %.2f k/s", netstat_graph[j].msgbytes, cls.netchan.flow[FLOW_INCOMING].avgkbytespersec ), colors );
|
||||
y += 15;
|
||||
|
||||
CL_DrawStringf( font, x, y, colors, FONT_DRAW_NORENDERMODE,
|
||||
"out: %i %.2f kb/s", out, cls.netchan.flow[FLOW_OUTGOING].avgkbytespersec );
|
||||
Con_DrawString( x, y, va( "out: %i %.2f k/s", out, cls.netchan.flow[FLOW_OUTGOING].avgkbytespersec ), colors );
|
||||
y += 15;
|
||||
|
||||
if( graphtype > 2 )
|
||||
@@ -417,14 +406,16 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
||||
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01f );
|
||||
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01f );
|
||||
|
||||
CL_DrawStringf( font, x, y, colors, FONT_DRAW_NORENDERMODE, "loss: %i choke: %i", loss, choke );
|
||||
Con_DrawString( x, y, va( "loss: %i choke: %i", loss, choke ), colors );
|
||||
}
|
||||
}
|
||||
|
||||
if( graphtype < 3 )
|
||||
CL_DrawStringf( font, ptx, pty, colors, FONT_DRAW_NORENDERMODE, "%i/s", (int)cl_cmdrate.value );
|
||||
Con_DrawString( ptx, pty, va( "%i/s", (int)cl_cmdrate->value ), colors );
|
||||
|
||||
CL_DrawStringf( font, ptx, last_y, colors, FONT_DRAW_NORENDERMODE, "%i/s" , (int)cl_updaterate.value );
|
||||
Con_DrawString( ptx, last_y, va( "%i/s" , (int)cl_updaterate->value ), colors );
|
||||
|
||||
Con_RestoreFont();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -435,12 +426,12 @@ NetGraph_DrawDataSegment
|
||||
*/
|
||||
static int NetGraph_DrawDataSegment( wrect_t *fill, int bytes, byte r, byte g, byte b, byte a )
|
||||
{
|
||||
float h = bytes / net_scale.value;
|
||||
float h = bytes / net_scale->value;
|
||||
byte colors[4] = { r, g, b, a };
|
||||
|
||||
fill->top -= (int)h;
|
||||
|
||||
if( net_graphsolid.value )
|
||||
if( net_graphsolid->value )
|
||||
fill->bottom = (int)h;
|
||||
else fill->bottom = 1;
|
||||
|
||||
@@ -498,7 +489,7 @@ NetGraph_DrawDataUsage
|
||||
static void NetGraph_DrawDataUsage( int x, int y, int w, int graphtype )
|
||||
{
|
||||
int a, i, h, lastvalidh = 0, ping;
|
||||
int pingheight = net_graphheight.value - NETGRAPH_LERP_HEIGHT - 2;
|
||||
int pingheight = net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2;
|
||||
wrect_t fill = { 0 };
|
||||
byte color[4];
|
||||
|
||||
@@ -554,7 +545,7 @@ static void NetGraph_DrawDataUsage( int x, int y, int w, int graphtype )
|
||||
continue;
|
||||
|
||||
color[0] = color[1] = color[2] = color[3] = 255;
|
||||
fill.top = y - net_graphheight.value - 1;
|
||||
fill.top = y - net_graphheight->value - 1;
|
||||
fill.bottom = 1;
|
||||
|
||||
if( NetGraph_AtEdge( a, w ))
|
||||
@@ -589,7 +580,7 @@ static void NetGraph_DrawDataUsage( int x, int y, int w, int graphtype )
|
||||
if( !NetGraph_DrawDataSegment( &fill, netstat_graph[i].voicebytes, 255, 255, 255, 255 ))
|
||||
continue;
|
||||
|
||||
fill.top = y - net_graphheight.value - 1;
|
||||
fill.top = y - net_graphheight->value - 1;
|
||||
fill.bottom = 1;
|
||||
fill.top -= 2;
|
||||
|
||||
@@ -598,7 +589,7 @@ static void NetGraph_DrawDataUsage( int x, int y, int w, int graphtype )
|
||||
}
|
||||
|
||||
if( graphtype >= 2 )
|
||||
NetGraph_DrawHatches( x, y - net_graphheight.value - 1 );
|
||||
NetGraph_DrawHatches( x, y - net_graphheight->value - 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -613,18 +604,18 @@ static void NetGraph_GetScreenPos( wrect_t *rect, int *w, int *x, int *y )
|
||||
rect->right = refState.width;
|
||||
rect->bottom = refState.height;
|
||||
|
||||
*w = Q_min( NET_TIMINGS, net_graphwidth.value );
|
||||
*w = Q_min( NET_TIMINGS, net_graphwidth->value );
|
||||
if( rect->right < *w + 10 )
|
||||
*w = rect->right - 10;
|
||||
|
||||
// detect x and y position
|
||||
switch( (int)net_graphpos.value )
|
||||
switch( (int)net_graphpos->value )
|
||||
{
|
||||
case 1: // right sided
|
||||
*x = rect->left + rect->right - 5 - *w;
|
||||
break;
|
||||
case 2: // center
|
||||
*x = ( rect->left + ( rect->right - 10 - *w )) / 2;
|
||||
*x = rect->left + ( rect->right - 10 - *w ) / 2;
|
||||
break;
|
||||
default: // left sided
|
||||
*x = rect->left + 5;
|
||||
@@ -661,16 +652,16 @@ void SCR_DrawNetGraph( void )
|
||||
{
|
||||
graphtype = 2;
|
||||
}
|
||||
else if( net_graph.value != 0.0f )
|
||||
else if( net_graph->value != 0.0f )
|
||||
{
|
||||
graphtype = (int)net_graph.value;
|
||||
graphtype = (int)net_graph->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( net_scale.value <= 0 )
|
||||
if( net_scale->value <= 0 )
|
||||
Cvar_SetValue( "net_scale", 0.1f );
|
||||
|
||||
NetGraph_GetScreenPos( &rect, &w, &x, &y );
|
||||
@@ -681,7 +672,7 @@ void SCR_DrawNetGraph( void )
|
||||
|
||||
if( graphtype < 3 )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransColor );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||
ref.dllFuncs.GL_Bind( XASH_TEXTURE0, R_GetBuiltinTexture( REF_WHITE_TEXTURE ) );
|
||||
ref.dllFuncs.Begin( TRI_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
|
||||
|
||||
@@ -697,12 +688,12 @@ void SCR_DrawNetGraph( void )
|
||||
|
||||
void CL_InitNetgraph( void )
|
||||
{
|
||||
Cvar_RegisterVariable( &net_graph );
|
||||
Cvar_RegisterVariable( &net_graphpos );
|
||||
Cvar_RegisterVariable( &net_scale );
|
||||
Cvar_RegisterVariable( &net_graphwidth );
|
||||
Cvar_RegisterVariable( &net_graphheight );
|
||||
Cvar_RegisterVariable( &net_graphsolid );
|
||||
net_graph = Cvar_Get( "net_graph", "0", FCVAR_ARCHIVE, "draw network usage graph" );
|
||||
net_graphpos = Cvar_Get( "net_graphpos", "1", FCVAR_ARCHIVE, "network usage graph position" );
|
||||
net_scale = Cvar_Get( "net_scale", "5", FCVAR_ARCHIVE, "network usage graph scale level" );
|
||||
net_graphwidth = Cvar_Get( "net_graphwidth", "192", FCVAR_ARCHIVE, "network usage graph width" );
|
||||
net_graphheight = Cvar_Get( "net_graphheight", "64", FCVAR_ARCHIVE, "network usage graph height" );
|
||||
net_graphsolid = Cvar_Get( "net_graphsolid", "1", FCVAR_ARCHIVE, "fill segments in network usage graph" );
|
||||
packet_loss = packet_choke = 0.0;
|
||||
|
||||
NetGraph_InitColors();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,631 +0,0 @@
|
||||
/*
|
||||
cl_parse.c - parse a message received from the server
|
||||
Copyright (C) 2008 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or 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 your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "net_encode.h"
|
||||
#include "particledef.h"
|
||||
#include "cl_tent.h"
|
||||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
#include "input.h"
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseStaticEntity
|
||||
|
||||
static client entity
|
||||
==================
|
||||
*/
|
||||
static void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||
{
|
||||
int i;
|
||||
entity_state_t state;
|
||||
cl_entity_t *ent;
|
||||
|
||||
memset( &state, 0, sizeof( state ));
|
||||
state.modelindex = MSG_ReadShort( msg );
|
||||
state.sequence = MSG_ReadByte( msg );
|
||||
state.frame = MSG_ReadByte( msg );
|
||||
state.colormap = MSG_ReadWord( msg );
|
||||
state.skin = MSG_ReadByte( msg );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
state.origin[i] = MSG_ReadCoord( msg );
|
||||
state.angles[i] = MSG_ReadBitAngle( msg, 16 );
|
||||
}
|
||||
|
||||
state.rendermode = MSG_ReadByte( msg );
|
||||
|
||||
if( state.rendermode != kRenderNormal )
|
||||
{
|
||||
state.renderamt = MSG_ReadByte( msg );
|
||||
state.rendercolor.r = MSG_ReadByte( msg );
|
||||
state.rendercolor.g = MSG_ReadByte( msg );
|
||||
state.rendercolor.b = MSG_ReadByte( msg );
|
||||
state.renderfx = MSG_ReadByte( msg );
|
||||
}
|
||||
|
||||
i = clgame.numStatics;
|
||||
if( i >= MAX_STATIC_ENTITIES )
|
||||
{
|
||||
Con_Printf( S_ERROR "MAX_STATIC_ENTITIES limit exceeded!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
ent = &clgame.static_entities[i];
|
||||
clgame.numStatics++;
|
||||
|
||||
// all states are same
|
||||
ent->baseline = ent->curstate = ent->prevstate = state;
|
||||
ent->index = 0; // static entities doesn't has the numbers
|
||||
|
||||
// statics may be respawned in game e.g. for demo recording
|
||||
if( cls.state == ca_connected || cls.state == ca_validate )
|
||||
ent->trivial_accept = INVALID_HANDLE;
|
||||
|
||||
// setup the new static entity
|
||||
VectorCopy( ent->curstate.origin, ent->origin );
|
||||
VectorCopy( ent->curstate.angles, ent->angles );
|
||||
ent->model = CL_ModelHandle( state.modelindex );
|
||||
ent->curstate.framerate = 1.0f;
|
||||
CL_ResetLatchedVars( ent, true );
|
||||
|
||||
if( ent->curstate.rendermode == kRenderNormal && ent->model != NULL )
|
||||
{
|
||||
// auto 'solid' faces
|
||||
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && Host_IsQuakeCompatible( ))
|
||||
{
|
||||
ent->curstate.rendermode = kRenderTransAlpha;
|
||||
ent->curstate.renderamt = 255;
|
||||
}
|
||||
}
|
||||
|
||||
R_AddEfrags( ent ); // add link
|
||||
}
|
||||
|
||||
static void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
||||
{
|
||||
vec3_t pos;
|
||||
int chan, sound;
|
||||
float volume, attn;
|
||||
int flags, pitch, entnum;
|
||||
sound_t handle = 0;
|
||||
|
||||
flags = MSG_ReadWord( msg );
|
||||
if( flags & SND_LEGACY_LARGE_INDEX )
|
||||
{
|
||||
sound = MSG_ReadWord( msg );
|
||||
flags &= ~SND_LEGACY_LARGE_INDEX;
|
||||
}
|
||||
else
|
||||
sound = MSG_ReadByte( msg );
|
||||
chan = MSG_ReadByte( msg );
|
||||
|
||||
if( FBitSet( flags, SND_VOLUME ))
|
||||
volume = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
else volume = VOL_NORM;
|
||||
|
||||
if( FBitSet( flags, SND_ATTENUATION ))
|
||||
attn = (float)MSG_ReadByte( msg ) / 64.0f;
|
||||
else attn = ATTN_NONE;
|
||||
|
||||
if( FBitSet( flags, SND_PITCH ))
|
||||
pitch = MSG_ReadByte( msg );
|
||||
else pitch = PITCH_NORM;
|
||||
|
||||
// entity reletive
|
||||
entnum = MSG_ReadWord( msg );
|
||||
|
||||
// positioned in space
|
||||
MSG_ReadVec3Coord( msg, pos );
|
||||
|
||||
if( FBitSet( flags, SND_SENTENCE ))
|
||||
{
|
||||
char sentenceName[32];
|
||||
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
|
||||
handle = S_RegisterSound( sentenceName );
|
||||
}
|
||||
else handle = cl.sound_index[sound]; // see precached sound
|
||||
|
||||
if( !cl.audio_prepped )
|
||||
return; // too early
|
||||
|
||||
// g-cont. sound and ambient sound have only difference with channel
|
||||
if( is_ambient )
|
||||
{
|
||||
S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags );
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound( pos, entnum, chan, handle, volume, attn, pitch, flags );
|
||||
}
|
||||
}
|
||||
/*
|
||||
================
|
||||
CL_PrecacheSound
|
||||
|
||||
prceache sound from server
|
||||
================
|
||||
*/
|
||||
static void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||
{
|
||||
int soundIndex;
|
||||
|
||||
soundIndex = MSG_ReadUBitLong( msg, MAX_SOUND_BITS );
|
||||
|
||||
if( soundIndex < 0 || soundIndex >= MAX_SOUNDS )
|
||||
Host_Error( "%s: bad soundindex %i\n", __func__, soundIndex );
|
||||
|
||||
Q_strncpy( cl.sound_precache[soundIndex], MSG_ReadString( msg ), sizeof( cl.sound_precache[0] ));
|
||||
|
||||
// when we loading map all resources is precached sequentially
|
||||
//if( !cl.audio_prepped ) return;
|
||||
|
||||
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
||||
}
|
||||
|
||||
static void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
||||
{
|
||||
int modelIndex;
|
||||
string model;
|
||||
|
||||
modelIndex = MSG_ReadUBitLong( msg, MAX_LEGACY_MODEL_BITS );
|
||||
|
||||
if( modelIndex < 0 || modelIndex >= MAX_MODELS )
|
||||
Host_Error( "%s: bad modelindex %i\n", __func__, modelIndex );
|
||||
|
||||
Q_strncpy( model, MSG_ReadString( msg ), sizeof( model ));
|
||||
//Q_strncpy( cl.model_precache[modelIndex], BF_ReadString( msg ), sizeof( cl.model_precache[0] ));
|
||||
|
||||
// when we loading map all resources is precached sequentially
|
||||
//if( !cl.video_prepped ) return;
|
||||
if( modelIndex == 1 && !cl.worldmodel )
|
||||
{
|
||||
CL_ClearWorld ();
|
||||
|
||||
cl.models[modelIndex] = cl.worldmodel = Mod_LoadWorld( model, true );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//Mod_RegisterModel( cl.model_precache[modelIndex], modelIndex );
|
||||
|
||||
cl.models[modelIndex] = Mod_ForName( model, false, false );
|
||||
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
||||
}
|
||||
|
||||
static void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
||||
{
|
||||
int eventIndex;
|
||||
|
||||
eventIndex = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
if( eventIndex < 0 || eventIndex >= MAX_EVENTS )
|
||||
Host_Error( "%s: bad eventindex %i\n", __func__, eventIndex );
|
||||
|
||||
Q_strncpy( cl.event_precache[eventIndex], MSG_ReadString( msg ), sizeof( cl.event_precache[0] ));
|
||||
|
||||
// can be set now
|
||||
CL_SetEventIndex( cl.event_precache[eventIndex], eventIndex );
|
||||
}
|
||||
|
||||
#if XASH_LOW_MEMORY == 0
|
||||
#define MAX_LEGACY_RESOURCES 2048
|
||||
#elif XASH_LOW_MEMORY == 2
|
||||
#define MAX_LEGACY_RESOURCES 1
|
||||
#elif XASH_LOW_MEMORY == 1
|
||||
#define MAX_LEGACY_RESOURCES 512
|
||||
#endif
|
||||
/*
|
||||
==============
|
||||
CL_ParseResourceList
|
||||
|
||||
==============
|
||||
*/
|
||||
static void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||
{
|
||||
int i = 0;
|
||||
static struct
|
||||
{
|
||||
int rescount;
|
||||
int restype[MAX_LEGACY_RESOURCES];
|
||||
char resnames[MAX_LEGACY_RESOURCES][MAX_QPATH];
|
||||
} reslist;
|
||||
|
||||
memset( &reslist, 0, sizeof( reslist ));
|
||||
reslist.rescount = MSG_ReadWord( msg ) - 1;
|
||||
|
||||
if( reslist.rescount > MAX_LEGACY_RESOURCES )
|
||||
Host_Error( "MAX_RESOURCES reached\n" );
|
||||
|
||||
for( i = 0; i < reslist.rescount; i++ )
|
||||
{
|
||||
reslist.restype[i] = MSG_ReadWord( msg );
|
||||
Q_strncpy( reslist.resnames[i], MSG_ReadString( msg ), sizeof( reslist.resnames[i] ));
|
||||
}
|
||||
|
||||
if( cls.demoplayback )
|
||||
return;
|
||||
|
||||
if( !cl_allow_download.value )
|
||||
{
|
||||
Con_DPrintf( "Refusing new resource, cl_allowdownload set to 0\n" );
|
||||
reslist.rescount = 0;
|
||||
}
|
||||
|
||||
if( cls.state == ca_active && !cl_download_ingame.value )
|
||||
{
|
||||
Con_DPrintf( "Refusing new resource, cl_download_ingame set to 0\n" );
|
||||
reslist.rescount = 0;
|
||||
}
|
||||
|
||||
HTTP_ResetProcessState();
|
||||
|
||||
host.downloadcount = 0;
|
||||
|
||||
for( i = 0; i < reslist.rescount; i++ )
|
||||
{
|
||||
char soundpath[MAX_VA_STRING];
|
||||
const char *path;
|
||||
|
||||
if( reslist.restype[i] == t_sound )
|
||||
{
|
||||
Q_snprintf( soundpath, sizeof( soundpath ), DEFAULT_SOUNDPATH "%s", reslist.resnames[i] );
|
||||
|
||||
path = soundpath;
|
||||
}
|
||||
else path = reslist.resnames[i];
|
||||
|
||||
if( FS_FileExists( path, false ))
|
||||
continue; // already exists
|
||||
|
||||
host.downloadcount++;
|
||||
HTTP_AddDownload( path, -1, true, NULL );
|
||||
}
|
||||
|
||||
if( !host.downloadcount )
|
||||
{
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, "continueloading" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_ParseLegacyServerMessage
|
||||
|
||||
dispatch messages
|
||||
=====================
|
||||
*/
|
||||
void CL_ParseLegacyServerMessage( sizebuf_t *msg )
|
||||
{
|
||||
size_t bufStart, playerbytes;
|
||||
int cmd;
|
||||
int old_background;
|
||||
const char *s;
|
||||
|
||||
// parse the message
|
||||
while( 1 )
|
||||
{
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
{
|
||||
Host_Error( "%s: overflow!\n", __func__ );
|
||||
return;
|
||||
}
|
||||
|
||||
// mark start position
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
|
||||
// end of message (align bits)
|
||||
if( MSG_GetNumBitsLeft( msg ) < 8 )
|
||||
break;
|
||||
|
||||
cmd = MSG_ReadServerCmd( msg );
|
||||
|
||||
// record command for debugging spew on parse problem
|
||||
CL_Parse_RecordCommand( cmd, bufStart );
|
||||
|
||||
if( CL_ParseCommonDLLMessage( msg, PROTO_LEGACY, cmd, bufStart ))
|
||||
continue;
|
||||
|
||||
// other commands
|
||||
switch( cmd )
|
||||
{
|
||||
case svc_bad:
|
||||
Host_Error( "svc_bad\n" );
|
||||
break;
|
||||
case svc_nop:
|
||||
// this does nothing
|
||||
break;
|
||||
case svc_disconnect:
|
||||
CL_Drop ();
|
||||
Host_AbortCurrentFrame ();
|
||||
break;
|
||||
case svc_legacy_event:
|
||||
CL_ParseEvent( msg, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_legacy_changing:
|
||||
old_background = cl.background;
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
int maxclients = cl.maxclients;
|
||||
|
||||
// we can only changelevel in singleplayer
|
||||
// and singleplayer always runs in current protocol
|
||||
// cls.changelevel = true;
|
||||
S_StopAllSounds( true );
|
||||
|
||||
Con_Printf( "Server changing, reconnecting\n" );
|
||||
|
||||
if( cls.demoplayback )
|
||||
{
|
||||
SCR_BeginLoadingPlaque( cl.background );
|
||||
cls.changedemo = true;
|
||||
}
|
||||
|
||||
CL_ClearState( );
|
||||
|
||||
// a1ba: need to restore cl.maxclients because engine chooses
|
||||
// frame backups count depending on this value
|
||||
// In general, it's incorrect to call CL_InitEdicts right after
|
||||
// CL_ClearState because of this bug. Some time later this logic
|
||||
// should be re-done.
|
||||
CL_InitEdicts( maxclients ); // re-arrange edicts
|
||||
}
|
||||
else Con_Printf( "Server disconnected, reconnecting\n" );
|
||||
|
||||
if( cls.demoplayback )
|
||||
{
|
||||
cl.background = (cls.demonum != -1) ? true : false;
|
||||
cls.state = ca_connected;
|
||||
}
|
||||
else
|
||||
{
|
||||
// g-cont. local client skip the challenge
|
||||
if( SV_Active( ))
|
||||
cls.state = ca_disconnected;
|
||||
else cls.state = ca_connecting;
|
||||
cl.background = old_background;
|
||||
cls.connect_time = MAX_HEARTBEAT;
|
||||
cls.connect_retry = 0;
|
||||
}
|
||||
break;
|
||||
case svc_setview:
|
||||
CL_ParseViewEntity( msg );
|
||||
break;
|
||||
case svc_sound:
|
||||
CL_LegacyParseSoundPacket( msg, false );
|
||||
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_legacy_ambientsound:
|
||||
CL_LegacyParseSoundPacket( msg, true );
|
||||
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
|
||||
break;
|
||||
case svc_time:
|
||||
CL_ParseServerTime( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_print:
|
||||
Con_Printf( "%s", MSG_ReadString( msg ));
|
||||
break;
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString( msg );
|
||||
if( cl_trace_stufftext.value )
|
||||
{
|
||||
size_t len = Q_strlen( s );
|
||||
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||
}
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
// disable Cry Of Fear antisave protection
|
||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||
break; // too early
|
||||
#endif
|
||||
Cbuf_AddFilteredText( s );
|
||||
break;
|
||||
case svc_setangle:
|
||||
CL_ParseSetAngle( msg );
|
||||
break;
|
||||
case svc_serverdata:
|
||||
Cbuf_Execute(); // make sure any stuffed commands are done
|
||||
CL_ParseServerData( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_lightstyle:
|
||||
CL_ParseLightStyle( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_updateuserinfo:
|
||||
CL_UpdateUserinfo( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_deltatable:
|
||||
Delta_ParseTableField( msg );
|
||||
break;
|
||||
case svc_clientdata:
|
||||
CL_ParseClientData( msg, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_resource:
|
||||
CL_ParseResource( msg );
|
||||
break;
|
||||
case svc_pings:
|
||||
CL_UpdateUserPings( msg );
|
||||
break;
|
||||
case svc_particle:
|
||||
CL_ParseParticles( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_restoresound:
|
||||
Con_Printf( S_ERROR "%s: svc_restoresound: implement me!\n", __func__ );
|
||||
break;
|
||||
case svc_spawnstatic:
|
||||
CL_LegacyParseStaticEntity( msg );
|
||||
break;
|
||||
case svc_event_reliable:
|
||||
CL_ParseReliableEvent( msg, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_spawnbaseline:
|
||||
CL_ParseBaseline( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_setpause:
|
||||
cl.paused = ( MSG_ReadOneBit( msg ) != 0 );
|
||||
break;
|
||||
case svc_signonnum:
|
||||
CL_ParseSignon( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_centerprint:
|
||||
CL_CenterPrint( MSG_ReadString( msg ), 0.25f );
|
||||
break;
|
||||
case svc_legacy_modelindex:
|
||||
CL_LegacyPrecacheModel( msg );
|
||||
break;
|
||||
case svc_legacy_soundindex:
|
||||
CL_LegacyPrecacheSound( msg );
|
||||
break;
|
||||
case svc_restore:
|
||||
CL_ParseRestore( msg );
|
||||
break;
|
||||
case svc_legacy_eventindex:
|
||||
CL_LegacyPrecacheEvent(msg);
|
||||
break;
|
||||
case svc_bspdecal:
|
||||
CL_ParseStaticDecal( msg );
|
||||
break;
|
||||
case svc_addangle:
|
||||
CL_ParseAddAngle( msg );
|
||||
break;
|
||||
case svc_usermessage:
|
||||
CL_RegisterUserMessage( msg, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_packetentities:
|
||||
playerbytes = CL_ParsePacketEntities( msg, false, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||
break;
|
||||
case svc_deltapacketentities:
|
||||
playerbytes = CL_ParsePacketEntities( msg, true, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||
break;
|
||||
case svc_legacy_chokecount:
|
||||
{
|
||||
int i, j;
|
||||
i = MSG_ReadByte( msg );
|
||||
j = cls.netchan.incoming_acknowledged - 1;
|
||||
for( ; i > 0 && j > cls.netchan.outgoing_sequence - CL_UPDATE_BACKUP; j-- )
|
||||
{
|
||||
if( cl.frames[j & CL_UPDATE_MASK].receivedtime != -3.0 )
|
||||
{
|
||||
cl.frames[j & CL_UPDATE_MASK].choked = true;
|
||||
cl.frames[j & CL_UPDATE_MASK].receivedtime = -2.0;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = true;
|
||||
//cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].receivedtime = -2.0;
|
||||
break;
|
||||
case svc_resourcelist:
|
||||
CL_LegacyParseResourceList( msg );
|
||||
break;
|
||||
case svc_deltamovevars:
|
||||
CL_ParseMovevars( msg );
|
||||
break;
|
||||
case svc_resourcerequest:
|
||||
CL_ParseResourceRequest( msg );
|
||||
break;
|
||||
case svc_customization:
|
||||
CL_ParseCustomization( msg );
|
||||
break;
|
||||
case svc_crosshairangle:
|
||||
CL_ParseCrosshairAngle( msg );
|
||||
break;
|
||||
case svc_soundfade:
|
||||
CL_ParseSoundFade( msg );
|
||||
break;
|
||||
case svc_filetxferfailed:
|
||||
CL_ParseFileTransferFailed( msg );
|
||||
break;
|
||||
case svc_hltv:
|
||||
CL_ParseHLTV( msg );
|
||||
break;
|
||||
case svc_resourcelocation:
|
||||
CL_ParseResLocation( msg );
|
||||
break;
|
||||
case svc_querycvarvalue:
|
||||
CL_ParseCvarValue( msg, false, PROTO_LEGACY );
|
||||
break;
|
||||
case svc_querycvarvalue2:
|
||||
CL_ParseCvarValue( msg, true, PROTO_LEGACY );
|
||||
break;
|
||||
default:
|
||||
CL_ParseUserMessage( msg, cmd, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CL_LegacyPrecache_f( void )
|
||||
{
|
||||
int spawncount, i;
|
||||
model_t *mod;
|
||||
|
||||
if( cls.legacymode != PROTO_LEGACY )
|
||||
return;
|
||||
|
||||
spawncount = Q_atoi( Cmd_Argv( 1 ));
|
||||
|
||||
Con_Printf( "Setting up renderer...\n" );
|
||||
|
||||
// load tempent sprites (glowshell, muzzleflashes etc)
|
||||
CL_LoadClientSprites ();
|
||||
|
||||
// invalidate all decal indexes
|
||||
memset( cl.decal_index, 0, sizeof( cl.decal_index ));
|
||||
cl.video_prepped = true;
|
||||
cl.audio_prepped = true;
|
||||
if( clgame.entities )
|
||||
clgame.entities->model = cl.worldmodel;
|
||||
|
||||
// load skybox
|
||||
R_SetupSky( clgame.movevars.skyName );
|
||||
|
||||
// tell rendering system we have a new set of models.
|
||||
ref.dllFuncs.R_NewMap ();
|
||||
|
||||
CL_SetupOverviewParams();
|
||||
|
||||
// release unused SpriteTextures
|
||||
for( i = 1, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
|
||||
{
|
||||
if( mod->needload == NL_UNREFERENCED && COM_CheckString( mod->name ))
|
||||
Mod_FreeModel( mod );
|
||||
}
|
||||
|
||||
// Mod_FreeUnused ();
|
||||
|
||||
if( host_developer.value <= DEV_NONE )
|
||||
Con_ClearNotify(); // clear any lines of console text
|
||||
|
||||
// done with all resources, issue prespawn command.
|
||||
// Include server count in case server disconnects and changes level during d/l
|
||||
MSG_BeginClientCmd( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteStringf( &cls.netchan.message, "begin %i", spawncount );
|
||||
cls.signon = SIGNONS - 1;
|
||||
}
|
||||
@@ -1,762 +0,0 @@
|
||||
/*
|
||||
cl_parse.c - parse a message received from the server (GoldSrc 48 protocol)
|
||||
Copyright (C) 2008 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or 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 your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "net_encode.h"
|
||||
#include "particledef.h"
|
||||
#include "cl_tent.h"
|
||||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
#include "input.h"
|
||||
#include "server.h"
|
||||
|
||||
static void CL_ParseExtraInfo( sizebuf_t *msg )
|
||||
{
|
||||
string clientfallback;
|
||||
|
||||
Q_strncpy( clientfallback, MSG_ReadString( msg ), sizeof( clientfallback ));
|
||||
if( COM_CheckStringEmpty( clientfallback ))
|
||||
Con_Reportf( S_ERROR "%s: TODO: add fallback directory %s!\n", __func__, clientfallback );
|
||||
|
||||
if( MSG_ReadByte( msg ))
|
||||
{
|
||||
Cvar_FullSet( "sv_cheats", "1", FCVAR_READ_ONLY | FCVAR_SERVER );
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_SetCheatState();
|
||||
Cvar_FullSet( "sv_cheats", "0", FCVAR_READ_ONLY | FCVAR_SERVER );
|
||||
}
|
||||
}
|
||||
|
||||
static void CL_ParseNewMovevars( sizebuf_t *msg )
|
||||
{
|
||||
Delta_InitClient(); // finalize client delta's
|
||||
|
||||
clgame.movevars.gravity = MSG_ReadFloat( msg );
|
||||
clgame.movevars.stopspeed = MSG_ReadFloat( msg );
|
||||
clgame.movevars.maxspeed = MSG_ReadFloat( msg );
|
||||
clgame.movevars.spectatormaxspeed = MSG_ReadFloat( msg );
|
||||
clgame.movevars.accelerate = MSG_ReadFloat( msg );
|
||||
clgame.movevars.airaccelerate = MSG_ReadFloat( msg );
|
||||
clgame.movevars.wateraccelerate = MSG_ReadFloat( msg );
|
||||
clgame.movevars.friction = MSG_ReadFloat( msg );
|
||||
clgame.movevars.edgefriction = MSG_ReadFloat( msg );
|
||||
clgame.movevars.waterfriction = MSG_ReadFloat( msg );
|
||||
clgame.movevars.entgravity = MSG_ReadFloat( msg );
|
||||
clgame.movevars.bounce = MSG_ReadFloat( msg );
|
||||
clgame.movevars.stepsize = MSG_ReadFloat( msg );
|
||||
clgame.movevars.maxvelocity = MSG_ReadFloat( msg );
|
||||
clgame.movevars.zmax = MSG_ReadFloat( msg );
|
||||
clgame.movevars.waveHeight = MSG_ReadFloat( msg );
|
||||
clgame.movevars.footsteps = MSG_ReadByte( msg );
|
||||
clgame.movevars.rollangle = MSG_ReadFloat( msg );
|
||||
clgame.movevars.rollspeed = MSG_ReadFloat( msg );
|
||||
clgame.movevars.skycolor_r = MSG_ReadFloat( msg );
|
||||
clgame.movevars.skycolor_g = MSG_ReadFloat( msg );
|
||||
clgame.movevars.skycolor_b = MSG_ReadFloat( msg );
|
||||
clgame.movevars.skyvec_x = MSG_ReadFloat( msg );
|
||||
clgame.movevars.skyvec_y = MSG_ReadFloat( msg );
|
||||
clgame.movevars.skyvec_z = MSG_ReadFloat( msg );
|
||||
|
||||
Q_strncpy( clgame.movevars.skyName, MSG_ReadString( msg ), sizeof( clgame.movevars.skyName ));
|
||||
|
||||
// water alpha is not allowed
|
||||
if( !FBitSet( world.flags, FWORLD_WATERALPHA ))
|
||||
clgame.movevars.wateralpha = 1.0f;
|
||||
|
||||
// update sky if changed
|
||||
if( Q_strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped )
|
||||
R_SetupSky( clgame.movevars.skyName );
|
||||
|
||||
clgame.oldmovevars = clgame.movevars;
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
|
||||
// keep features an actual!
|
||||
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
||||
}
|
||||
|
||||
typedef struct delta_header_t
|
||||
{
|
||||
qboolean remove : 1;
|
||||
qboolean custom : 1;
|
||||
qboolean instanced : 1;
|
||||
uint instanced_baseline_index : 6;
|
||||
uint offset : 6;
|
||||
} delta_header_t;
|
||||
|
||||
static int CL_ParseDeltaHeader( sizebuf_t *msg, qboolean delta, int oldnum, struct delta_header_t *hdr )
|
||||
{
|
||||
int entnum = oldnum;
|
||||
memset( hdr, 0, sizeof( *hdr ));
|
||||
|
||||
if( !delta )
|
||||
{
|
||||
// if we have one bit set, then it's a next entity in line
|
||||
// if we have next bit NON set, then it's a one of next 64 entities
|
||||
// if not, it's a new entity
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
entnum++;
|
||||
else if( MSG_ReadOneBit( msg ) == 0 )
|
||||
entnum += MSG_ReadUBitLong( msg, 6 );
|
||||
else
|
||||
entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
|
||||
}
|
||||
else
|
||||
{
|
||||
// does this packet encode entity deletion?
|
||||
hdr->remove = MSG_ReadOneBit( msg );
|
||||
|
||||
// same logic as above
|
||||
if( MSG_ReadOneBit( msg ) == 0 )
|
||||
entnum += MSG_ReadUBitLong( msg, 6 );
|
||||
else entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
|
||||
}
|
||||
|
||||
// if we are not removing this entity
|
||||
if( !hdr->remove )
|
||||
{
|
||||
hdr->custom = MSG_ReadOneBit( msg );
|
||||
|
||||
// do we got instanced baselines in svc_spawnbaselines?
|
||||
if( cl.instanced_baseline_count )
|
||||
{
|
||||
hdr->instanced = MSG_ReadOneBit( msg );
|
||||
if( hdr->instanced )
|
||||
hdr->instanced_baseline_index = MSG_ReadUBitLong( msg, 6 );
|
||||
}
|
||||
|
||||
if( !delta && !hdr->instanced )
|
||||
{
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
hdr->offset = MSG_ReadUBitLong( msg, 6 );
|
||||
}
|
||||
}
|
||||
|
||||
return entnum;
|
||||
}
|
||||
|
||||
static int CL_GetEntityDelta( const struct delta_header_t *hdr, int entnum )
|
||||
{
|
||||
if( hdr->custom )
|
||||
return DT_CUSTOM_ENTITY_STATE_T;
|
||||
|
||||
if( CL_IsPlayerIndex( entnum ))
|
||||
return DT_ENTITY_STATE_PLAYER_T;
|
||||
|
||||
return DT_ENTITY_STATE_T;
|
||||
}
|
||||
|
||||
static void CL_FlushEntityPacketGS( frame_t *frame, sizebuf_t *msg )
|
||||
{
|
||||
frame->valid = false;
|
||||
cl.validsequence = 0; // can't render a frame
|
||||
|
||||
// read it all but ignore it
|
||||
while( 1 )
|
||||
{
|
||||
int num = 0;
|
||||
entity_state_t from = { 0 }, to;
|
||||
delta_header_t hdr;
|
||||
|
||||
if( MSG_ReadWord( msg ) != 0 )
|
||||
{
|
||||
MSG_SeekToBit( msg, -16, SEEK_CUR );
|
||||
num = CL_ParseDeltaHeader( msg, false, num, &hdr );
|
||||
}
|
||||
else break;
|
||||
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "%s: overflow\n", __func__ );
|
||||
|
||||
if( hdr.remove )
|
||||
continue;
|
||||
|
||||
Delta_ReadGSFields( msg, CL_GetEntityDelta( &hdr, num ), &from, &to, cl.mtime[0] );
|
||||
}
|
||||
}
|
||||
|
||||
static void CL_DeltaEntityGS( const delta_header_t *hdr, sizebuf_t *msg, frame_t *frame, int newnum, const entity_state_t *from )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
entity_state_t *to;
|
||||
qboolean newent = from == NULL;
|
||||
int pack = frame->num_entities;
|
||||
qboolean has_update = msg != NULL;
|
||||
|
||||
// alloc next slot to store update
|
||||
to = &cls.packet_entities[cls.next_client_entities % cls.num_client_entities];
|
||||
|
||||
if(( newnum < 0 ) || ( newnum >= clgame.maxEntities ))
|
||||
{
|
||||
Con_DPrintf( S_ERROR "CL_DeltaEntity: invalid newnum: %d\n", newnum );
|
||||
Host_Error( "%s: bad delta entity number: %i", __func__, newnum );
|
||||
return;
|
||||
}
|
||||
|
||||
ent = CL_EDICT_NUM( newnum );
|
||||
if( hdr->remove )
|
||||
{
|
||||
if( !newent )
|
||||
CL_KillDeadBeams( ent );
|
||||
else
|
||||
Con_Printf( S_WARN "%s: entity remove on non-delta update (%d)\n", __func__, newnum );
|
||||
return;
|
||||
}
|
||||
|
||||
ent->index = newnum; // enumerate entity index
|
||||
if( newent )
|
||||
{
|
||||
if( hdr->instanced )
|
||||
from = &cl.instanced_baseline[hdr->instanced_baseline_index];
|
||||
else if( hdr->offset != 0 )
|
||||
from = &cls.packet_entities[(cls.next_client_entities - hdr->offset) % cls.num_client_entities];
|
||||
else
|
||||
from = &ent->baseline;
|
||||
}
|
||||
|
||||
if( has_update )
|
||||
Delta_ReadGSFields( msg, CL_GetEntityDelta( hdr, newnum ), from, to, cl.mtime[0] );
|
||||
else memcpy( to, from, sizeof( entity_state_t ));
|
||||
|
||||
to->entityType = hdr->custom ? ENTITY_BEAM : ENTITY_NORMAL;
|
||||
to->number = newnum;
|
||||
|
||||
if( newent )
|
||||
{
|
||||
// interpolation must be reset
|
||||
SETVISBIT( frame->flags, pack );
|
||||
|
||||
// release beams from previous entity
|
||||
CL_KillDeadBeams( ent );
|
||||
}
|
||||
|
||||
// add entity to packet
|
||||
cls.next_client_entities++;
|
||||
frame->num_entities++;
|
||||
}
|
||||
|
||||
static void CL_CopyPacketEntity( frame_t *frame, int num, const entity_state_t *from )
|
||||
{
|
||||
delta_header_t fakehdr =
|
||||
{
|
||||
.custom = FBitSet( from->entityType, ENTITY_BEAM ) == ENTITY_BEAM,
|
||||
};
|
||||
CL_DeltaEntityGS( &fakehdr, NULL, frame, num, from );
|
||||
}
|
||||
|
||||
static int CL_ParsePacketEntitiesGS( sizebuf_t *msg, qboolean delta )
|
||||
{
|
||||
frame_t *frame, *oldframe;
|
||||
int oldindex, newnum, oldnum, numbase = 0;
|
||||
entity_state_t *oldent;
|
||||
int count;
|
||||
int playerbytes = 0;
|
||||
|
||||
// save first uncompressed packet as timestamp
|
||||
if( cls.changelevel && !delta && cls.demorecording )
|
||||
CL_WriteDemoJumpTime();
|
||||
|
||||
count = MSG_ReadWord( msg );
|
||||
|
||||
frame = &cl.frames[cl.parsecountmod];
|
||||
memset( frame->flags, 0, sizeof( frame->flags ));
|
||||
frame->first_entity = cls.next_client_entities;
|
||||
frame->num_entities = 0;
|
||||
frame->valid = true;
|
||||
|
||||
if( delta )
|
||||
{
|
||||
uint oldpacket = MSG_ReadByte( msg );
|
||||
oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];
|
||||
|
||||
if( !CL_ValidateDeltaPacket( oldpacket, oldframe ))
|
||||
{
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_FlushEntityPacketGS( frame, msg );
|
||||
MSG_EndBitWriting( msg );
|
||||
return playerbytes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oldframe = NULL;
|
||||
cl.send_reply = true;
|
||||
cls.demowaiting = false;
|
||||
}
|
||||
|
||||
cl.validsequence = cls.netchan.incoming_sequence;
|
||||
|
||||
MSG_StartBitWriting( msg );
|
||||
|
||||
oldent = NULL;
|
||||
oldindex = 0;
|
||||
oldnum = CL_UpdateOldEntNum( oldindex, oldframe, &oldent );
|
||||
|
||||
// read it all but ignore it
|
||||
while( 1 )
|
||||
{
|
||||
int bufstart;
|
||||
qboolean player;
|
||||
delta_header_t hdr;
|
||||
int val = MSG_ReadWord( msg );
|
||||
|
||||
if( val )
|
||||
{
|
||||
MSG_SeekToBit( msg, -16, SEEK_CUR );
|
||||
numbase = newnum = CL_ParseDeltaHeader( msg, delta, numbase, &hdr );
|
||||
}
|
||||
else break;
|
||||
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "%s: overflow\n", __func__ );
|
||||
|
||||
player = CL_IsPlayerIndex( newnum );
|
||||
|
||||
while( oldnum < newnum )
|
||||
{
|
||||
if( !delta )
|
||||
Con_Printf( S_WARN "%s: old frame copy on non-delta update (%d < %d)\n", __func__, oldnum, newnum );
|
||||
|
||||
// one or more entities from the old packet are unchanged
|
||||
CL_CopyPacketEntity( frame, oldnum, oldent );
|
||||
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||
}
|
||||
|
||||
bufstart = MSG_GetNumBytesRead( msg );
|
||||
|
||||
if( oldnum == newnum )
|
||||
{
|
||||
if( !delta )
|
||||
Con_Printf( S_WARN "%s: delta entity on non-delta update (%d)\n", __func__, oldnum );
|
||||
|
||||
// from delta
|
||||
CL_DeltaEntityGS( &hdr, msg, frame, newnum, oldent );
|
||||
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||
}
|
||||
else if( oldnum > newnum )
|
||||
{
|
||||
// from baseline
|
||||
CL_DeltaEntityGS( &hdr, msg, frame, newnum, NULL );
|
||||
}
|
||||
|
||||
if( player ) playerbytes += MSG_GetNumBytesRead( msg ) - bufstart;
|
||||
}
|
||||
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "%s: overflow\n", __func__ );
|
||||
|
||||
// any remaining entities in the old frame are copied over
|
||||
while( oldnum != MAX_ENTNUMBER )
|
||||
{
|
||||
// one or more entities from the old packet are unchanged
|
||||
CL_CopyPacketEntity( frame, oldnum, oldent );
|
||||
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||
}
|
||||
|
||||
MSG_EndBitWriting( msg );
|
||||
|
||||
if( frame->num_entities != count )
|
||||
Con_Reportf( S_WARN "CL_Parse%sPacketEntitiesGS: (%i should be %i)\n", delta ? "Delta" : "", frame->num_entities, count );
|
||||
|
||||
if( !frame->valid )
|
||||
return playerbytes;
|
||||
|
||||
CL_ProcessPacket( frame );
|
||||
CL_SetSolidEntities();
|
||||
|
||||
// first update, received world, remove loading plaque
|
||||
if( cls.signon == ( SIGNONS - 1 ))
|
||||
{
|
||||
cls.signon = SIGNONS;
|
||||
CL_SignonReply( PROTO_GOLDSRC );
|
||||
}
|
||||
|
||||
return playerbytes;
|
||||
}
|
||||
|
||||
static float MSG_ReadGSBitCoord( sizebuf_t *sb )
|
||||
{
|
||||
float value = 0;
|
||||
int ival, fval;
|
||||
|
||||
ival = MSG_ReadOneBit( sb );
|
||||
fval = MSG_ReadOneBit( sb );
|
||||
|
||||
if( ival || fval )
|
||||
{
|
||||
int sign = MSG_ReadOneBit( sb );
|
||||
|
||||
if( ival )
|
||||
ival = MSG_ReadUBitLong( sb, 12 );
|
||||
if( fval )
|
||||
fval = MSG_ReadUBitLong( sb, 3 );
|
||||
|
||||
value = (float)( fval / 8.0 + ival );
|
||||
if( sign )
|
||||
value = -value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static void MSG_ReadGSBitVec3Coord( sizebuf_t *sb, vec3_t fa )
|
||||
{
|
||||
qboolean x, y, z;
|
||||
|
||||
VectorClear( fa );
|
||||
|
||||
x = MSG_ReadOneBit( sb );
|
||||
y = MSG_ReadOneBit( sb );
|
||||
z = MSG_ReadOneBit( sb );
|
||||
if( x )
|
||||
fa[0] = MSG_ReadGSBitCoord( sb );
|
||||
if( y )
|
||||
fa[1] = MSG_ReadGSBitCoord( sb );
|
||||
if( z )
|
||||
fa[2] = MSG_ReadGSBitCoord( sb );
|
||||
}
|
||||
|
||||
static void CL_ParseSoundPacketGS( sizebuf_t *msg )
|
||||
{
|
||||
vec3_t pos;
|
||||
int chan, sound;
|
||||
float volume, attn;
|
||||
int flags, pitch, entnum;
|
||||
sound_t handle = 0;
|
||||
|
||||
MSG_StartBitWriting( msg );
|
||||
|
||||
flags = MSG_ReadUBitLong( msg, 9 );
|
||||
|
||||
if( FBitSet( flags, SND_VOLUME ))
|
||||
volume = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||
else volume = VOL_NORM;
|
||||
|
||||
if( FBitSet( flags, SND_ATTENUATION ))
|
||||
attn = (float)MSG_ReadByte( msg ) / 64.0f;
|
||||
else attn = ATTN_NONE;
|
||||
|
||||
chan = MSG_ReadUBitLong( msg, 3 );
|
||||
entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
|
||||
if( FBitSet( flags, SND_LEGACY_LARGE_INDEX ))
|
||||
sound = MSG_ReadWord( msg );
|
||||
else sound = MSG_ReadByte( msg );
|
||||
MSG_ReadGSBitVec3Coord( msg, pos );
|
||||
|
||||
if( FBitSet( flags, SND_PITCH ))
|
||||
pitch = MSG_ReadByte( msg );
|
||||
else pitch = PITCH_NORM;
|
||||
|
||||
MSG_EndBitWriting( msg );
|
||||
|
||||
ClearBits( flags, SND_LEGACY_LARGE_INDEX );
|
||||
|
||||
if( FBitSet( flags, SND_SENTENCE ))
|
||||
{
|
||||
char sentenceName[32];
|
||||
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
|
||||
handle = S_RegisterSound( sentenceName );
|
||||
}
|
||||
else handle = cl.sound_index[sound]; // see precached sound
|
||||
|
||||
if( !cl.audio_prepped )
|
||||
return; // too early
|
||||
|
||||
// g-cont. sound and ambient sound have only difference with channel
|
||||
if( chan == CHAN_STATIC )
|
||||
{
|
||||
S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags );
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound( pos, entnum, chan, handle, volume, attn, pitch, flags );
|
||||
}
|
||||
}
|
||||
|
||||
static void CL_ParseSpawnStaticSound( sizebuf_t *msg )
|
||||
{
|
||||
vec3_t pos;
|
||||
int handle, entnum, pitch, flags;
|
||||
float volume, attn;
|
||||
|
||||
MSG_ReadVec3Coord( msg, pos );
|
||||
handle = MSG_ReadShort( msg );
|
||||
volume = MSG_ReadByte( msg ) * ( 1.0f / 255.0f );
|
||||
attn = MSG_ReadByte( msg ) * ( 1.0f / 64.0f );
|
||||
entnum = MSG_ReadShort( msg );
|
||||
pitch = MSG_ReadByte( msg );
|
||||
flags = MSG_ReadByte( msg );
|
||||
|
||||
S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================================================================
|
||||
|
||||
ACTION MESSAGES
|
||||
|
||||
=====================================================================
|
||||
*/
|
||||
/*
|
||||
=====================
|
||||
CL_ParseGoldSrcServerMessage
|
||||
|
||||
dispatch messages
|
||||
=====================
|
||||
*/
|
||||
void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
|
||||
{
|
||||
size_t bufStart, playerbytes;
|
||||
int cmd, param1;
|
||||
const char *s;
|
||||
|
||||
// parse the message
|
||||
while( 1 )
|
||||
{
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
{
|
||||
Host_Error( "CL_ParseServerMessage: overflow!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// mark start position
|
||||
bufStart = MSG_GetNumBytesRead( msg );
|
||||
|
||||
// end of message (align bits)
|
||||
if( MSG_GetNumBitsLeft( msg ) < 8 )
|
||||
break;
|
||||
|
||||
cmd = MSG_ReadServerCmd( msg );
|
||||
|
||||
// record command for debugging spew on parse problem
|
||||
CL_Parse_RecordCommand( cmd, bufStart );
|
||||
|
||||
if( CL_ParseCommonDLLMessage( msg, PROTO_GOLDSRC, cmd, bufStart ))
|
||||
continue;
|
||||
|
||||
// other commands
|
||||
switch( cmd )
|
||||
{
|
||||
case svc_bad:
|
||||
Host_Error( "svc_bad\n" );
|
||||
break;
|
||||
case svc_nop:
|
||||
case svc_spawnstatic:
|
||||
case svc_goldsrc_damage:
|
||||
case svc_goldsrc_killedmonster:
|
||||
case svc_goldsrc_foundsecret:
|
||||
// this does nothing
|
||||
break;
|
||||
case svc_disconnect:
|
||||
s = MSG_ReadString( msg );
|
||||
if( COM_CheckStringEmpty( s ))
|
||||
Con_Printf( "Server issued disconnect. Reason: %s\n", s );
|
||||
CL_Drop ();
|
||||
Host_AbortCurrentFrame ();
|
||||
break;
|
||||
case svc_event:
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_ParseEvent( msg, PROTO_GOLDSRC );
|
||||
MSG_EndBitWriting( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_goldsrc_version:
|
||||
param1 = MSG_ReadLong( msg );
|
||||
if( param1 != PROTOCOL_GOLDSRC_VERSION )
|
||||
Host_Error( "Server use invalid protocol (%i should be %i)\n", param1, PROTOCOL_GOLDSRC_VERSION );
|
||||
break;
|
||||
case svc_setview:
|
||||
CL_ParseViewEntity( msg );
|
||||
break;
|
||||
case svc_sound:
|
||||
CL_ParseSoundPacketGS( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_time:
|
||||
CL_ParseServerTime( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_print:
|
||||
Con_Printf( "%s", MSG_ReadString( msg ));
|
||||
break;
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString( msg );
|
||||
if( cl_trace_stufftext.value )
|
||||
{
|
||||
size_t len = Q_strlen( s );
|
||||
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||
}
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
// disable Cry Of Fear antisave protection
|
||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||
break; // too early
|
||||
#endif
|
||||
Cbuf_AddFilteredText( s );
|
||||
break;
|
||||
case svc_setangle:
|
||||
CL_ParseSetAngle( msg );
|
||||
break;
|
||||
case svc_goldsrc_serverinfo:
|
||||
Cbuf_Execute(); // make sure any stuffed commands are done
|
||||
CL_ParseServerData( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_lightstyle:
|
||||
CL_ParseLightStyle( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_updateuserinfo:
|
||||
CL_UpdateUserinfo( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_goldsrc_deltadescription:
|
||||
Delta_ParseTableField_GS( msg );
|
||||
break;
|
||||
case svc_clientdata:
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_ParseClientData( msg, PROTO_GOLDSRC );
|
||||
MSG_EndBitWriting( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_goldsrc_stopsound:
|
||||
param1 = MSG_ReadWord( msg );
|
||||
S_StopSound( param1 >> 3, param1 & 7, NULL );
|
||||
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_pings:
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_UpdateUserPings( msg );
|
||||
MSG_EndBitWriting( msg );
|
||||
break;
|
||||
case svc_particle:
|
||||
CL_ParseParticles( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_event_reliable:
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_ParseReliableEvent( msg, PROTO_GOLDSRC );
|
||||
MSG_EndBitWriting( msg );
|
||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_spawnbaseline:
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_ParseBaseline( msg, PROTO_GOLDSRC );
|
||||
MSG_EndBitWriting( msg );
|
||||
break;
|
||||
case svc_setpause:
|
||||
cl.paused = ( MSG_ReadByte( msg ) != 0 );
|
||||
break;
|
||||
case svc_signonnum:
|
||||
CL_ParseSignon( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_centerprint:
|
||||
CL_CenterPrint( MSG_ReadString( msg ), 0.25f );
|
||||
break;
|
||||
case svc_goldsrc_spawnstaticsound:
|
||||
CL_ParseSpawnStaticSound( msg );
|
||||
break;
|
||||
case svc_finale:
|
||||
CL_ParseFinaleCutscene( msg, 2 );
|
||||
break;
|
||||
case svc_restore:
|
||||
CL_ParseRestore( msg );
|
||||
break;
|
||||
case svc_cutscene:
|
||||
CL_ParseFinaleCutscene( msg, 3 );
|
||||
break;
|
||||
case svc_goldsrc_decalname:
|
||||
param1 = MSG_ReadByte( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
Q_strncpy( host.draw_decals[param1], s, sizeof( host.draw_decals[param1] ));
|
||||
break;
|
||||
case svc_addangle:
|
||||
CL_ParseAddAngle( msg );
|
||||
break;
|
||||
case svc_goldsrc_newusermsg:
|
||||
CL_RegisterUserMessage( msg, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_packetentities:
|
||||
playerbytes = CL_ParsePacketEntitiesGS( msg, false );
|
||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||
break;
|
||||
case svc_deltapacketentities:
|
||||
playerbytes = CL_ParsePacketEntitiesGS( msg, true );
|
||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||
break;
|
||||
case svc_choke:
|
||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = true;
|
||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].receivedtime = -2.0;
|
||||
break;
|
||||
case svc_resourcelist:
|
||||
MSG_StartBitWriting( msg );
|
||||
CL_ParseResourceList( msg, PROTO_GOLDSRC );
|
||||
MSG_EndBitWriting( msg );
|
||||
break;
|
||||
case svc_goldsrc_newmovevars:
|
||||
CL_ParseNewMovevars( msg );
|
||||
break;
|
||||
case svc_resourcerequest:
|
||||
CL_ParseResourceRequest( msg );
|
||||
break;
|
||||
case svc_customization:
|
||||
CL_ParseCustomization( msg );
|
||||
break;
|
||||
case svc_crosshairangle:
|
||||
CL_ParseCrosshairAngle( msg );
|
||||
break;
|
||||
case svc_soundfade:
|
||||
CL_ParseSoundFade( msg );
|
||||
break;
|
||||
case svc_filetxferfailed:
|
||||
CL_ParseFileTransferFailed( msg );
|
||||
break;
|
||||
case svc_hltv:
|
||||
CL_ParseHLTV( msg );
|
||||
break;
|
||||
case svc_voiceinit:
|
||||
CL_ParseVoiceInit( msg );
|
||||
break;
|
||||
case svc_voicedata:
|
||||
CL_ParseVoiceData( msg, PROTO_GOLDSRC );
|
||||
cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
case svc_resourcelocation:
|
||||
CL_ParseResLocation( msg );
|
||||
break;
|
||||
case svc_goldsrc_sendextrainfo:
|
||||
CL_ParseExtraInfo( msg );
|
||||
break;
|
||||
case svc_goldsrc_timescale:
|
||||
// we can set sys_timescale to anything we want but in GoldSrc it's locked for
|
||||
// HLTV and demoplayback. Do we really want to have it then if both are out of scope?
|
||||
Con_Reportf( S_ERROR "%s: svc_goldsrc_timescale: implement me!\n", __func__ );
|
||||
MSG_ReadFloat( msg );
|
||||
break;
|
||||
case svc_goldsrc_sendcvarvalue:
|
||||
CL_ParseCvarValue( msg, false, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_goldsrc_sendcvarvalue2:
|
||||
CL_ParseCvarValue( msg, true, PROTO_GOLDSRC );
|
||||
break;
|
||||
case svc_exec:
|
||||
CL_ParseExec( msg );
|
||||
break;
|
||||
default:
|
||||
CL_ParseUserMessage( msg, cmd, PROTO_LEGACY );
|
||||
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,20 @@ GNU General Public License for more details.
|
||||
#define MIN_PREDICTION_EPSILON 0.5f // complain if error is > this and we have cl_showerror set
|
||||
#define MAX_PREDICTION_ERROR 64.0f // above this is assumed to be a teleport, don't smooth, etc.
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_ClearPhysEnts
|
||||
|
||||
=============
|
||||
*/
|
||||
void CL_ClearPhysEnts( void )
|
||||
{
|
||||
clgame.pmove->numtouch = 0;
|
||||
clgame.pmove->numvisent = 0;
|
||||
clgame.pmove->nummoveent = 0;
|
||||
clgame.pmove->numphysent = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PushPMStates
|
||||
@@ -54,14 +68,39 @@ void GAME_EXPORT CL_PopPMStates( void )
|
||||
clgame.pushed = false;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PushTraceBounds
|
||||
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
||||
{
|
||||
hullnum = bound( 0, hullnum, 3 );
|
||||
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
||||
VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PopTraceBounds
|
||||
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT CL_PopTraceBounds( void )
|
||||
{
|
||||
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
||||
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_IsPredicted
|
||||
===============
|
||||
*/
|
||||
static qboolean CL_IsPredicted( void )
|
||||
qboolean CL_IsPredicted( void )
|
||||
{
|
||||
if( cl_nopred.value || cl.intermission )
|
||||
if( cl_nopred->value || cl.intermission )
|
||||
return false;
|
||||
|
||||
// never predict the quake demos
|
||||
@@ -158,7 +197,7 @@ void CL_SetIdealPitch( void )
|
||||
}
|
||||
|
||||
if( steps < 2 ) return;
|
||||
cl.local.idealpitch = -dir * cl_idealpitchscale.value;
|
||||
cl.local.idealpitch = -dir * cl_idealpitchscale->value;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -169,7 +208,7 @@ check for instant movement in case
|
||||
we don't want interpolate this
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_PlayerTeleported( local_state_t *from, local_state_t *to )
|
||||
qboolean CL_PlayerTeleported( local_state_t *from, local_state_t *to )
|
||||
{
|
||||
int len, maxlen;
|
||||
vec3_t delta;
|
||||
@@ -209,7 +248,7 @@ void CL_CheckPredictionError( void )
|
||||
// save the prediction error for interpolation
|
||||
if( dist > MAX_PREDICTION_ERROR )
|
||||
{
|
||||
if( cl_showerror.value && host_developer.value )
|
||||
if( cl_showerror->value && host_developer.value )
|
||||
Con_NPrintf( 10 + ( ++pos & 3 ), "^3player teleported:^7 %.3f units\n", dist );
|
||||
|
||||
// a teleport or something or gamepaused
|
||||
@@ -217,7 +256,7 @@ void CL_CheckPredictionError( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cl_showerror.value && dist > MIN_PREDICTION_EPSILON && host_developer.value )
|
||||
if( cl_showerror->value && dist > MIN_PREDICTION_EPSILON && host_developer.value )
|
||||
Con_NPrintf( 10 + ( ++pos & 3 ), "^1prediction error:^7 %.3f units\n", dist );
|
||||
|
||||
VectorCopy( cl.frames[cmd].playerstate[cl.playernum].origin, cl.local.predicted_origins[frame] );
|
||||
@@ -228,7 +267,7 @@ void CL_CheckPredictionError( void )
|
||||
// GoldSrc checks for singleplayer
|
||||
// we would check for local server
|
||||
if( dist > MIN_CORRECTION_DISTANCE && !SV_Active() )
|
||||
cls.correction_time = cl_smoothtime.value;
|
||||
cls.correction_time = cl_smoothtime->value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +431,7 @@ CL_AddLinksToPmove
|
||||
collect solid entities
|
||||
====================
|
||||
*/
|
||||
static void CL_AddLinksToPmove( frame_t *frame )
|
||||
void CL_AddLinksToPmove( frame_t *frame )
|
||||
{
|
||||
entity_state_t *state;
|
||||
model_t *model;
|
||||
@@ -508,7 +547,7 @@ void GAME_EXPORT CL_SetSolidPlayers( int playernum )
|
||||
physent_t *pe;
|
||||
int i;
|
||||
|
||||
if( !cl_solid_players.value )
|
||||
if( !cl_solid_players->value )
|
||||
return;
|
||||
|
||||
for( i = 0; i < MAX_CLIENTS; i++ )
|
||||
@@ -544,8 +583,8 @@ void GAME_EXPORT CL_SetSolidPlayers( int playernum )
|
||||
// some fields needs to be override from cls.predicted_players
|
||||
VectorCopy( player->origin, pe->origin );
|
||||
VectorCopy( player->angles, pe->angles );
|
||||
VectorCopy( host.player_mins[player->usehull], pe->mins );
|
||||
VectorCopy( host.player_maxs[player->usehull], pe->maxs );
|
||||
VectorCopy( clgame.pmove->player_mins[player->usehull], pe->mins );
|
||||
VectorCopy( clgame.pmove->player_maxs[player->usehull], pe->maxs );
|
||||
pe->movetype = player->movetype;
|
||||
pe->solid = player->solid;
|
||||
}
|
||||
@@ -662,6 +701,11 @@ cl_entity_t *CL_GetWaterEntity( const float *rgflPos )
|
||||
return CL_GetEntityByIndex( entnum );
|
||||
}
|
||||
|
||||
int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
||||
{
|
||||
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||
{
|
||||
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
||||
@@ -669,7 +713,33 @@ static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||
|
||||
static void GAME_EXPORT pfnStuckTouch( int hitent, pmtrace_t *tr )
|
||||
{
|
||||
PM_StuckTouch( clgame.pmove, hitent, tr );
|
||||
int i;
|
||||
|
||||
for( i = 0; i < clgame.pmove->numtouch; i++ )
|
||||
{
|
||||
if( clgame.pmove->touchindex[i].ent == hitent )
|
||||
return;
|
||||
}
|
||||
|
||||
if( clgame.pmove->numtouch >= MAX_PHYSENTS )
|
||||
return;
|
||||
|
||||
VectorCopy( clgame.pmove->velocity, tr->deltavelocity );
|
||||
tr->ent = hitent;
|
||||
|
||||
clgame.pmove->touchindex[clgame.pmove->numtouch++] = *tr;
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnPointContents( float *p, int *truecontents )
|
||||
{
|
||||
int cont, truecont;
|
||||
|
||||
truecont = cont = PM_PointContents( clgame.pmove, p );
|
||||
if( truecontents ) *truecontents = truecont;
|
||||
|
||||
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
|
||||
cont = CONTENTS_WATER;
|
||||
return cont;
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnTruePointContents( float *p )
|
||||
@@ -677,19 +747,99 @@ static int GAME_EXPORT pfnTruePointContents( float *p )
|
||||
return PM_TruePointContents( clgame.pmove, p );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnHullPointContents( struct hull_s *hull, int num, float *p )
|
||||
{
|
||||
return PM_HullPointContents( hull, num, p );
|
||||
}
|
||||
|
||||
static pmtrace_t GAME_EXPORT pfnPlayerTrace( float *start, float *end, int traceFlags, int ignore_pe )
|
||||
{
|
||||
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
||||
}
|
||||
|
||||
static void *pfnHullForBsp( physent_t *pe, float *offset )
|
||||
pmtrace_t *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
|
||||
old_usehull = clgame.pmove->usehull;
|
||||
clgame.pmove->usehull = usehull;
|
||||
|
||||
switch( flags )
|
||||
{
|
||||
case PM_TRACELINE_PHYSENTSONLY:
|
||||
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numvisent, clgame.pmove->visents, ignore_pe, NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
clgame.pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
}
|
||||
|
||||
static hull_t *pfnHullForBsp( physent_t *pe, float *offset )
|
||||
{
|
||||
return PM_HullForBsp( pe, clgame.pmove, offset );
|
||||
}
|
||||
|
||||
static float GAME_EXPORT pfnTraceModel( physent_t *pe, float *start, float *end, trace_t *trace )
|
||||
{
|
||||
return PM_TraceModel( clgame.pmove, pe, start, end, trace );
|
||||
int old_usehull;
|
||||
vec3_t start_l, end_l;
|
||||
vec3_t offset, temp;
|
||||
qboolean rotated;
|
||||
matrix4x4 matrix;
|
||||
hull_t *hull;
|
||||
|
||||
old_usehull = clgame.pmove->usehull;
|
||||
clgame.pmove->usehull = 2;
|
||||
|
||||
hull = PM_HullForBsp( pe, clgame.pmove, offset );
|
||||
|
||||
clgame.pmove->usehull = old_usehull;
|
||||
|
||||
if( pe->solid == SOLID_BSP && !VectorIsNull( pe->angles ))
|
||||
rotated = true;
|
||||
else rotated = false;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
|
||||
Matrix4x4_VectorITransform( matrix, start, start_l );
|
||||
Matrix4x4_VectorITransform( matrix, end, end_l );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract( start, offset, start_l );
|
||||
VectorSubtract( end, offset, end_l );
|
||||
}
|
||||
|
||||
PM_RecursiveHullCheck( hull, hull->firstclipnode, 0, 1, start_l, end_l, (pmtrace_t *)trace );
|
||||
trace->ent = NULL;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
VectorCopy( trace->plane.normal, temp );
|
||||
Matrix4x4_TransformPositivePlane( matrix, temp, trace->plane.dist, trace->plane.normal, &trace->plane.dist );
|
||||
}
|
||||
|
||||
VectorLerp( start, trace->fraction, end, trace->endpos );
|
||||
|
||||
return trace->fraction;
|
||||
}
|
||||
|
||||
static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= clgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &clgame.pmove->physents[ground];
|
||||
return PM_TraceTexture( pe, vstart, vend );
|
||||
}
|
||||
|
||||
static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
|
||||
@@ -718,7 +868,25 @@ static int GAME_EXPORT pfnTestPlayerPositionEx( float *pos, pmtrace_t *ptrace, p
|
||||
|
||||
static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehull, pfnIgnore pmFilter )
|
||||
{
|
||||
return PM_TraceLineEx( clgame.pmove, start, end, flags, usehull, pmFilter );
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
|
||||
old_usehull = clgame.pmove->usehull;
|
||||
clgame.pmove->usehull = usehull;
|
||||
|
||||
switch( flags )
|
||||
{
|
||||
case PM_TRACELINE_PHYSENTSONLY:
|
||||
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numphysent, clgame.pmove->physents, -1, pmFilter );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numvisent, clgame.pmove->visents, -1, pmFilter );
|
||||
break;
|
||||
}
|
||||
|
||||
clgame.pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -758,23 +926,23 @@ void CL_InitClientMove( void )
|
||||
clgame.pmove->Con_Printf = Con_Printf;
|
||||
clgame.pmove->Sys_FloatTime = Sys_DoubleTime;
|
||||
clgame.pmove->PM_StuckTouch = pfnStuckTouch;
|
||||
clgame.pmove->PM_PointContents = (void*)PM_CL_PointContents;
|
||||
clgame.pmove->PM_PointContents = pfnPointContents;
|
||||
clgame.pmove->PM_TruePointContents = pfnTruePointContents;
|
||||
clgame.pmove->PM_HullPointContents = (void*)PM_HullPointContents;
|
||||
clgame.pmove->PM_HullPointContents = pfnHullPointContents;
|
||||
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;
|
||||
clgame.pmove->PM_TraceLine = PM_CL_TraceLine;
|
||||
clgame.pmove->PM_TraceLine = PM_TraceLine;
|
||||
clgame.pmove->RandomLong = COM_RandomLong;
|
||||
clgame.pmove->RandomFloat = COM_RandomFloat;
|
||||
clgame.pmove->PM_GetModelType = pfnGetModelType;
|
||||
clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
|
||||
clgame.pmove->PM_HullForBsp = pfnHullForBsp;
|
||||
clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
|
||||
clgame.pmove->PM_TraceModel = pfnTraceModel;
|
||||
clgame.pmove->COM_FileSize = COM_FileSize;
|
||||
clgame.pmove->COM_LoadFile = COM_LoadFile;
|
||||
clgame.pmove->COM_FreeFile = COM_FreeFile;
|
||||
clgame.pmove->memfgets = COM_MemFgets;
|
||||
clgame.pmove->PM_PlaySound = pfnPlaySound;
|
||||
clgame.pmove->PM_TraceTexture = PM_CL_TraceTexture;
|
||||
clgame.pmove->PM_TraceTexture = pfnTraceTexture;
|
||||
clgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
|
||||
clgame.pmove->PM_PlayerTraceEx = pfnPlayerTraceEx;
|
||||
clgame.pmove->PM_TestPlayerPositionEx = pfnTestPlayerPositionEx;
|
||||
@@ -785,25 +953,26 @@ void CL_InitClientMove( void )
|
||||
clgame.dllFuncs.pfnPlayerMoveInit( clgame.pmove );
|
||||
}
|
||||
|
||||
static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const usercmd_t *ucmd, qboolean runfuncs, double time )
|
||||
static void PM_CheckMovingGround( clientdata_t *cd, entity_state_t *state, float frametime )
|
||||
{
|
||||
const entity_state_t *ps;
|
||||
const clientdata_t *cd;
|
||||
if(!( cd->flags & FL_BASEVELOCITY ))
|
||||
{
|
||||
// apply momentum (add in half of the previous frame of velocity first)
|
||||
VectorMA( cd->velocity, 1.0f + (frametime * 0.5f), state->basevelocity, cd->velocity );
|
||||
VectorClear( state->basevelocity );
|
||||
}
|
||||
cd->flags &= ~FL_BASEVELOCITY;
|
||||
}
|
||||
|
||||
void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, qboolean runfuncs, double time )
|
||||
{
|
||||
entity_state_t *ps;
|
||||
clientdata_t *cd;
|
||||
|
||||
ps = &from->playerstate;
|
||||
cd = &from->client;
|
||||
|
||||
pmove->player_index = ps->number - 1;
|
||||
|
||||
// a1ba: workaround bug where the server refuse to send our local player in delta
|
||||
// cl.playernum, in theory, must be equal to our local player index anyway
|
||||
//
|
||||
// this might not be a real solution, since everything else will be bogus
|
||||
// but we need to properly run prediction and avoid potential memory
|
||||
// corruption
|
||||
if( pmove->player_index < 0 )
|
||||
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||
|
||||
pmove->multiplayer = (cl.maxclients > 1);
|
||||
pmove->runfuncs = runfuncs;
|
||||
pmove->time = time * 1000.0f;
|
||||
@@ -815,21 +984,22 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
||||
VectorCopy( ps->basevelocity, pmove->basevelocity );
|
||||
VectorCopy( cd->view_ofs, pmove->view_ofs );
|
||||
VectorClear( pmove->movedir );
|
||||
pmove->flDuckTime = (float)cd->flDuckTime;
|
||||
pmove->flDuckTime = cd->flDuckTime;
|
||||
pmove->bInDuck = cd->bInDuck;
|
||||
pmove->usehull = ps->usehull;
|
||||
pmove->flTimeStepSound = cd->flTimeStepSound;
|
||||
pmove->iStepLeft = ps->iStepLeft;
|
||||
pmove->flFallVelocity = ps->flFallVelocity;
|
||||
pmove->flSwimTime = (float)cd->flSwimTime;
|
||||
pmove->flSwimTime = cd->flSwimTime;
|
||||
VectorCopy( cd->punchangle, pmove->punchangle );
|
||||
pmove->flSwimTime = cd->flSwimTime;
|
||||
pmove->flNextPrimaryAttack = 0.0f; // not used by PM_ code
|
||||
pmove->effects = ps->effects;
|
||||
pmove->flags = cd->flags;
|
||||
pmove->gravity = ps->gravity;
|
||||
pmove->friction = ps->friction;
|
||||
pmove->oldbuttons = ps->oldbuttons;
|
||||
pmove->waterjumptime = (float)cd->waterjumptime;
|
||||
pmove->waterjumptime = cd->waterjumptime;
|
||||
pmove->dead = (cl.local.health <= 0);
|
||||
pmove->deadflag = cd->deadflag;
|
||||
pmove->spectator = (cls.spectator != 0);
|
||||
@@ -853,10 +1023,10 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
||||
VectorCopy( cd->vuser4, pmove->vuser4 );
|
||||
pmove->cmd = *ucmd; // copy current cmds
|
||||
|
||||
Q_strncpy( pmove->physinfo, cls.physinfo, sizeof( pmove->physinfo ));
|
||||
Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING );
|
||||
}
|
||||
|
||||
static const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||
void CL_FinishPMove( playermove_t *pmove, local_state_t *to )
|
||||
{
|
||||
entity_state_t *ps;
|
||||
clientdata_t *cd;
|
||||
@@ -867,7 +1037,7 @@ static const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||
cd->flags = pmove->flags;
|
||||
cd->bInDuck = pmove->bInDuck;
|
||||
cd->flTimeStepSound = pmove->flTimeStepSound;
|
||||
cd->flDuckTime = (int)pmove->flDuckTime;
|
||||
cd->flDuckTime = pmove->flDuckTime;
|
||||
cd->flSwimTime = (int)pmove->flSwimTime;
|
||||
cd->waterjumptime = (int)pmove->waterjumptime;
|
||||
cd->watertype = pmove->watertype;
|
||||
@@ -880,7 +1050,7 @@ static const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||
VectorCopy( pmove->angles, ps->angles );
|
||||
VectorCopy( pmove->basevelocity, ps->basevelocity );
|
||||
VectorCopy( pmove->punchangle, cd->punchangle );
|
||||
ps->oldbuttons = (uint)pmove->cmd.buttons;
|
||||
ps->oldbuttons = pmove->cmd.buttons;
|
||||
ps->friction = pmove->friction;
|
||||
ps->movetype = pmove->movetype;
|
||||
ps->onground = pmove->onground;
|
||||
@@ -909,7 +1079,7 @@ CL_RunUsercmd
|
||||
Runs prediction code for user cmd
|
||||
=================
|
||||
*/
|
||||
static void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
||||
void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
||||
{
|
||||
usercmd_t cmd;
|
||||
|
||||
@@ -988,9 +1158,13 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
{
|
||||
runcmd_t *to_cmd = NULL, *from_cmd;
|
||||
local_state_t *from = NULL, *to = NULL;
|
||||
frame_t *frame = NULL;
|
||||
uint current_command;
|
||||
uint current_command_mod;
|
||||
frame_t *frame = NULL;
|
||||
uint i, stoppoint;
|
||||
qboolean runfuncs;
|
||||
double f = 1.0;
|
||||
cl_entity_t *ent;
|
||||
double time;
|
||||
|
||||
if( cls.state != ca_active || cls.spectator )
|
||||
@@ -1001,7 +1175,7 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
|
||||
CL_SetUpPlayerPrediction( false, false );
|
||||
|
||||
if( !cl.validsequence )
|
||||
if( cls.state != ca_active || !cl.validsequence )
|
||||
return;
|
||||
|
||||
if(( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= CL_UPDATE_MASK )
|
||||
@@ -1042,10 +1216,6 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
|
||||
for( i = 1; i < CL_UPDATE_MASK && cls.netchan.incoming_acknowledged + i < cls.netchan.outgoing_sequence + stoppoint; i++ )
|
||||
{
|
||||
uint current_command;
|
||||
uint current_command_mod;
|
||||
qboolean runfuncs;
|
||||
|
||||
current_command = cls.netchan.incoming_acknowledged + i;
|
||||
current_command_mod = current_command & CL_UPDATE_MASK;
|
||||
|
||||
@@ -1085,7 +1255,7 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
cl.local.onground = frame->playerstate[cl.playernum].onground;
|
||||
else cl.local.onground = -1;
|
||||
|
||||
if( !repredicting || !cl_lw.value )
|
||||
if( !repredicting || !CVAR_TO_BOOL( cl_lw ))
|
||||
cl.local.viewmodel = to->client.viewmodel;
|
||||
cl.local.repredicting = false;
|
||||
cl.local.moving = false;
|
||||
@@ -1117,12 +1287,12 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
|
||||
cl.local.waterlevel = to->client.waterlevel;
|
||||
cl.local.usehull = to->playerstate.usehull;
|
||||
if( !repredicting || !cl_lw.value )
|
||||
if( !repredicting || !CVAR_TO_BOOL( cl_lw ))
|
||||
cl.local.viewmodel = to->client.viewmodel;
|
||||
|
||||
if( FBitSet( to->client.flags, FL_ONGROUND ))
|
||||
{
|
||||
cl_entity_t *ent = CL_GetEntityByIndex( cl.local.lastground );
|
||||
ent = CL_GetEntityByIndex( cl.local.lastground );
|
||||
cl.local.onground = cl.local.lastground;
|
||||
cl.local.moving = false;
|
||||
|
||||
@@ -1144,27 +1314,27 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
else
|
||||
{
|
||||
cl.local.onground = -1;
|
||||
cl.local.moving = false;
|
||||
cl.local.moving = 0;
|
||||
}
|
||||
|
||||
if( cls.correction_time > 0 && !cl_nosmooth.value && cl_smoothtime.value )
|
||||
if( cls.correction_time > 0 && !cl_nosmooth->value && cl_smoothtime->value )
|
||||
{
|
||||
vec3_t delta;
|
||||
float frac;
|
||||
vec3_t delta;
|
||||
float frac;
|
||||
|
||||
// only decay timer once per frame
|
||||
if( !repredicting )
|
||||
cls.correction_time -= host.frametime;
|
||||
|
||||
// Make sure smoothtime is postive
|
||||
if( cl_smoothtime.value <= 0.0f )
|
||||
Cvar_DirectSet( &cl_smoothtime, "0.1" );
|
||||
if( cl_smoothtime->value <= 0.0f )
|
||||
Cvar_DirectSet( cl_smoothtime, "0.1" );
|
||||
|
||||
// Clamp from 0 to cl_smoothtime.value
|
||||
cls.correction_time = bound( 0.0, cls.correction_time, cl_smoothtime.value );
|
||||
cls.correction_time = bound( 0.0, cls.correction_time, cl_smoothtime->value );
|
||||
|
||||
// Compute backward interpolation fraction along full correction
|
||||
frac = 1.0f - cls.correction_time / cl_smoothtime.value;
|
||||
frac = 1.0f - cls.correction_time / cl_smoothtime->value;
|
||||
|
||||
// Determine how much error we still have to make up for
|
||||
VectorSubtract( cl.simorg, cl.local.lastorigin, delta );
|
||||
|
||||
@@ -22,24 +22,22 @@ GNU General Public License for more details.
|
||||
#include "hltv.h"
|
||||
#include "input.h"
|
||||
|
||||
enum {
|
||||
STAT_HEALTH = 0,
|
||||
STAT_FRAGS,
|
||||
STAT_WEAPON,
|
||||
STAT_AMMO,
|
||||
STAT_ARMOR,
|
||||
STAT_WEAPONFRAME,
|
||||
STAT_SHELLS,
|
||||
STAT_NAILS,
|
||||
STAT_ROCKETS,
|
||||
STAT_CELLS,
|
||||
STAT_ACTIVEWEAPON,
|
||||
STAT_TOTALSECRETS,
|
||||
STAT_TOTALMONSTERS,
|
||||
STAT_SECRETS, // bumped on client side by svc_foundsecret
|
||||
STAT_MONSTERS, // bumped by svc_killedmonster
|
||||
MAX_STATS = 32,
|
||||
};
|
||||
#define STAT_HEALTH 0
|
||||
#define STAT_FRAGS 1
|
||||
#define STAT_WEAPON 2
|
||||
#define STAT_AMMO 3
|
||||
#define STAT_ARMOR 4
|
||||
#define STAT_WEAPONFRAME 5
|
||||
#define STAT_SHELLS 6
|
||||
#define STAT_NAILS 7
|
||||
#define STAT_ROCKETS 8
|
||||
#define STAT_CELLS 9
|
||||
#define STAT_ACTIVEWEAPON 10
|
||||
#define STAT_TOTALSECRETS 11
|
||||
#define STAT_TOTALMONSTERS 12
|
||||
#define STAT_SECRETS 13 // bumped on client side by svc_foundsecret
|
||||
#define STAT_MONSTERS 14 // bumped by svc_killedmonster
|
||||
#define MAX_STATS 32
|
||||
|
||||
static char cmd_buf[8192];
|
||||
static char msg_buf[8192];
|
||||
@@ -213,7 +211,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
clgame.maxEntities = GI->max_edicts;
|
||||
clgame.maxEntities = bound( 600, clgame.maxEntities, MAX_EDICTS );
|
||||
clgame.maxModels = MAX_MODELS;
|
||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), MAX_STRING );
|
||||
|
||||
// Re-init hud video, especially if we changed game directories
|
||||
clgame.dllFuncs.pfnVidInit();
|
||||
@@ -234,10 +232,14 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
// loading user settings
|
||||
CSCR_LoadDefaultCVars( "user.scr" );
|
||||
|
||||
if( r_decals.value > mp_decals.value )
|
||||
Cvar_DirectSet( &r_decals, mp_decals.string );
|
||||
if( r_decals->value > mp_decals.value )
|
||||
Cvar_SetValue( "r_decals", mp_decals.value );
|
||||
}
|
||||
else Cvar_DirectSet( &r_decals, NULL );
|
||||
else Cvar_Reset( "r_decals" );
|
||||
|
||||
// re-init mouse
|
||||
if( cl.background )
|
||||
host.mouse_visible = false;
|
||||
|
||||
if( cl.background ) // tell the game parts about background state
|
||||
Cvar_FullSet( "cl_background", "1", FCVAR_READ_ONLY );
|
||||
@@ -260,7 +262,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
Q_strncpy( gameui.globals->maptitle, clgame.maptitle, sizeof( gameui.globals->maptitle ));
|
||||
|
||||
if( !cls.changelevel && !cls.changedemo )
|
||||
CL_InitEdicts( cl.maxclients ); // re-arrange edicts
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
|
||||
// Quake just have a large packet of initialization data
|
||||
for( i = 1; i < MAX_MODELS; i++ )
|
||||
@@ -304,9 +306,9 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
else Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" ));
|
||||
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
|
||||
|
||||
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
||||
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
|
||||
{
|
||||
if( !FS_FileExists( va( "%s.bmp", cl_levelshot_name.string ), true ))
|
||||
if( !FS_FileExists( va( "%s.bmp", cl_levelshot_name->string ), true ))
|
||||
Cvar_Set( "cl_levelshot_name", "*black" ); // render a black screen
|
||||
cls.scrshot_request = scrshot_plaque; // request levelshot even if exist (check filetime)
|
||||
}
|
||||
@@ -330,7 +332,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
clgame.movevars.gravity = 800.0f; // quake doesn't write gravity in demos
|
||||
clgame.movevars.maxvelocity = 2000.0f;
|
||||
|
||||
clgame.oldmovevars = clgame.movevars;
|
||||
memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -416,7 +418,7 @@ If an entities model or origin changes from frame to frame, it must be
|
||||
relinked. Other attributes can change without relinking.
|
||||
==================
|
||||
*/
|
||||
static void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||
void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||
{
|
||||
int i, newnum, pack;
|
||||
qboolean forcelink;
|
||||
@@ -431,7 +433,7 @@ static void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||
cls.signon = SIGNONS;
|
||||
|
||||
// Clear loading plaque.
|
||||
CL_SignonReply( PROTO_QUAKE );
|
||||
CL_SignonReply ();
|
||||
}
|
||||
|
||||
// alloc next slot to store update
|
||||
@@ -567,7 +569,7 @@ CL_ParseQuakeParticles
|
||||
|
||||
==================
|
||||
*/
|
||||
static void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||
void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||
{
|
||||
int count, color;
|
||||
vec3_t org, dir;
|
||||
@@ -589,7 +591,7 @@ CL_ParseQuakeStaticSound
|
||||
|
||||
===================
|
||||
*/
|
||||
static void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
||||
void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
||||
{
|
||||
int sound_num;
|
||||
float vol, attn;
|
||||
@@ -622,7 +624,7 @@ static void CL_ParseQuakeDamage( sizebuf_t *msg )
|
||||
|
||||
/*
|
||||
===================
|
||||
CL_ParseStaticEntity
|
||||
CL_ParseQuakeStaticEntity
|
||||
|
||||
===================
|
||||
*/
|
||||
@@ -648,7 +650,7 @@ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg )
|
||||
i = clgame.numStatics;
|
||||
if( i >= MAX_STATIC_ENTITIES )
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: static entities limit exceeded!\n", __func__ );
|
||||
Con_Printf( S_ERROR "CL_ParseStaticEntity: static entities limit exceeded!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -696,13 +698,17 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
|
||||
cl_entity_t *ent;
|
||||
int newnum;
|
||||
|
||||
memset( &state, 0, sizeof( state ));
|
||||
newnum = MSG_ReadWord( msg ); // entnum
|
||||
|
||||
if( newnum >= clgame.maxEntities )
|
||||
Host_Error( "%s: no free edicts\n", __func__ );
|
||||
Host_Error( "CL_AllocEdict: no free edicts\n" );
|
||||
|
||||
ent = CL_EDICT_NUM( newnum );
|
||||
memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
|
||||
ent->index = newnum;
|
||||
|
||||
// parse baseline
|
||||
memset( &state, 0, sizeof( state ));
|
||||
state.modelindex = MSG_ReadByte( msg );
|
||||
state.frame = MSG_ReadByte( msg );
|
||||
state.colormap = MSG_ReadByte( msg );
|
||||
@@ -713,11 +719,10 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
|
||||
state.angles[1] = MSG_ReadAngle( msg );
|
||||
state.origin[2] = MSG_ReadCoord( msg );
|
||||
state.angles[2] = MSG_ReadAngle( msg );
|
||||
|
||||
ent = CL_EDICT_NUM( newnum );
|
||||
ent->index = newnum;
|
||||
ent->player = CL_IsPlayerIndex( newnum );
|
||||
ent->prevstate = ent->baseline = state;
|
||||
|
||||
memcpy( &ent->baseline, &state, sizeof( entity_state_t ));
|
||||
memcpy( &ent->prevstate, &state, sizeof( entity_state_t ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -779,7 +784,7 @@ static void CL_ParseQuakeSignon( sizebuf_t *msg )
|
||||
int i = MSG_ReadByte( msg );
|
||||
|
||||
if( i == 3 ) cls.signon = SIGNONS - 1;
|
||||
Con_Reportf( "%s: %d\n", __func__, i );
|
||||
Con_Reportf( "CL_Signon: %d\n", i );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -817,12 +822,9 @@ CL_QuakeStuffText
|
||||
|
||||
==================
|
||||
*/
|
||||
static void CL_QuakeStuffText( const char *text )
|
||||
void CL_QuakeStuffText( const char *text )
|
||||
{
|
||||
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
|
||||
|
||||
// a1ba: didn't filtered, anyway quake protocol
|
||||
// only supported for demos, not network games
|
||||
Cbuf_AddText( text );
|
||||
}
|
||||
|
||||
@@ -832,7 +834,7 @@ CL_QuakeExecStuff
|
||||
|
||||
==================
|
||||
*/
|
||||
static void CL_QuakeExecStuff( void )
|
||||
void CL_QuakeExecStuff( void )
|
||||
{
|
||||
char *text = cmd_buf;
|
||||
char token[256];
|
||||
@@ -845,7 +847,7 @@ static void CL_QuakeExecStuff( void )
|
||||
while( 1 )
|
||||
{
|
||||
// skip whitespace up to a /n
|
||||
while( *text && ((byte)*text ) <= ' ' && *text != '\r' && *text != '\n' )
|
||||
while( *text && ((byte)*text) <= ' ' && *text != '\r' && *text != '\n' )
|
||||
text++;
|
||||
|
||||
if( *text == '\n' || *text == '\r' )
|
||||
@@ -859,7 +861,7 @@ static void CL_QuakeExecStuff( void )
|
||||
|
||||
if( !*text ) break;
|
||||
|
||||
text = COM_ParseFileSafe( text, token, sizeof( token ), PFILE_IGNOREBRACKET, NULL, NULL );
|
||||
text = _COM_ParseFileSafe( text, token, sizeof( token ), PFILE_IGNOREBRACKET, NULL );
|
||||
|
||||
if( !text ) break;
|
||||
|
||||
@@ -887,21 +889,38 @@ CL_ParseQuakeMessage
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_ParseQuakeMessage( sizebuf_t *msg )
|
||||
void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
{
|
||||
int cmd, param1, param2;
|
||||
size_t bufStart;
|
||||
const char *str;
|
||||
|
||||
cls.starting_count = MSG_GetNumBytesRead( msg ); // updates each frame
|
||||
CL_Parse_Debug( true ); // begin parsing
|
||||
|
||||
// init excise buffer
|
||||
MSG_Init( &msg_demo, "UserMsg", msg_buf, sizeof( msg_buf ));
|
||||
|
||||
if( normal_message )
|
||||
{
|
||||
// assume no entity/player update this packet
|
||||
if( cls.state == ca_active )
|
||||
{
|
||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false;
|
||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CL_ResetFrame( &cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK] );
|
||||
}
|
||||
}
|
||||
|
||||
// parse the message
|
||||
while( 1 )
|
||||
{
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
{
|
||||
Host_Error( "%s: overflow!\n", __func__ );
|
||||
Host_Error( "CL_ParseServerMessage: overflow!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -950,7 +969,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg )
|
||||
break;
|
||||
case svc_time:
|
||||
Cbuf_AddText( "\n" ); // new frame was started
|
||||
CL_ParseServerTime( msg, PROTO_QUAKE );
|
||||
CL_ParseServerTime( msg );
|
||||
break;
|
||||
case svc_print:
|
||||
str = MSG_ReadString( msg );
|
||||
@@ -1092,11 +1111,14 @@ void CL_ParseQuakeMessage( sizebuf_t *msg )
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Host_Error( "%s: Illegible server message\n", __func__ );
|
||||
Host_Error( "CL_ParseServerMessage: Illegible server message\n" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cl.frames[cl.parsecountmod].graphdata.msgbytes += MSG_GetNumBytesRead( msg ) - cls.starting_count;
|
||||
CL_Parse_Debug( false ); // done
|
||||
|
||||
// now process packet.
|
||||
CL_ProcessPacket( &cl.frames[cl.parsecountmod] );
|
||||
|
||||
|
||||
@@ -41,24 +41,11 @@ CL_CmpStudioTextures
|
||||
return true if equal
|
||||
====================
|
||||
*/
|
||||
static qboolean CL_CmpStudioTextures( int numtexs, mstudiotexture_t *p1, remap_info_t *remap )
|
||||
qboolean CL_CmpStudioTextures( int numtexs, mstudiotexture_t *p1, mstudiotexture_t *p2 )
|
||||
{
|
||||
int i;
|
||||
mstudiotexture_t *p2;
|
||||
|
||||
if( !p1 ) // no textures
|
||||
return false;
|
||||
|
||||
if( !remap ) // current model has no remap
|
||||
return false;
|
||||
|
||||
if( !remap->textures ) // shouldn't happen, just in case
|
||||
return false;
|
||||
|
||||
if( numtexs != remap->numtextures ) // amount of textures differs, it's a different model
|
||||
return false;
|
||||
|
||||
p2 = remap->ptexture;
|
||||
if( !p1 || !p2 ) return false;
|
||||
|
||||
for( i = 0; i < numtexs; i++, p1++, p2++ )
|
||||
{
|
||||
@@ -78,7 +65,7 @@ CL_CreateRawTextureFromPixels
|
||||
Convert texture_t struct into mstudiotexture_t prototype
|
||||
====================
|
||||
*/
|
||||
static byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor )
|
||||
byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor )
|
||||
{
|
||||
static mstudiotexture_t pin;
|
||||
byte *pal;
|
||||
@@ -111,7 +98,7 @@ CL_DuplicateTexture
|
||||
Dupliacte texture with remap pixels
|
||||
====================
|
||||
*/
|
||||
static void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
{
|
||||
const char *name;
|
||||
texture_t *tx = NULL;
|
||||
@@ -154,7 +141,7 @@ CL_UpdateStudioTexture
|
||||
Update texture top and bottom colors
|
||||
====================
|
||||
*/
|
||||
static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
{
|
||||
rgbdata_t *pic;
|
||||
texture_t *tx = NULL;
|
||||
@@ -170,7 +157,7 @@ static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptext
|
||||
|
||||
// build name of original texture
|
||||
Q_strncpy( mdlname, entity->model->name, sizeof( mdlname ));
|
||||
COM_FileBase( ptexture->name, name, sizeof( name ));
|
||||
COM_FileBase( ptexture->name, name );
|
||||
COM_StripExtension( mdlname );
|
||||
|
||||
Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name );
|
||||
@@ -215,7 +202,7 @@ CL_UpdateAliasTexture
|
||||
Update texture top and bottom colors
|
||||
====================
|
||||
*/
|
||||
static void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
||||
void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
||||
{
|
||||
char texname[MAX_QPATH];
|
||||
rgbdata_t skin, *pic;
|
||||
@@ -247,68 +234,6 @@ static void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture,
|
||||
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_FreeRemapInfo
|
||||
|
||||
Release remap info per entity
|
||||
====================
|
||||
*/
|
||||
static void CL_FreeRemapInfo( remap_info_t *info )
|
||||
{
|
||||
int i;
|
||||
|
||||
Assert( info != NULL );
|
||||
|
||||
// release all colormap texture copies
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
||||
}
|
||||
|
||||
if( info->textures[i] != 0 )
|
||||
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
||||
}
|
||||
|
||||
Mem_Free( info ); // release struct
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_UpdateRemapInfo
|
||||
|
||||
Update all remaps per entity
|
||||
====================
|
||||
*/
|
||||
static void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
||||
{
|
||||
remap_info_t *info;
|
||||
int i;
|
||||
|
||||
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||
info = clgame.remap_info[i];
|
||||
if( !info ) return; // no remap info
|
||||
|
||||
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor )
|
||||
return; // values is valid
|
||||
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
||||
}
|
||||
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
info->topcolor = topcolor;
|
||||
info->bottomcolor = bottomcolor;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_AllocRemapInfo
|
||||
@@ -317,7 +242,7 @@ Allocate new remap info per entity
|
||||
and make copy of remap textures
|
||||
====================
|
||||
*/
|
||||
static void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
||||
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
||||
{
|
||||
remap_info_t *info;
|
||||
studiohdr_t *phdr;
|
||||
@@ -357,9 +282,10 @@ static void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor
|
||||
if( !phdr ) return; // bad model?
|
||||
|
||||
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
|
||||
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
|
||||
|
||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
||||
if( !CL_CmpStudioTextures( phdr->numtextures, src, clgame.remap_info[i] ) || clgame.remap_info[i]->model != model )
|
||||
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != model )
|
||||
{
|
||||
// this code catches studiomodel change with another studiomodel with remap textures
|
||||
// e.g. playermodel 'barney' with playermodel 'gordon'
|
||||
@@ -424,6 +350,68 @@ static void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor
|
||||
info->model = model;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_UpdateRemapInfo
|
||||
|
||||
Update all remaps per entity
|
||||
====================
|
||||
*/
|
||||
void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
||||
{
|
||||
remap_info_t *info;
|
||||
int i;
|
||||
|
||||
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||
info = clgame.remap_info[i];
|
||||
if( !info ) return; // no remap info
|
||||
|
||||
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor )
|
||||
return; // values is valid
|
||||
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
||||
}
|
||||
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
info->topcolor = topcolor;
|
||||
info->bottomcolor = bottomcolor;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_FreeRemapInfo
|
||||
|
||||
Release remap info per entity
|
||||
====================
|
||||
*/
|
||||
void CL_FreeRemapInfo( remap_info_t *info )
|
||||
{
|
||||
int i;
|
||||
|
||||
Assert( info != NULL );
|
||||
|
||||
// release all colormap texture copies
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
||||
}
|
||||
|
||||
if( info->textures[i] != 0 )
|
||||
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
||||
}
|
||||
|
||||
Mem_Free( info ); // release struct
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_ClearAllRemaps
|
||||
@@ -446,21 +434,3 @@ void CL_ClearAllRemaps( void )
|
||||
}
|
||||
clgame.remap_info = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_EntitySetRemapColors
|
||||
=============
|
||||
*/
|
||||
qboolean CL_EntitySetRemapColors( cl_entity_t *e, model_t *mod, int top, int bottom )
|
||||
{
|
||||
CL_AllocRemapInfo( e, mod, top, bottom );
|
||||
|
||||
if( CL_GetRemapInfoForEntity( e ))
|
||||
{
|
||||
CL_UpdateRemapInfo( e, top, bottom );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ GNU General Public License for more details.
|
||||
|
||||
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
||||
{
|
||||
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis, false );
|
||||
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
|
||||
}
|
||||
|
||||
lightstyle_t *CL_GetLightStyle( int number )
|
||||
@@ -117,7 +117,7 @@ static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot,
|
||||
else cls.scrshot_action = scrshot_envshot;
|
||||
|
||||
// catch negative values
|
||||
cls.envshot_viewsize = Q_max( 0, shotsize );
|
||||
cls.envshot_viewsize = max( 0, shotsize );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -126,14 +126,14 @@ CL_GenericHandle
|
||||
|
||||
=============
|
||||
*/
|
||||
static const char *CL_GenericHandle( int fileindex )
|
||||
const char *CL_GenericHandle( int fileindex )
|
||||
{
|
||||
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
||||
return 0;
|
||||
return cl.files_precache[fileindex];
|
||||
}
|
||||
|
||||
intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
|
||||
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
|
||||
{
|
||||
switch( parm )
|
||||
{
|
||||
@@ -142,6 +142,8 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
case PARM_SKY_SPHERE:
|
||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||
case PARAM_GAMEPAUSED:
|
||||
return cl.paused;
|
||||
case PARM_CLIENT_INGAME:
|
||||
@@ -159,23 +161,9 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
case PARM_WATER_ALPHA:
|
||||
return FBitSet( world.flags, FWORLD_WATERALPHA );
|
||||
case PARM_DELUXEDATA:
|
||||
return (intptr_t)world.deluxedata;
|
||||
return *(int *)&world.deluxedata;
|
||||
case PARM_SHADOWDATA:
|
||||
return (intptr_t)world.shadowdata;
|
||||
case PARM_FULLSCREEN:
|
||||
return refState.fullScreen;
|
||||
case PARM_WIDESCREEN:
|
||||
return refState.wideScreen;
|
||||
case PARM_SCREEN_WIDTH:
|
||||
return refState.width;
|
||||
case PARM_SCREEN_HEIGHT:
|
||||
return refState.height;
|
||||
case PARM_SKY_SPHERE:
|
||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||
case PARM_SURF_SAMPLESIZE:
|
||||
if( arg >= 0 && arg < cl.worldmodel->numsurfaces )
|
||||
return Mod_SampleSizeForFace( &cl.worldmodel->surfaces[arg] );
|
||||
return LM_SAMPLE_SIZE;
|
||||
return *(int *)&world.shadowdata;
|
||||
default:
|
||||
// indicates call from client.dll
|
||||
if( checkRef )
|
||||
@@ -191,36 +179,32 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
return CL_IsThirdPerson();
|
||||
case PARM_QUAKE_COMPATIBLE:
|
||||
return Host_IsQuakeCompatible();
|
||||
case PARM_PLAYER_INDEX:
|
||||
return cl.playernum + 1;
|
||||
case PARM_VIEWENT_INDEX:
|
||||
return cl.viewentity;
|
||||
case PARM_CONNSTATE:
|
||||
return (int)cls.state;
|
||||
case PARM_PLAYING_DEMO:
|
||||
return cls.demoplayback;
|
||||
case PARM_WATER_LEVEL:
|
||||
return cl.local.waterlevel;
|
||||
case PARM_MAX_CLIENTS:
|
||||
return cl.maxclients;
|
||||
case PARM_LOCAL_HEALTH:
|
||||
return cl.local.health;
|
||||
case PARM_LOCAL_GAME:
|
||||
return Host_IsLocalGame();
|
||||
case PARM_NUMENTITIES:
|
||||
return pfnNumberOfEntities();
|
||||
case PARM_GET_CLIENT_PTR:
|
||||
return (intptr_t)&cl.time; // with the offset
|
||||
case PARM_GET_HOST_PTR:
|
||||
return (intptr_t)&host.realtime; // with the offset
|
||||
case PARM_GET_WORLD_PTR:
|
||||
return (intptr_t)&world;
|
||||
case PARM_GET_MOVEVARS_PTR:
|
||||
return (intptr_t)&clgame.movevars;
|
||||
case PARM_GET_PALETTE_PTR:
|
||||
return (intptr_t)&clgame.palette;
|
||||
case PARM_GET_VIEWENT_PTR:
|
||||
return (intptr_t)&clgame.viewent;
|
||||
case PARM_NUMMODELS:
|
||||
return cl.nummodels;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static intptr_t pfnRenderGetParm( int parm, int arg )
|
||||
static int pfnRenderGetParm( int parm, int arg )
|
||||
{
|
||||
return CL_RenderGetParm( parm, arg, true );
|
||||
}
|
||||
@@ -347,7 +331,7 @@ qboolean R_InitRenderAPI( void )
|
||||
{
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
||||
{
|
||||
Con_Reportf( "%s: ^2initailized extended RenderAPI ^7ver. %i\n", __func__, CL_RENDER_INTERFACE_VERSION );
|
||||
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,18 @@ GNU General Public License for more details.
|
||||
#include "input.h"
|
||||
#include "library.h"
|
||||
|
||||
CVAR_DEFINE_AUTO( scr_centertime, "2.5", 0, "centerprint hold time" );
|
||||
CVAR_DEFINE_AUTO( scr_loading, "0", 0, "loading bar progress" );
|
||||
CVAR_DEFINE_AUTO( scr_download, "-1", 0, "downloading bar progress" );
|
||||
CVAR_DEFINE( scr_viewsize, "viewsize", "120", FCVAR_ARCHIVE, "screen size (quake only)" );
|
||||
CVAR_DEFINE_AUTO( cl_testlights, "0", FCVAR_CHEAT, "test dynamic lights" );
|
||||
CVAR_DEFINE( cl_allow_levelshots, "allow_levelshots", "0", FCVAR_ARCHIVE, "allow engine to use indivdual levelshots instead of 'loading' image" );
|
||||
CVAR_DEFINE_AUTO( cl_levelshot_name, "*black", 0, "contains path to current levelshot" );
|
||||
static CVAR_DEFINE_AUTO( cl_envshot_size, "256", FCVAR_ARCHIVE, "envshot size of cube side" );
|
||||
CVAR_DEFINE_AUTO( v_dark, "0", 0, "starts level from dark screen" );
|
||||
static CVAR_DEFINE_AUTO( net_speeds, "0", FCVAR_ARCHIVE, "show network packets" );
|
||||
static CVAR_DEFINE_AUTO( cl_showfps, "0", FCVAR_ARCHIVE, "show client fps" );
|
||||
static CVAR_DEFINE_AUTO( cl_showpos, "0", FCVAR_ARCHIVE, "show local player position and velocity" );
|
||||
static CVAR_DEFINE_AUTO( cl_showents, "0", FCVAR_ARCHIVE | FCVAR_CHEAT, "show entities information (largely undone)" );
|
||||
convar_t *scr_centertime;
|
||||
convar_t *scr_loading;
|
||||
convar_t *scr_download;
|
||||
convar_t *scr_viewsize;
|
||||
convar_t *cl_testlights;
|
||||
convar_t *cl_allow_levelshots;
|
||||
convar_t *cl_levelshot_name;
|
||||
static convar_t *cl_envshot_size;
|
||||
convar_t *v_dark;
|
||||
static convar_t *net_speeds;
|
||||
static convar_t *cl_showfps;
|
||||
static convar_t *cl_showpos;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -60,7 +59,7 @@ void SCR_DrawFPS( int height )
|
||||
char fpsstring[64];
|
||||
int offset;
|
||||
|
||||
if( cls.state != ca_active || !cl_showfps.value || cl.background )
|
||||
if( cls.state != ca_active || !cl_showfps->value || cl.background )
|
||||
return;
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
@@ -96,7 +95,7 @@ void SCR_DrawFPS( int height )
|
||||
if( curfps < minfps ) minfps = curfps;
|
||||
if( curfps > maxfps ) maxfps = curfps;
|
||||
|
||||
if( cl_showfps.value == 2 )
|
||||
if( cl_showfps->value == 2 )
|
||||
Q_snprintf( fpsstring, sizeof( fpsstring ), "fps: ^1%4i min, ^3%4i cur, ^2%4i max", minfps, curfps, maxfps );
|
||||
else Q_snprintf( fpsstring, sizeof( fpsstring ), "%4i fps", curfps );
|
||||
MakeRGBA( color, 255, 255, 255, 255 );
|
||||
@@ -120,10 +119,10 @@ void SCR_DrawPos( void )
|
||||
cl_entity_t *ent;
|
||||
rgba_t color;
|
||||
|
||||
if( cls.state != ca_active || !cl_showpos.value || cl.background )
|
||||
if( cls.state != ca_active || !cl_showpos->value || cl.background )
|
||||
return;
|
||||
|
||||
ent = CL_EDICT_NUM( cl.playernum + 1 );
|
||||
ent = CL_GetLocalPlayer();
|
||||
speed = VectorLength( cl.simvel );
|
||||
|
||||
Q_snprintf( msg, MAX_SYSPATH,
|
||||
@@ -141,68 +140,6 @@ void SCR_DrawPos( void )
|
||||
Con_DrawString( refState.width / 2, 4, msg, color );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawEnts
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawEnts( void )
|
||||
{
|
||||
rgba_t color = { 255, 255, 255, 255 };
|
||||
int i;
|
||||
|
||||
if( cls.state != ca_active || !cl_showents.value || ( cl.maxclients > 1 && !cls.demoplayback ))
|
||||
return;
|
||||
|
||||
// this probably better hook CL_AddVisibleEntities
|
||||
// as entities might get added by client.dll
|
||||
for( i = 0; i < clgame.maxEntities; i++ )
|
||||
{
|
||||
const cl_entity_t *ent = &clgame.entities[i];
|
||||
string msg;
|
||||
vec3_t screen, pos;
|
||||
|
||||
if( ent->curstate.messagenum != cl.parsecount )
|
||||
continue;
|
||||
|
||||
VectorCopy( ent->origin, pos );
|
||||
|
||||
if( ent->model != NULL )
|
||||
{
|
||||
vec3_t v;
|
||||
|
||||
// simple model type filter
|
||||
if( cl_showents.value > 1 )
|
||||
{
|
||||
if( ent->model->type != (modtype_t)( cl_showents.value - 2 ))
|
||||
continue;
|
||||
}
|
||||
|
||||
VectorAverage( ent->model->mins, ent->model->maxs, v );
|
||||
VectorAdd( pos, v, pos );
|
||||
}
|
||||
|
||||
if( !ref.dllFuncs.WorldToScreen( pos, screen ))
|
||||
{
|
||||
Q_snprintf( msg, sizeof( msg ),
|
||||
"entity %d\n"
|
||||
"model %s\n"
|
||||
"movetype %d\n",
|
||||
ent->index,
|
||||
ent->model ? ent->model->name : "(null)",
|
||||
ent->curstate.movetype );
|
||||
|
||||
screen[0] = 0.5f * screen[0] * refState.width;
|
||||
screen[1] = -0.5f * screen[1] * refState.height;
|
||||
screen[0] += 0.5f * refState.width;
|
||||
screen[1] += 0.5f * refState.height;
|
||||
|
||||
|
||||
Con_DrawString( screen[0], screen[1], msg, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_NetSpeeds
|
||||
@@ -213,7 +150,8 @@ same as r_speeds but for network channel
|
||||
void SCR_NetSpeeds( void )
|
||||
{
|
||||
static char msg[MAX_SYSPATH];
|
||||
int x, y;
|
||||
int x, y, height;
|
||||
char *p, *start, *end;
|
||||
float time = cl.mtime[0];
|
||||
static int min_svfps = 100;
|
||||
static int max_svfps = 0;
|
||||
@@ -222,12 +160,11 @@ void SCR_NetSpeeds( void )
|
||||
static int max_clfps = 0;
|
||||
int cur_clfps = 0;
|
||||
rgba_t color;
|
||||
cl_font_t *font = Con_GetCurFont();
|
||||
|
||||
if( !host.allow_console )
|
||||
return;
|
||||
|
||||
if( !net_speeds.value || cls.state != ca_active )
|
||||
if( !net_speeds->value || cls.state != ca_active )
|
||||
return;
|
||||
|
||||
// prevent to get too big values at max
|
||||
@@ -259,11 +196,25 @@ void SCR_NetSpeeds( void )
|
||||
Q_memprint( cls.netchan.total_sended )
|
||||
);
|
||||
|
||||
x = refState.width - 320 * font->scale;
|
||||
x = refState.width - 320;
|
||||
y = 384;
|
||||
|
||||
Con_DrawStringLen( NULL, NULL, &height );
|
||||
MakeRGBA( color, 255, 255, 255, 255 );
|
||||
CL_DrawString( x, y, msg, color, font, FONT_DRAW_RESETCOLORONLF );
|
||||
|
||||
p = start = msg;
|
||||
|
||||
do
|
||||
{
|
||||
end = Q_strchr( p, '\n' );
|
||||
if( end ) msg[end-start] = '\0';
|
||||
|
||||
Con_DrawString( x, y, p, color );
|
||||
y += height;
|
||||
|
||||
if( end ) p = end + 1;
|
||||
else break;
|
||||
} while( 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -280,15 +231,31 @@ void SCR_RSpeeds( void )
|
||||
|
||||
if( ref.dllFuncs.R_SpeedsMessage( msg, sizeof( msg )))
|
||||
{
|
||||
int x, y;
|
||||
int x, y, height;
|
||||
char *p, *start, *end;
|
||||
rgba_t color;
|
||||
cl_font_t *font = Con_GetCurFont();
|
||||
|
||||
x = refState.width - 340 * font->scale;
|
||||
x = refState.width - 340;
|
||||
y = 64;
|
||||
|
||||
Con_DrawStringLen( NULL, NULL, &height );
|
||||
MakeRGBA( color, 255, 255, 255, 255 );
|
||||
CL_DrawString( x, y, msg, color, font, FONT_DRAW_RESETCOLORONLF );
|
||||
|
||||
p = start = msg;
|
||||
do
|
||||
{
|
||||
end = Q_strchr( p, '\n' );
|
||||
if( end ) msg[end-start] = '\0';
|
||||
|
||||
Con_DrawString( x, y, p, color );
|
||||
y += height;
|
||||
|
||||
// handle '\n\n'
|
||||
if( *p == '\n' )
|
||||
y += height;
|
||||
if( end ) p = end + 1;
|
||||
else break;
|
||||
} while( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +282,7 @@ VID_WriteOverviewScript
|
||||
Create overview script file
|
||||
===============
|
||||
*/
|
||||
static void VID_WriteOverviewScript( void )
|
||||
void VID_WriteOverviewScript( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
string filename;
|
||||
@@ -351,14 +318,9 @@ void SCR_MakeScreenShot( void )
|
||||
qboolean iRet = false;
|
||||
int viewsize;
|
||||
|
||||
if( cls.scrshot_action == scrshot_inactive )
|
||||
return;
|
||||
|
||||
if( cls.envshot_viewsize > 0 )
|
||||
viewsize = cls.envshot_viewsize;
|
||||
else viewsize = cl_envshot_size.value;
|
||||
|
||||
V_CheckGamma();
|
||||
else viewsize = cl_envshot_size->value;
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
@@ -385,6 +347,8 @@ void SCR_MakeScreenShot( void )
|
||||
if( iRet )
|
||||
VID_WriteOverviewScript(); // store overview script too
|
||||
break;
|
||||
case scrshot_inactive:
|
||||
return;
|
||||
}
|
||||
|
||||
// report
|
||||
@@ -408,19 +372,15 @@ void SCR_MakeScreenShot( void )
|
||||
SCR_DrawPlaque
|
||||
================
|
||||
*/
|
||||
static qboolean SCR_DrawPlaque( void )
|
||||
void SCR_DrawPlaque( void )
|
||||
{
|
||||
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
||||
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
|
||||
{
|
||||
int levelshot = ref.dllFuncs.GL_LoadTexture( cl_levelshot_name.string, NULL, 0, TF_IMAGE );
|
||||
int levelshot = ref.dllFuncs.GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1, levelshot );
|
||||
if( !cl.background ) CL_DrawHUD( CL_LOADING );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -430,10 +390,15 @@ SCR_BeginLoadingPlaque
|
||||
*/
|
||||
void SCR_BeginLoadingPlaque( qboolean is_background )
|
||||
{
|
||||
float oldclear = 0;;
|
||||
S_StopAllSounds( true );
|
||||
cl.audio_prepped = false; // don't play ambients
|
||||
cl.video_prepped = false;
|
||||
|
||||
if( cls.key_dest == key_menu && !cls.changedemo && !is_background )
|
||||
if( !Host_IsDedicated() )
|
||||
oldclear = gl_clear->value;
|
||||
|
||||
if( CL_IsInMenu( ) && !cls.changedemo && !is_background )
|
||||
{
|
||||
UI_SetActiveMenu( false );
|
||||
if( cls.state == ca_disconnected && !(GameState->curstate == STATE_RUNFRAME && GameState->nextstate != STATE_RUNFRAME) )
|
||||
@@ -446,15 +411,19 @@ void SCR_BeginLoadingPlaque( qboolean is_background )
|
||||
if( cls.key_dest == key_console )
|
||||
return;
|
||||
|
||||
if( !Host_IsDedicated() )
|
||||
gl_clear->value = 0.0f;
|
||||
|
||||
if( is_background ) IN_MouseSavePos( );
|
||||
cls.draw_changelevel = !is_background;
|
||||
SCR_UpdateScreen();
|
||||
|
||||
// set video_prepped after update screen, so engine can draw last remaining frame
|
||||
cl.video_prepped = false;
|
||||
cls.disable_screen = host.realtime;
|
||||
cls.disable_servercount = cl.servercount;
|
||||
cl.background = is_background; // set right state before svc_serverdata is came
|
||||
|
||||
if( !Host_IsDedicated() )
|
||||
gl_clear->value = oldclear;
|
||||
|
||||
// SNDDMA_LockSound();
|
||||
}
|
||||
|
||||
@@ -475,7 +444,7 @@ void SCR_EndLoadingPlaque( void )
|
||||
SCR_AddDirtyPoint
|
||||
=================
|
||||
*/
|
||||
static void SCR_AddDirtyPoint( int x, int y )
|
||||
void SCR_AddDirtyPoint( int x, int y )
|
||||
{
|
||||
if( x < scr_dirty.x1 ) scr_dirty.x1 = x;
|
||||
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
||||
@@ -504,7 +473,7 @@ void SCR_TileClear( void )
|
||||
int i, top, bottom, left, right;
|
||||
dirty_t clear;
|
||||
|
||||
if( likely( scr_viewsize.value >= 120 ))
|
||||
if( scr_viewsize->value >= 120 )
|
||||
return; // full screen rendering
|
||||
|
||||
// erase rect will be the union of the past three frames
|
||||
@@ -582,8 +551,6 @@ text to the screen.
|
||||
*/
|
||||
void SCR_UpdateScreen( void )
|
||||
{
|
||||
qboolean screen_redraw = true; // assume screen has been redrawn
|
||||
|
||||
if( !V_PreRender( )) return;
|
||||
|
||||
switch( cls.state )
|
||||
@@ -594,7 +561,7 @@ void SCR_UpdateScreen( void )
|
||||
case ca_connecting:
|
||||
case ca_connected:
|
||||
case ca_validate:
|
||||
screen_redraw = SCR_DrawPlaque();
|
||||
SCR_DrawPlaque();
|
||||
break;
|
||||
case ca_active:
|
||||
Con_RunConsole ();
|
||||
@@ -604,15 +571,82 @@ void SCR_UpdateScreen( void )
|
||||
SCR_DrawCinematic();
|
||||
break;
|
||||
default:
|
||||
Host_Error( "%s: bad cls.state\n", __func__ );
|
||||
Host_Error( "SCR_UpdateScreen: bad cls.state\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
// during changelevel we might have a few frames when we have nothing to draw
|
||||
// (assuming levelshots are off) and drawing 2d on top of nothing or cleared screen
|
||||
// is ugly, specifically with Adreno and ImgTec GPUs
|
||||
if( screen_redraw || !cls.changelevel || !cls.changedemo )
|
||||
V_PostRender();
|
||||
V_PostRender();
|
||||
}
|
||||
|
||||
qboolean SCR_LoadFixedWidthFont( const char *fontname )
|
||||
{
|
||||
int i, fontWidth;
|
||||
|
||||
if( cls.creditsFont.valid )
|
||||
return true; // already loaded
|
||||
|
||||
if( !FS_FileExists( fontname, false ))
|
||||
return false;
|
||||
|
||||
cls.creditsFont.hFontTexture = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE );
|
||||
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
|
||||
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = fontWidth / 16;
|
||||
cls.creditsFont.type = FONT_FIXED;
|
||||
cls.creditsFont.valid = true;
|
||||
|
||||
// build fixed rectangles
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
cls.creditsFont.fontRc[i].left = (i * (fontWidth / 16)) % fontWidth;
|
||||
cls.creditsFont.fontRc[i].right = cls.creditsFont.fontRc[i].left + fontWidth / 16;
|
||||
cls.creditsFont.fontRc[i].top = (i / 16) * (fontWidth / 16);
|
||||
cls.creditsFont.fontRc[i].bottom = cls.creditsFont.fontRc[i].top + fontWidth / 16;
|
||||
cls.creditsFont.charWidths[i] = clgame.scrInfo.charWidths[i] = fontWidth / 16;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean SCR_LoadVariableWidthFont( const char *fontname )
|
||||
{
|
||||
int i, fontWidth;
|
||||
byte *buffer;
|
||||
fs_offset_t length;
|
||||
qfont_t *src;
|
||||
|
||||
if( cls.creditsFont.valid )
|
||||
return true; // already loaded
|
||||
|
||||
if( !FS_FileExists( fontname, false ))
|
||||
return false;
|
||||
|
||||
cls.creditsFont.hFontTexture = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, TF_IMAGE );
|
||||
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
|
||||
|
||||
// half-life font with variable chars witdh
|
||||
buffer = FS_LoadFile( fontname, &length, false );
|
||||
|
||||
// setup creditsfont
|
||||
if( buffer && length >= sizeof( qfont_t ))
|
||||
{
|
||||
src = (qfont_t *)buffer;
|
||||
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = src->rowheight;
|
||||
cls.creditsFont.type = FONT_VARIABLE;
|
||||
|
||||
// build rectangles
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
cls.creditsFont.fontRc[i].left = (word)src->fontinfo[i].startoffset % fontWidth;
|
||||
cls.creditsFont.fontRc[i].right = cls.creditsFont.fontRc[i].left + src->fontinfo[i].charwidth;
|
||||
cls.creditsFont.fontRc[i].top = (word)src->fontinfo[i].startoffset / fontWidth;
|
||||
cls.creditsFont.fontRc[i].bottom = cls.creditsFont.fontRc[i].top + src->rowheight;
|
||||
cls.creditsFont.charWidths[i] = clgame.scrInfo.charWidths[i] = src->fontinfo[i].charwidth;
|
||||
}
|
||||
cls.creditsFont.valid = true;
|
||||
}
|
||||
if( buffer ) Mem_Free( buffer );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -624,41 +658,22 @@ INTERNAL RESOURCE
|
||||
*/
|
||||
void SCR_LoadCreditsFont( void )
|
||||
{
|
||||
cl_font_t *const font = &cls.creditsFont;
|
||||
qboolean success = false;
|
||||
float scale = hud_fontscale.value;
|
||||
dword crc = 0;
|
||||
const char *path = "gfx/creditsfont.fnt";
|
||||
dword crc;
|
||||
|
||||
// replace default gfx.wad textures by current charset's font
|
||||
if( !CRC32_File( &crc, "gfx.wad" ) || crc == 0x49eb9f16 )
|
||||
{
|
||||
string charsetFnt;
|
||||
|
||||
if( Q_snprintf( charsetFnt, sizeof( charsetFnt ),
|
||||
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
||||
{
|
||||
if( FS_FileExists( charsetFnt, false ))
|
||||
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, &hud_fontrender, TF_FONT );
|
||||
}
|
||||
const char *path2 = va("creditsfont_%s.fnt", Cvar_VariableString( "con_charset" ) );
|
||||
if( FS_FileExists( path2, false ) )
|
||||
path = path2;
|
||||
}
|
||||
|
||||
if( !success )
|
||||
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, &hud_fontrender, TF_FONT );
|
||||
|
||||
if( !success )
|
||||
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &hud_fontrender, TF_FONT );
|
||||
|
||||
// copy font size for client.dll
|
||||
if( success )
|
||||
if( !SCR_LoadVariableWidthFont( path ))
|
||||
{
|
||||
int i;
|
||||
|
||||
clgame.scrInfo.iCharHeight = cls.creditsFont.charHeight;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( cls.creditsFont.charWidths ); i++ )
|
||||
clgame.scrInfo.charWidths[i] = cls.creditsFont.charWidths[i];
|
||||
if( !SCR_LoadFixedWidthFont( "gfx/conchars" ))
|
||||
Con_DPrintf( S_ERROR "failed to load HUD font\n" );
|
||||
}
|
||||
else Con_DPrintf( S_ERROR "failed to load HUD font\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -668,7 +683,7 @@ SCR_InstallParticlePalette
|
||||
INTERNAL RESOURCE
|
||||
================
|
||||
*/
|
||||
static void SCR_InstallParticlePalette( void )
|
||||
void SCR_InstallParticlePalette( void )
|
||||
{
|
||||
rgbdata_t *pic;
|
||||
int i;
|
||||
@@ -714,21 +729,21 @@ void SCR_RegisterTextures( void )
|
||||
// register gfx.wad images
|
||||
|
||||
if( FS_FileExists( "gfx/paused.lmp", false ))
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
|
||||
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
|
||||
|
||||
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
||||
{
|
||||
if( cl_allow_levelshots.value )
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
if( cl_allow_levelshots->value )
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
||||
{
|
||||
if( cl_allow_levelshots.value )
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
if( cl_allow_levelshots->value )
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
|
||||
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||
@@ -741,9 +756,9 @@ SCR_SizeUp_f
|
||||
Keybinding command
|
||||
=================
|
||||
*/
|
||||
static void SCR_SizeUp_f( void )
|
||||
void SCR_SizeUp_f( void )
|
||||
{
|
||||
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
||||
Cvar_SetValue( "viewsize", Q_min( scr_viewsize->value + 10, 120 ));
|
||||
}
|
||||
|
||||
|
||||
@@ -754,9 +769,9 @@ SCR_SizeDown_f
|
||||
Keybinding command
|
||||
=================
|
||||
*/
|
||||
static void SCR_SizeDown_f( void )
|
||||
void SCR_SizeDown_f( void )
|
||||
{
|
||||
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
||||
Cvar_SetValue( "viewsize", Q_max( scr_viewsize->value - 10, 30 ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -780,11 +795,7 @@ void SCR_VidInit( void )
|
||||
gameui.globals->scrHeight = refState.height;
|
||||
}
|
||||
|
||||
// notify vgui about screen size change
|
||||
if( clgame.hInstance )
|
||||
{
|
||||
VGui_Startup( refState.width, refState.height );
|
||||
}
|
||||
VGui_Startup( NULL, refState.width, refState.height ); // initialized already, so pass NULL
|
||||
|
||||
CL_ClearSpriteTextures(); // now all hud sprites are invalid
|
||||
|
||||
@@ -794,7 +805,6 @@ void SCR_VidInit( void )
|
||||
|
||||
// restart console size
|
||||
Con_VidInit ();
|
||||
Touch_NotifyResize();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -806,21 +816,18 @@ void SCR_Init( void )
|
||||
{
|
||||
if( scr_init ) return;
|
||||
|
||||
Cvar_RegisterVariable( &scr_centertime );
|
||||
Cvar_RegisterVariable( &cl_levelshot_name );
|
||||
Cvar_RegisterVariable( &cl_allow_levelshots );
|
||||
Cvar_RegisterVariable( &scr_loading );
|
||||
Cvar_RegisterVariable( &scr_download );
|
||||
Cvar_RegisterVariable( &cl_testlights );
|
||||
Cvar_RegisterVariable( &cl_envshot_size );
|
||||
Cvar_RegisterVariable( &v_dark );
|
||||
Cvar_RegisterVariable( &scr_viewsize );
|
||||
Cvar_RegisterVariable( &net_speeds );
|
||||
Cvar_RegisterVariable( &cl_showfps );
|
||||
Cvar_RegisterVariable( &cl_showpos );
|
||||
#ifdef _DEBUG
|
||||
Cvar_RegisterVariable( &cl_showents );
|
||||
#endif // NDEBUG
|
||||
scr_centertime = Cvar_Get( "scr_centertime", "2.5", 0, "centerprint hold time" );
|
||||
cl_levelshot_name = Cvar_Get( "cl_levelshot_name", "*black", 0, "contains path to current levelshot" );
|
||||
cl_allow_levelshots = Cvar_Get( "allow_levelshots", "0", FCVAR_ARCHIVE, "allow engine to use indivdual levelshots instead of 'loading' image" );
|
||||
scr_loading = Cvar_Get( "scr_loading", "0", 0, "loading bar progress" );
|
||||
scr_download = Cvar_Get( "scr_download", "-1", 0, "downloading bar progress" );
|
||||
cl_testlights = Cvar_Get( "cl_testlights", "0", 0, "test dynamic lights" );
|
||||
cl_envshot_size = Cvar_Get( "cl_envshot_size", "256", FCVAR_ARCHIVE, "envshot size of cube side" );
|
||||
v_dark = Cvar_Get( "v_dark", "0", 0, "starts level from dark screen" );
|
||||
scr_viewsize = Cvar_Get( "viewsize", "120", FCVAR_ARCHIVE, "screen size" );
|
||||
net_speeds = Cvar_Get( "net_speeds", "0", FCVAR_ARCHIVE, "show network packets" );
|
||||
cl_showfps = Cvar_Get( "cl_showfps", "1", FCVAR_ARCHIVE, "show client fps" );
|
||||
cl_showpos = Cvar_Get( "cl_showpos", "0", FCVAR_ARCHIVE, "show local player position and velocity" );
|
||||
|
||||
// register our commands
|
||||
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
|
||||
@@ -853,6 +860,7 @@ void SCR_Shutdown( void )
|
||||
{
|
||||
if( !scr_init ) return;
|
||||
|
||||
Cmd_RemoveCommand( "timerefresh" );
|
||||
Cmd_RemoveCommand( "skyname" );
|
||||
Cmd_RemoveCommand( "viewpos" );
|
||||
UI_SetActiveMenu( false );
|
||||
|
||||
@@ -1,463 +0,0 @@
|
||||
/*
|
||||
cl_securedstub.c - secured client dll stub
|
||||
Copyright (C) 2022 FWGS
|
||||
|
||||
This program is free software: you can redistribute it and/or 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 your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
|
||||
typedef struct cldll_func_src_s
|
||||
{
|
||||
int (*pfnInitialize)( cl_enginefunc_t *pEnginefuncs, int iVersion );
|
||||
void (*pfnInit)( void );
|
||||
int (*pfnVidInit)( void );
|
||||
int (*pfnRedraw)( float flTime, int intermission );
|
||||
int (*pfnUpdateClientData)( client_data_t *cdata, float flTime );
|
||||
void (*pfnReset)( void );
|
||||
void (*pfnPlayerMove)( struct playermove_s *ppmove, int server );
|
||||
void (*pfnPlayerMoveInit)( struct playermove_s *ppmove );
|
||||
char (*pfnPlayerMoveTexture)( char *name );
|
||||
void (*IN_ActivateMouse)( void );
|
||||
void (*IN_DeactivateMouse)( void );
|
||||
void (*IN_MouseEvent)( int mstate );
|
||||
void (*IN_ClearStates)( void );
|
||||
void (*IN_Accumulate)( void );
|
||||
void (*CL_CreateMove)( float frametime, struct usercmd_s *cmd, int active );
|
||||
int (*CL_IsThirdPerson)( void );
|
||||
void (*CL_CameraOffset)( float *ofs ); // unused
|
||||
void *(*KB_Find)( const char *name );
|
||||
void (*CAM_Think)( void ); // camera stuff
|
||||
void (*pfnCalcRefdef)( ref_params_t *pparams );
|
||||
int (*pfnAddEntity)( int type, cl_entity_t *ent, const char *modelname );
|
||||
void (*pfnCreateEntities)( void );
|
||||
void (*pfnDrawNormalTriangles)( void );
|
||||
void (*pfnDrawTransparentTriangles)( void );
|
||||
void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity );
|
||||
void (*pfnPostRunCmd)( struct local_state_s *from, struct local_state_s *to, usercmd_t *cmd, int runfuncs, double time, unsigned int random_seed );
|
||||
void (*pfnShutdown)( void );
|
||||
void (*pfnTxferLocalOverrides)( entity_state_t *state, const clientdata_t *client );
|
||||
void (*pfnProcessPlayerState)( entity_state_t *dst, const entity_state_t *src );
|
||||
void (*pfnTxferPredictionData)( entity_state_t *ps, const entity_state_t *pps, clientdata_t *pcd, const clientdata_t *ppcd, weapon_data_t *wd, const weapon_data_t *pwd );
|
||||
void (*pfnDemo_ReadBuffer)( int size, byte *buffer );
|
||||
int (*pfnConnectionlessPacket)( const struct netadr_s *net_from, const char *args, char *buffer, int *size );
|
||||
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs );
|
||||
void (*pfnFrame)( double time );
|
||||
int (*pfnKey_Event)( int eventcode, int keynum, const char *pszCurrentBinding );
|
||||
void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ));
|
||||
cl_entity_t *(*pfnGetUserEntity)( int index );
|
||||
void (*pfnVoiceStatus)( int entindex, qboolean bTalking );
|
||||
void (*pfnDirectorMessage)( int iSize, void *pbuf );
|
||||
int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );
|
||||
void (*pfnChatInputPosition)( int *x, int *y );
|
||||
int (*pfnGetPlayerTeam)( int iPlayer );
|
||||
void *(*pfnClientFactory)( void );
|
||||
} cldll_func_src_t;
|
||||
|
||||
typedef struct cldll_func_dst_s
|
||||
{
|
||||
void (*pfnInitialize)( cl_enginefunc_t **pEnginefuncs, int *iVersion );
|
||||
void (*pfnInit)( void );
|
||||
void (*pfnVidInit)( void );
|
||||
void (*pfnRedraw)( float *flTime, int *intermission );
|
||||
void (*pfnUpdateClientData)( client_data_t **cdata, float *flTime );
|
||||
void (*pfnReset)( void );
|
||||
void (*pfnPlayerMove)( struct playermove_s **ppmove, int *server );
|
||||
void (*pfnPlayerMoveInit)( struct playermove_s **ppmove );
|
||||
void (*pfnPlayerMoveTexture)( char **name );
|
||||
void (*IN_ActivateMouse)( void );
|
||||
void (*IN_DeactivateMouse)( void );
|
||||
void (*IN_MouseEvent)( int *mstate );
|
||||
void (*IN_ClearStates)( void );
|
||||
void (*IN_Accumulate)( void );
|
||||
void (*CL_CreateMove)( float *frametime, struct usercmd_s **cmd, int *active );
|
||||
void (*CL_IsThirdPerson)( void );
|
||||
void (*CL_CameraOffset)( float **ofs );
|
||||
void (*KB_Find)( const char **name );
|
||||
void (*CAM_Think)( void );
|
||||
void (*pfnCalcRefdef)( ref_params_t **pparams );
|
||||
void (*pfnAddEntity)( int *type, cl_entity_t **ent, const char **modelname );
|
||||
void (*pfnCreateEntities)( void );
|
||||
void (*pfnDrawNormalTriangles)( void );
|
||||
void (*pfnDrawTransparentTriangles)( void );
|
||||
void (*pfnStudioEvent)( const struct mstudioevent_s **event, const cl_entity_t **entity );
|
||||
void (*pfnPostRunCmd)( struct local_state_s **from, struct local_state_s **to, usercmd_t **cmd, int *runfuncs, double *time, unsigned int *random_seed );
|
||||
void (*pfnShutdown)( void );
|
||||
void (*pfnTxferLocalOverrides)( entity_state_t **state, const clientdata_t **client );
|
||||
void (*pfnProcessPlayerState)( entity_state_t **dst, const entity_state_t **src );
|
||||
void (*pfnTxferPredictionData)( entity_state_t **ps, const entity_state_t **pps, clientdata_t **pcd, const clientdata_t **ppcd, weapon_data_t **wd, const weapon_data_t **pwd );
|
||||
void (*pfnDemo_ReadBuffer)( int *size, byte **buffer );
|
||||
void (*pfnConnectionlessPacket)( const struct netadr_s **net_from, const char **args, char **buffer, int **size );
|
||||
void (*pfnGetHullBounds)( int *hullnumber, float **mins, float **maxs );
|
||||
void (*pfnFrame)( double *time );
|
||||
void (*pfnKey_Event)( int *eventcode, int *keynum, const char **pszCurrentBinding );
|
||||
void (*pfnTempEntUpdate)( double *frametime, double *client_time, double *cl_gravity, struct tempent_s ***ppTempEntFree, struct tempent_s ***ppTempEntActive, int ( **Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( **Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ));
|
||||
void (*pfnGetUserEntity)( int *index );
|
||||
void (*pfnVoiceStatus)( int *entindex, qboolean *bTalking );
|
||||
void (*pfnDirectorMessage)( int *iSize, void **pbuf );
|
||||
void (*pfnGetStudioModelInterface)( int *version, struct r_studio_interface_s ***ppinterface, struct engine_studio_api_s **pstudio );
|
||||
void (*pfnChatInputPosition)( int **x, int **y );
|
||||
void (*pfnGetPlayerTeam)( int *iPlayer );
|
||||
} cldll_func_dst_t;
|
||||
|
||||
struct cl_enginefunc_dst_s;
|
||||
struct modshelpers_s;
|
||||
struct modchelpers_s;
|
||||
struct engdata_s;
|
||||
|
||||
typedef struct modfuncs_s
|
||||
{
|
||||
void (*m_pfnLoadMod)( char *pchModule );
|
||||
void (*m_pfnCloseMod)( void );
|
||||
int (*m_pfnNCall)( int ijump, int cnArg, ... );
|
||||
void (*m_pfnGetClDstAddrs)( cldll_func_dst_t *pcldstAddrs );
|
||||
void (*m_pfnGetEngDstAddrs)( struct cl_enginefunc_dst_s *pengdstAddrs );
|
||||
void (*m_pfnModuleLoaded)( void );
|
||||
void (*m_pfnProcessOutgoingNet)( struct netchan_s *pchan, struct sizebuf_s *psizebuf );
|
||||
qboolean (*m_pfnProcessIncomingNet)( struct netchan_s *pchan, struct sizebuf_s *psizebuf );
|
||||
void (*m_pfnTextureLoad)( char *pszName, int dxWidth, int dyHeight, char *pbData );
|
||||
void (*m_pfnModelLoad)( struct model_s *pmodel, void *pvBuf );
|
||||
void (*m_pfnFrameBegin)( void );
|
||||
void (*m_pfnFrameRender1)( void );
|
||||
void (*m_pfnFrameRender2)( void );
|
||||
void (*m_pfnSetModSHelpers)( struct modshelpers_s *pmodshelpers );
|
||||
void (*m_pfnSetModCHelpers)( struct modchelpers_s *pmodchelpers );
|
||||
void (*m_pfnSetEngData)( struct engdata_s *pengdata );
|
||||
int m_nVersion;
|
||||
void (*m_pfnConnectClient)( int iPlayer );
|
||||
void (*m_pfnRecordIP)( unsigned int pnIP );
|
||||
void (*m_pfnPlayerStatus)( unsigned char *pbData, int cbData );
|
||||
void (*m_pfnSetEngineVersion)( int nVersion );
|
||||
int m_nVoid2;
|
||||
int m_nVoid3;
|
||||
int m_nVoid4;
|
||||
int m_nVoid5;
|
||||
int m_nVoid6;
|
||||
int m_nVoid7;
|
||||
int m_nVoid8;
|
||||
int m_nVoid9;
|
||||
} modfuncs_t;
|
||||
|
||||
static void DstInitialize( cl_enginefunc_t **pEnginefuncs, int *iVersion )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstInit( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstVidInit( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstRedraw( float *flTime, int *intermission )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstUpdateClientData( client_data_t **cdata, float *flTime )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstReset( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstPlayerMove( struct playermove_s **ppmove, int *server )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstPlayerMoveInit( struct playermove_s **ppmove )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstPlayerMoveTexture( char **name )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstIN_ActivateMouse( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstIN_DeactivateMouse( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstIN_MouseEvent( int *mstate )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstIN_ClearStates( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstIN_Accumulate( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstCL_CreateMove( float *frametime, struct usercmd_s **cmd, int *active )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstCL_IsThirdPerson( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstCL_CameraOffset( float **ofs )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstKB_Find( const char **name )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstCAM_Think( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstCalcRefdef( ref_params_t **pparams )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstAddEntity( int *type, cl_entity_t **ent, const char **modelname )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstCreateEntities( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstDrawNormalTriangles( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstDrawTransparentTriangles( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstStudioEvent( const struct mstudioevent_s **event, const cl_entity_t **entity )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstPostRunCmd( struct local_state_s **from, struct local_state_s **to, usercmd_t **cmd, int *runfuncs, double *time, unsigned int *random_seed )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstShutdown( void )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstTxferLocalOverrides( entity_state_t **state, const clientdata_t **client )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstProcessPlayerState( entity_state_t **dst, const entity_state_t **src )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstTxferPredictionData( entity_state_t **ps, const entity_state_t **pps, clientdata_t **pcd, const clientdata_t **ppcd, weapon_data_t **wd, const weapon_data_t **pwd )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstDemo_ReadBuffer( int *size, byte **buffer )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstConnectionlessPacket( const struct netadr_s **net_from, const char **args, char **buffer, int **size )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstGetHullBounds( int *hullnumber, float **mins, float **maxs )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstFrame( double *time )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstKey_Event( int *eventcode, int *keynum, const char **pszCurrentBinding )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstTempEntUpdate( double *frametime, double *client_time, double *cl_gravity, struct tempent_s ***ppTempEntFree, struct tempent_s ***ppTempEntActive, int ( **Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( **Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstGetUserEntity( int *index )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstVoiceStatus( int *entindex, qboolean *bTalking )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstDirectorMessage( int *iSize, void **pbuf )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstGetStudioModelInterface( int *version, struct r_studio_interface_s ***ppinterface, struct engine_studio_api_s **pstudio )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstChatInputPosition( int **x, int **y )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static void DstGetPlayerTeam( int *iPlayer )
|
||||
{
|
||||
// stub
|
||||
}
|
||||
|
||||
static cldll_func_dst_t cldllFuncDst =
|
||||
{
|
||||
DstInitialize,
|
||||
DstInit,
|
||||
DstVidInit,
|
||||
DstRedraw,
|
||||
DstUpdateClientData,
|
||||
DstReset,
|
||||
DstPlayerMove,
|
||||
DstPlayerMoveInit,
|
||||
DstPlayerMoveTexture,
|
||||
DstIN_ActivateMouse,
|
||||
DstIN_DeactivateMouse,
|
||||
DstIN_MouseEvent,
|
||||
DstIN_ClearStates,
|
||||
DstIN_Accumulate,
|
||||
DstCL_CreateMove,
|
||||
DstCL_IsThirdPerson,
|
||||
DstCL_CameraOffset,
|
||||
DstKB_Find,
|
||||
DstCAM_Think,
|
||||
DstCalcRefdef,
|
||||
DstAddEntity,
|
||||
DstCreateEntities,
|
||||
DstDrawNormalTriangles,
|
||||
DstDrawTransparentTriangles,
|
||||
DstStudioEvent,
|
||||
DstPostRunCmd,
|
||||
DstShutdown,
|
||||
DstTxferLocalOverrides,
|
||||
DstProcessPlayerState,
|
||||
DstTxferPredictionData,
|
||||
DstDemo_ReadBuffer,
|
||||
DstConnectionlessPacket,
|
||||
DstGetHullBounds,
|
||||
DstFrame,
|
||||
DstKey_Event,
|
||||
DstTempEntUpdate,
|
||||
DstGetUserEntity,
|
||||
DstVoiceStatus,
|
||||
DstDirectorMessage,
|
||||
DstGetStudioModelInterface,
|
||||
DstChatInputPosition,
|
||||
DstGetPlayerTeam,
|
||||
};
|
||||
|
||||
void CL_GetSecuredClientAPI( CL_EXPORT_FUNCS F )
|
||||
{
|
||||
modfuncs_t modFuncs = { 0 };
|
||||
|
||||
// secured client dlls need these
|
||||
cldll_func_src_t cldllFuncSrc =
|
||||
{
|
||||
(void *)&modFuncs,
|
||||
NULL,
|
||||
(void *)&cldllFuncDst
|
||||
};
|
||||
|
||||
// trying to fill interface now
|
||||
F( &cldllFuncSrc );
|
||||
|
||||
// map exports to xash's cldll_func_t
|
||||
clgame.dllFuncs.pfnInitialize = cldllFuncSrc.pfnInitialize;
|
||||
clgame.dllFuncs.pfnInit = cldllFuncSrc.pfnInit;
|
||||
clgame.dllFuncs.pfnVidInit = cldllFuncSrc.pfnVidInit;
|
||||
clgame.dllFuncs.pfnRedraw = cldllFuncSrc.pfnRedraw;
|
||||
clgame.dllFuncs.pfnUpdateClientData = cldllFuncSrc.pfnUpdateClientData;
|
||||
clgame.dllFuncs.pfnReset = cldllFuncSrc.pfnReset;
|
||||
clgame.dllFuncs.pfnPlayerMove = cldllFuncSrc.pfnPlayerMove;
|
||||
clgame.dllFuncs.pfnPlayerMoveInit = cldllFuncSrc.pfnPlayerMoveInit;
|
||||
clgame.dllFuncs.pfnPlayerMoveTexture = cldllFuncSrc.pfnPlayerMoveTexture;
|
||||
clgame.dllFuncs.IN_ActivateMouse = cldllFuncSrc.IN_ActivateMouse;
|
||||
clgame.dllFuncs.IN_DeactivateMouse = cldllFuncSrc.IN_DeactivateMouse;
|
||||
clgame.dllFuncs.IN_MouseEvent = cldllFuncSrc.IN_MouseEvent;
|
||||
clgame.dllFuncs.IN_ClearStates = cldllFuncSrc.IN_ClearStates;
|
||||
clgame.dllFuncs.IN_Accumulate = cldllFuncSrc.IN_Accumulate;
|
||||
clgame.dllFuncs.CL_CreateMove = cldllFuncSrc.CL_CreateMove;
|
||||
clgame.dllFuncs.CL_IsThirdPerson = cldllFuncSrc.CL_IsThirdPerson;
|
||||
clgame.dllFuncs.CL_CameraOffset = cldllFuncSrc.CL_CameraOffset;
|
||||
clgame.dllFuncs.KB_Find = cldllFuncSrc.KB_Find;
|
||||
clgame.dllFuncs.CAM_Think = cldllFuncSrc.CAM_Think;
|
||||
clgame.dllFuncs.pfnCalcRefdef = cldllFuncSrc.pfnCalcRefdef;
|
||||
clgame.dllFuncs.pfnAddEntity = cldllFuncSrc.pfnAddEntity;
|
||||
clgame.dllFuncs.pfnCreateEntities = cldllFuncSrc.pfnCreateEntities;
|
||||
clgame.dllFuncs.pfnDrawNormalTriangles = cldllFuncSrc.pfnDrawNormalTriangles;
|
||||
clgame.dllFuncs.pfnDrawTransparentTriangles = cldllFuncSrc.pfnDrawTransparentTriangles;
|
||||
clgame.dllFuncs.pfnStudioEvent = cldllFuncSrc.pfnStudioEvent;
|
||||
clgame.dllFuncs.pfnPostRunCmd = cldllFuncSrc.pfnPostRunCmd;
|
||||
clgame.dllFuncs.pfnShutdown = cldllFuncSrc.pfnShutdown;
|
||||
clgame.dllFuncs.pfnTxferLocalOverrides = cldllFuncSrc.pfnTxferLocalOverrides;
|
||||
clgame.dllFuncs.pfnProcessPlayerState = cldllFuncSrc.pfnProcessPlayerState;
|
||||
clgame.dllFuncs.pfnTxferPredictionData = cldllFuncSrc.pfnTxferPredictionData;
|
||||
clgame.dllFuncs.pfnDemo_ReadBuffer = cldllFuncSrc.pfnDemo_ReadBuffer;
|
||||
clgame.dllFuncs.pfnConnectionlessPacket = cldllFuncSrc.pfnConnectionlessPacket;
|
||||
clgame.dllFuncs.pfnGetHullBounds = cldllFuncSrc.pfnGetHullBounds;
|
||||
clgame.dllFuncs.pfnFrame = cldllFuncSrc.pfnFrame;
|
||||
clgame.dllFuncs.pfnKey_Event = cldllFuncSrc.pfnKey_Event;
|
||||
clgame.dllFuncs.pfnTempEntUpdate = cldllFuncSrc.pfnTempEntUpdate;
|
||||
clgame.dllFuncs.pfnGetUserEntity = cldllFuncSrc.pfnGetUserEntity;
|
||||
clgame.dllFuncs.pfnVoiceStatus = cldllFuncSrc.pfnVoiceStatus;
|
||||
clgame.dllFuncs.pfnDirectorMessage = cldllFuncSrc.pfnDirectorMessage;
|
||||
clgame.dllFuncs.pfnGetStudioModelInterface = cldllFuncSrc.pfnGetStudioModelInterface;
|
||||
clgame.dllFuncs.pfnChatInputPosition = cldllFuncSrc.pfnChatInputPosition;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user