Quake Source Code Reading Analysis (1)

xiaoxiao2021-04-08  452

One of the Quake3 source code analysis ---- blind touch icon

If the quake3 is too complex, it will not touch melon. So only through the most original way, set up the VC, step by step, walk away. Read some things every day, it is also a good progress. 1, WinMain function command line parameter set sv_pure 0 set vm_cgame 0 set vm_game 0 set vm_ui 0 set r_fullscreen 0 where set vm_game 0, set vm_ui 0, set r_fullscreen 0 in window mode (non-full screen Run quake, and do not use virtual machine code in the PK3 file (VM Code, perhaps the efficiency will be relatively high, may be lib) but use the DLL corresponding to CGAME, GAME, UI. 2, Q_StrNCPYZ () function and standard Simpse in the library, but it checks if the parameter is empty, and the last word of the target buffer is set to ensure that other functions such as the PRINTF stream will not be offline. 3, the SYS_CREATECONSOLE function generates a window, Used to receive operational or error messages. There are two window functions INPUTLINEWNDPROC and CONWNDPROC. 4, the SYS_INITSTREAMTHREAD function is not used. The current run is not compiled. It is not going to study it. 5, COM_INIT functions ( 1) Note that the mechanism for processing exceptions in the C language is setjmp and longjmp, including another function com_error. (2) Introducing an important data structure COM_PUSHEDEVENTS structure. Com_pushedevents is an architecture, type SYSEVENT_T. It is defined as follows. : Typedef struct {int evting; Int evvalue, evvalue2; int evptrlength; // bytes of data pointd to by evptr, for journaling void * evptr; // this must b e manually freed if not NULL} sysEvent_t; wherein sysEventType_t defined as follows: typedef enum {SE_NONE = 0, // evTime is still valid SE_KEY, // evValue is a key code, evValue2 is the down flag SE_CHAR, // evValue is an ascii char SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127) SE_CONSOLE, // evPtr is a char * SE_PACKET // evPtr is a netadr_t followed by data bytes to evPtrLength} sysEventType_t; the annotation can be seen sysEventType_t sysEvent_t a description of the data corresponding to access instructions, this is a description of each field, and what is the meaning com_pushedEventsHead com_pushedEventsTail are inclusive of the above position of the array. A tag. (3) com_initsmallzoneMemory ();

转载请注明原文地址:https://www.9cbs.com/read-132824.html

New Post(0)