mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-24 21:02:26 +00:00
up2 wanted one.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1936 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
cf73c8b81e
commit
2e06035ee3
6 changed files with 344 additions and 0 deletions
20
plugins/namemaker/compile.bat
Normal file
20
plugins/namemaker/compile.bat
Normal file
|
@ -0,0 +1,20 @@
|
|||
@echo off
|
||||
call ..\paths.bat
|
||||
|
||||
del vm\*.asm
|
||||
rmdir vm
|
||||
mkdir vm
|
||||
cd vm
|
||||
lcc -DQ3_VM -S -Wf-target=bytecode -Wf-g ../namemaker.c
|
||||
if errorlevel 1 goto end
|
||||
lcc -DQ3_VM -S -Wf-target=bytecode -Wf-g ../../plugin.c
|
||||
if errorlevel 1 goto end
|
||||
lcc -DQ3_VM -S -Wf-target=bytecode -Wf-g ../../qvm_api.c
|
||||
if errorlevel 1 goto end
|
||||
q3asm -f ../namemaker
|
||||
|
||||
:end
|
||||
|
||||
cd ..
|
||||
|
||||
pause
|
5
plugins/namemaker/install.bat
Normal file
5
plugins/namemaker/install.bat
Normal file
|
@ -0,0 +1,5 @@
|
|||
@echo off
|
||||
call ..\paths.bat
|
||||
mkdir %PluginsDir%
|
||||
copy vm\namemaker.qvm %PluginsDir%
|
||||
pause
|
163
plugins/namemaker/namemaker.c
Normal file
163
plugins/namemaker/namemaker.c
Normal file
|
@ -0,0 +1,163 @@
|
|||
#include "../plugin.h"
|
||||
|
||||
int K_UPARROW;
|
||||
int K_DOWNARROW;
|
||||
int K_LEFTARROW;
|
||||
int K_RIGHTARROW;
|
||||
int K_ESCAPE;
|
||||
int K_MOUSE1;
|
||||
int K_MOUSE2;
|
||||
int K_HOME;
|
||||
int K_SHIFT;
|
||||
int K_MWHEELDOWN;
|
||||
int K_MWHEELUP;
|
||||
int K_PAGEUP;
|
||||
int K_PAGEDOWN;
|
||||
|
||||
qhandle_t con_chars;
|
||||
qhandle_t pic_cursor;
|
||||
|
||||
float drawscalex;
|
||||
float drawscaley;
|
||||
|
||||
unsigned char namebuffer[256];
|
||||
|
||||
void LoadPics(void)
|
||||
{
|
||||
char buffer[256];
|
||||
|
||||
//main bar (add cvars later)
|
||||
con_chars = Draw_LoadImage("conchars", false);
|
||||
Cvar_GetString("cl_cursor", buffer, sizeof(buffer));
|
||||
pic_cursor = Draw_LoadImage(buffer, false);
|
||||
}
|
||||
|
||||
void DrawChar(unsigned int c, int x, int y)
|
||||
{
|
||||
static float size = 1.0f/16.0f;
|
||||
float s1 = size * (c&15);
|
||||
float t1 = size * (c>>4);
|
||||
Draw_Image((float)x*drawscalex, y*drawscaley, 16*drawscalex, 16*drawscaley, s1, t1, s1+size, t1+size, con_chars);
|
||||
}
|
||||
|
||||
void KeyPress(int key, int mx, int my)
|
||||
{
|
||||
int newchar;
|
||||
int oldlen;
|
||||
if (key == K_ESCAPE)
|
||||
{
|
||||
Menu_Control(0);
|
||||
Cvar_SetString("name", (char*)namebuffer);
|
||||
}
|
||||
else if (key == K_MOUSE1)
|
||||
{
|
||||
mx -= ((640 - (480-16))/2);
|
||||
my -= 16;
|
||||
mx /= (480-16)/16;
|
||||
my /= (480-16)/16;
|
||||
Con_Printf("%i, %i\n", mx, my);
|
||||
|
||||
oldlen = strlen(namebuffer);
|
||||
if (oldlen + 1 == sizeof(namebuffer))
|
||||
return;
|
||||
|
||||
newchar = (int)mx + (int)my * 16;
|
||||
namebuffer[oldlen] = newchar;
|
||||
namebuffer[oldlen+1] = 0;
|
||||
}
|
||||
else if (key == K_MOUSE2)
|
||||
{
|
||||
if (namebuffer[0])
|
||||
namebuffer[strlen(namebuffer)-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int Plug_MenuEvent(int *args)
|
||||
{
|
||||
int i;
|
||||
drawscalex = vid.width/640.0f;
|
||||
drawscaley = vid.height/480.0f;
|
||||
|
||||
args[2]=(int)(args[2]/drawscalex);
|
||||
args[3]=(int)(args[3]/drawscaley);
|
||||
|
||||
switch(args[0])
|
||||
{
|
||||
case 0: //draw
|
||||
|
||||
Draw_Colour4f(1,1,1,1);
|
||||
|
||||
Draw_Image(((640 - (480-16))/2)*drawscalex, 16*drawscaley, (480-16)*drawscalex, (480-16)*drawscaley, 0, 0, 1, 1, con_chars);
|
||||
|
||||
for (i = 0; namebuffer[i]; i++)
|
||||
DrawChar(namebuffer[i], i*16, 0);
|
||||
|
||||
if (!pic_cursor)
|
||||
DrawChar('+', args[2], args[3]);
|
||||
else
|
||||
Draw_Image((float)args[2]*drawscalex, (float)args[3]*drawscaley, (float)32*drawscalex, (float)32*drawscaley, 0, 0, 1, 1, pic_cursor);
|
||||
break;
|
||||
case 1: //keydown
|
||||
KeyPress(args[1], args[2], args[3]);
|
||||
break;
|
||||
case 2: //keyup
|
||||
break;
|
||||
case 3: //menu closed (this is called even if we change it).
|
||||
break;
|
||||
case 4: //mousemove
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Plug_Tick(int *args)
|
||||
{
|
||||
// currenttime = args[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
int Plug_ExecuteCommand(int *args)
|
||||
{
|
||||
char cmd[256];
|
||||
Cmd_Argv(0, cmd, sizeof(cmd));
|
||||
if (!strcmp("namemaker", cmd))
|
||||
{
|
||||
Menu_Control(1);
|
||||
Cvar_GetString("name", (char*)namebuffer, sizeof(namebuffer));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Plug_Init(int *args)
|
||||
{
|
||||
if (Plug_Export("Tick", Plug_Tick) &&
|
||||
// Plug_Export("SbarBase", UI_StatusBar) &&
|
||||
// Plug_Export("SbarOverlay", UI_ScoreBoard) &&
|
||||
Plug_Export("ExecuteCommand", Plug_ExecuteCommand) &&
|
||||
Plug_Export("MenuEvent", Plug_MenuEvent))
|
||||
{
|
||||
|
||||
K_UPARROW = Key_GetKeyCode("uparrow");
|
||||
K_DOWNARROW = Key_GetKeyCode("downarrow");
|
||||
K_LEFTARROW = Key_GetKeyCode("leftarrow");
|
||||
K_RIGHTARROW = Key_GetKeyCode("rightarrow");
|
||||
K_ESCAPE = Key_GetKeyCode("escape");
|
||||
K_HOME = Key_GetKeyCode("home");
|
||||
K_MOUSE1 = Key_GetKeyCode("mouse1");
|
||||
K_MOUSE2 = Key_GetKeyCode("mouse2");
|
||||
K_MWHEELDOWN = Key_GetKeyCode("mwheeldown");
|
||||
K_MWHEELUP = Key_GetKeyCode("mwheelup");
|
||||
K_SHIFT = Key_GetKeyCode("shift");
|
||||
K_PAGEUP = Key_GetKeyCode("pgup");
|
||||
K_PAGEDOWN = Key_GetKeyCode("pgdn");
|
||||
|
||||
Cmd_AddCommand("namemaker");
|
||||
|
||||
LoadPics();
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
123
plugins/namemaker/namemaker.dsp
Normal file
123
plugins/namemaker/namemaker.dsp
Normal file
|
@ -0,0 +1,123 @@
|
|||
# Microsoft Developer Studio Project File - Name="namemaker" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=namemaker - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "namemaker.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "namemaker.mak" CFG="namemaker - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "namemaker - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "namemaker - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "namemaker - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "namemaker_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "namemaker_EXPORTS" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../namemakerx86.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "namemaker - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "namemaker_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "namemaker_EXPORTS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /out:"D:\Quake\id1\plugins/namemakerx86.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "namemaker - Win32 Release"
|
||||
# Name "namemaker - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\plugin.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\qvm_api.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ui_sbar.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\plugin.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\plugin.def
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
plugins/namemaker/namemaker.dsw
Normal file
29
plugins/namemaker/namemaker.dsw
Normal file
|
@ -0,0 +1,29 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "namemaker"=.\namemaker.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
4
plugins/namemaker/namemaker.q3asm
Normal file
4
plugins/namemaker/namemaker.q3asm
Normal file
|
@ -0,0 +1,4 @@
|
|||
-o "namemaker"
|
||||
plugin
|
||||
namemaker
|
||||
qvm_api
|
Loading…
Reference in a new issue