def sys_get_path(type): """ :return: None if not found """ if type == 'PATH_BASE': if os.path.exists(BUILD_DATADIR): return BUILD_DATADIR logging.warning('base path ' + BUILD_DATADIR + ' does not exist') # id: try next to the executable.. exe_path = sys_get_path('PATH_EXE') if exe_path: path = os.path.join(exe_path, BASE_GAMEDIR) if os.path.exists(path): logging.warning('using path of executable: ' + exe_path) return path # id: allback to vanilla doom3 install if get_os() == 'linux': os_path = LINUX_DEFAULT_PATH else: not_implemented_log('default path for win') if os.path.exists(os_path): logging.warning('using hardcoded path:' + os_path) return os_path return None elif type == 'PATH_CONFIG': if get_os() == 'linux': s = os.getenv('XDG_CONFIG_HOME', None) if s: return s + '/shuka' else: return os.getenv('HOME') + '/.config/shuka' else: not_implemented_log('default path for win') elif type == 'PATH_SAVE': if get_os() == 'linux': s = os.getenv('XDG_DATA_HOME', None) if s: return s + '/shuka' else: return os.getenv('HOME') + '/.local/share/shuka' else: not_implemented_log('default path for win') elif type == 'PATH_EXE': if get_os() == 'linux': buf = '/proc/' + str(os.getpid()) + '/exe' buf2 = os.readlink(buf) if buf2: return buf2 return os.path.dirname(sys.argv[0]) else: not_implemented_log('default path for win') return None
def __init__(self, name, value, flags, description, value_strings=None, value_min=1, value_max=-1, value_completion=None): self.name = name self.value = value self.flags = flags self.description = description self.flags = flags | CVAR_FLAGS['CVAR_STATIC'] self.value_min = value_min self.value_max = value_max self.value_strings = value_strings self.valueCompletion = value_completion self.int_value = 0 self.float_value = 0.0 self.integer_var = self not_implemented_log('var init')
def init(self): # id : clear all our internal state self.view_count = 1 # id : so cleared structures never match viewCount # id: we used to memset tr, but now that it is a class, we can't, so # id: there may be other state we need to reset self.ambient_light_vector = np.array([0.5, 0.5 - 0.385, 0.8925, 1.0]) # memset( &backEnd, 0, sizeof( backEnd ) ); not_implemented_log('R_InitCVars(), R_InitCommands()') not_implemented_log('gui, cinematic, etc.') not_implemented_log('render Model Manager') # id: set the identity space self.identity_space.model_matrix[0 * 4] = 1.0 self.identity_space.model_matrix[1 * 4 + 1] = 1.0 self.identity_space.model_matrix[2 * 4 + 2] = 1.0
def init(self): not_implemented_log('Cmd System Init')
def add_command(self, *args): not_implemented_log('add_command')
def sys_generate_events(): not_implemented_log('sys_console_input in sys_generated_events') s = None #sys_console_input() if s: push_console_event(s) SDL_PumpEvents()
def sys_get_event(): global _kdb_polls global _mouse_polls res_none = SysEvent() res_none.event_type = 'SE_NONE' s = [0] s_pos = 0 ev = SDL_Event() while SDL_PollEvent(ctypes.byref(ev)) != 0: if ev.type == SDL_WINDOWEVENT: if ev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED: # id: unset modifier, in case alt-tab was used to leave window and ALT is still set # id: as that can cause fullscreen-toggling when pressing enter... currentmod = SDL_GetModState() newmod = KEY_NUMS['KMOD_NONE'] if (currentmod & KMOD_CAPS): # id: preserve capslock newmod |= KMOD_CAPS SDL_SetModState(newmod) if ev.window.event == SDL_WINDOWEVENT_FOCUS_LOST: """ GLimp_GrabInput(0); break; """ raise NotImplementedError() continue if ev.type == SDL_KEYDOWN: flags = 0 if ev.key.keysym.sym == SDLK_RETURN and ( ev.key.keysym.mod & KEY_NUMS['KMOD_ALT']) > 0: not_implemented_log( 'cvarSystem.set_cvar_bool("r_fullscreen", not renderSystem->IsFullScreen())' ) #cvarSystem.set_cvar_bool("r_fullscreen", not renderSystem->IsFullScreen()) push_console_event("vid_restart") return res_none if ev.type == SDL_KEYUP: key = map_key(ev.key.keysym.sym) if not key: # id: check if its an unmapped console key c = sys_get_console_key(False) if (ev.key.keysym.unicode == c): key = c else: c = sys_get_console_key(True) if (ev.key.keysym.unicode == c): key = c else: logging.error('unmapped key:' + str(ev.key.keysym.sym)) continue res = SysEvent() res.event_type = 'SE_KEY' res.event_value = key res.event_value2 = 1 if ev.key.state != SDL_PRESSED: res.event_value2 = 0 _kbd_polls.append(_KbdPoll(key, ev.key.state == SDL_PRESSED)) return res if ev.type == SDL_TEXTINPUT: if ev.text.text[0]: res = SysEvent() res.event_type = 'SE_CHAR' res.event_value = ev.text.text[0] if ev.text.text[1] != '\0': s = ev.text.text[:] raise NotImplementedError() if ev.type == SDL_TEXTEDITING: # id: on windows we get this event whenever the window gains focus.. just ignore it. continue if ev.type == SDL_MOUSEMOTION: res = SysEvent() res.event_type = 'SE_MOUSE' res.event_value = ev.motion.xrel res.event_value2 = ev.motion.yrel _mouse_polls.append(_MousePoll('M_DELTAX', ev.motion.xrel)) _mouse_polls.append(_MousePoll('M_DELTAY', ev.motion.yrel)) return res if ev.type == SDL_MOUSEWHEEL: res = SysEvent() res.event_type = 'SE_KEY' if ev.wheel.y > 0: res.event_value = KEY_NUMS['K_MWHEELUP'] _mouse_polls.append(_MousePoll('M_DELTAZ', 1)) else: res.event_value = KEY_NUMS['K_MWHEELDOWN'] _mouse_polls.append(_MousePoll('M_DELTAZ', -1)) res.event_value2 = 1 return res if ev.type in [SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP]: res = SysEvent() res.event_type = 'SE_KEY' pressed = ev.button.state == SDL_PRESSED if pressed: pressed = 1 else: pressed = 0 if ev.button.button == SDL_BUTTON_LEFT: res.event_value = KEY_NUMS['K_MOUSE1'] _mouse_polls.append(_MousePoll('M_ACTION1', pressed)) if ev.button.button == SDL_BUTTON_MIDDLE: res.event_value = KEY_NUMS['K_MOUSE3'] _mouse_polls.append(_MousePoll('M_ACTION1', pressed)) if ev.button.button == SDL_BUTTON_RIGHT: res.event_value = KEY_NUMS['K_MOUSE2'] _mouse_polls.append(_MousePoll('M_ACTION1', pressed)) return res # TODO: forgot one section if ev.type == SDL_QUIT: push_console_event("quit") return res_none if ev.type == SDL_USEREVENT: if ev.user.code == 'SE_CONSOLE': res = SysEvent() res.event_type = 'SE_CONSOLE' res.event_ptr_len = len(ev.user.data1) res.event_pointer = ev.user.data2 return res else: logging.warning("unknown user event {0}".format( str(ev.user.code))) continue else: # debug # id: ok, I don't /really/ care about unknown SDL events. only uncomment this for debugging. # id: common->Warning("unknown SDL event 0x%x", ev.type); continue # id: handle next event return res_none
def init(self): not_implemented_log('cvar init')
def init(self): not_implemented_log('key input init')