Can someone help me compile this QVM?

I don’t have a development environment so can someone help me compile this?(

u do: a fucking text editor.

here go the tales. the files uploaded here r patches — they’re served as „.cfg” files because this forum system sux —, u should apply each of them (except the crossed-out one).

u said that u want to compile a „QVM”. obviously, that is to be enabled.

request the QVMs compilation target

for me, the QVM compilation process failed during the Q3CPP part, which was silently segfaulting. i was able to get it to work by compiling Q3CPP without optimizations. this PROBLEM is probably already fixed in a recent version of the tools, but i’ll look at the root of the PROBLEM S00N™. until then…

disable optimizations for the compilation of some tools (Q3CPP)

ind33d, that was a bug that was fixed 3.5 years ago.

import a fix for a QVM tool segfault

compilation failed for a number of reasons.

LCC, the C compiler used for compilation into QVMs format, is a bit flaky, and is for C891 (the technical standard of C defined around 1989).

  • stack variables may not be defined after a non-variable-defining statement in a block (local variables must be defined at beginning of each block).

1 M$'s C compiler also sux in this regard.

fix QVM compilation, part 1: move variable declarations to the beginning of
the code block

  • ; may not be placed after function bodies.
  • all function definitions r global, the static specifier does not restrict the function to the file — this may cause correct code to fail due to multiple function definitions.

fix QVM compilation, part 2: other stuff

there were also a lot of compiler warnings.

as u should have been told by the compiler, ptr == "STR" is not a well-defined expression, because the memory address of each occurrence of “STR” may be different. ie., "STR" == "STR" may even be false ! for strings, character-based comparison functions should be used, eg. !strcmp(ptr, "STR"). also, memset(ptr, 0, sizeof(*ptr)) is the correct way to use memset() on a pointer.

fix comparisons with string literals; fix a memset() call

generally, other warnings should also be fixed. warnings often mean that the code will run badly on some platform, so one should fix them. notably, printf("%i", (int)(ent-g_entities)) (the type of ent-g_entities is ptrdiff_t, which is an int or a long int; force it to an int when specifying %i) is a good way to print an entity’s number (printf("%ti", ent-g_entities) (%ti is exactly for ptrdiff_t) would be the PROPER one, but i’ve heard that that will make M$'s compiler shit itself).

fix a bunch of compiler warnings

finally, there was a key issue with the organization of dretch-stomping battlesuit footstep-attack code.

the BG („both games”) component (the src/game/bg_<…> set of files) contains — and may reference only — (gamelogic-specific) code that is common to the cgame and game modules; this code runs both on the clients and servers. code such as single-player movement physics belongs here: the cgame uses it to „predict” the same calculations on the game side. code such as non-player entity behavioral logic and damage calculations do not belong here, these belong only to the game module. as such, functions like FootStepAttack() must not be placed there − if it calls gamemodule-specific functions, it will fail to compile as part of the cgame module. however, u could get away with putting there code that is wrapped between #ifdef GAME and #endif.

one way to bring together playermovement-related logic with gamemodule-specific effects, is to have events generated by the BG code, and have the game module process them (in a gamemodule-specific way). in this case, it is customary to define a new event type, EV_FOOTJOB.

perform footjob — this has not been reviewed or tested, but at least it compiles.

however, unfortunately, in this way, a lot of useless — and network-transmitted — events get generated. maybe one should really use the ifdef GAME #endif hack, or implement a BG function that exports non-network-transmitted events.


ind33d, that was a bug that was fixed 3.5 years ago.

i updated the post too, there’s a new patch.




OH, I sorta forgot about it. I’ll give it a try sometime tomorrow :slight_smile: