├── classes.doc ├── Neko98 ├── Neko95.rc ├── Neko98.suo ├── Res │ ├── Up1.ico │ ├── Up2.ico │ ├── Awake.ico │ ├── Down1.ico │ ├── Right1.ico │ ├── down2.ico │ ├── fp_up.ico │ ├── left1.ico │ ├── left2.ico │ ├── right2.ico │ ├── sleep1.ico │ ├── sleep2.ico │ ├── wash2.ico │ ├── yawn2.ico │ ├── yawn3.ico │ ├── Downleft2.ico │ ├── Upleft1.ico │ ├── Upleft2.ico │ ├── Upright1.ico │ ├── Upright2.ico │ ├── downclaw1.ico │ ├── downclaw2.ico │ ├── downleft1.ico │ ├── fp_down.ico │ ├── fp_left.ico │ ├── fp_right.ico │ ├── fp_upleft.ico │ ├── leftclaw1.ico │ ├── leftclaw2.ico │ ├── scratch1.ico │ ├── scratch2.ico │ ├── upclaw1.ico │ ├── upclaw2.ico │ ├── Downright1.ico │ ├── Rightclaw2.ico │ ├── downright2.ico │ ├── fp_downleft.ico │ ├── fp_upright.ico │ ├── rightclaw1.ico │ └── fp_downright.ico ├── NekoCFG │ ├── NekoCFG.rc │ ├── Res │ │ ├── play.bmp │ │ ├── sounds.ico │ │ ├── AppIcon.ico │ │ ├── displayi.ico │ │ ├── movement.ico │ │ ├── playing.cur │ │ ├── tab_effects.ico │ │ └── independence.ico │ ├── NekoCFG.h │ ├── NekoCFG_resource.hm │ ├── NekoCFG.vcxproj.filters │ ├── NekoCFG.dsp │ ├── NekoCFG_resource.h │ ├── NekoCFG.vcproj │ ├── NekoCFG.vcxproj │ └── NekoCFG.cpp ├── NekoHelp │ ├── Neko98.GID │ └── Neko98.HPJ ├── NekoSettings.h ├── Tray.h ├── DesktopPet.h ├── Neko98.dsw ├── DesktopHack.h ├── NekoCommon.h ├── Pet.h ├── Tray.cpp ├── Neko98.sln ├── AlwaysOnTopPet.h ├── NekoSettings.cpp ├── DesktopPet.cpp ├── Neko.h ├── resource.h ├── Pet.cpp ├── DesktopHack.cpp ├── Neko98.vcxproj.filters ├── Neko98.cpp ├── Neko98.dsp ├── AlwaysOnTopPet.cpp ├── Neko98.vcproj ├── Neko98.vcxproj └── Neko.cpp ├── README.md └── license.txt /classes.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/classes.doc -------------------------------------------------------------------------------- /Neko98/Neko95.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Neko95.rc -------------------------------------------------------------------------------- /Neko98/Neko98.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Neko98.suo -------------------------------------------------------------------------------- /Neko98/Res/Up1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Up1.ico -------------------------------------------------------------------------------- /Neko98/Res/Up2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Up2.ico -------------------------------------------------------------------------------- /Neko98/Res/Awake.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Awake.ico -------------------------------------------------------------------------------- /Neko98/Res/Down1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Down1.ico -------------------------------------------------------------------------------- /Neko98/Res/Right1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Right1.ico -------------------------------------------------------------------------------- /Neko98/Res/down2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/down2.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_up.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_up.ico -------------------------------------------------------------------------------- /Neko98/Res/left1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/left1.ico -------------------------------------------------------------------------------- /Neko98/Res/left2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/left2.ico -------------------------------------------------------------------------------- /Neko98/Res/right2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/right2.ico -------------------------------------------------------------------------------- /Neko98/Res/sleep1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/sleep1.ico -------------------------------------------------------------------------------- /Neko98/Res/sleep2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/sleep2.ico -------------------------------------------------------------------------------- /Neko98/Res/wash2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/wash2.ico -------------------------------------------------------------------------------- /Neko98/Res/yawn2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/yawn2.ico -------------------------------------------------------------------------------- /Neko98/Res/yawn3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/yawn3.ico -------------------------------------------------------------------------------- /Neko98/Res/Downleft2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Downleft2.ico -------------------------------------------------------------------------------- /Neko98/Res/Upleft1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Upleft1.ico -------------------------------------------------------------------------------- /Neko98/Res/Upleft2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Upleft2.ico -------------------------------------------------------------------------------- /Neko98/Res/Upright1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Upright1.ico -------------------------------------------------------------------------------- /Neko98/Res/Upright2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Upright2.ico -------------------------------------------------------------------------------- /Neko98/Res/downclaw1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/downclaw1.ico -------------------------------------------------------------------------------- /Neko98/Res/downclaw2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/downclaw2.ico -------------------------------------------------------------------------------- /Neko98/Res/downleft1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/downleft1.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_down.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_down.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_left.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_left.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_right.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_right.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_upleft.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_upleft.ico -------------------------------------------------------------------------------- /Neko98/Res/leftclaw1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/leftclaw1.ico -------------------------------------------------------------------------------- /Neko98/Res/leftclaw2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/leftclaw2.ico -------------------------------------------------------------------------------- /Neko98/Res/scratch1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/scratch1.ico -------------------------------------------------------------------------------- /Neko98/Res/scratch2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/scratch2.ico -------------------------------------------------------------------------------- /Neko98/Res/upclaw1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/upclaw1.ico -------------------------------------------------------------------------------- /Neko98/Res/upclaw2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/upclaw2.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/NekoCFG.rc -------------------------------------------------------------------------------- /Neko98/NekoHelp/Neko98.GID: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoHelp/Neko98.GID -------------------------------------------------------------------------------- /Neko98/NekoHelp/Neko98.HPJ: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoHelp/Neko98.HPJ -------------------------------------------------------------------------------- /Neko98/Res/Downright1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Downright1.ico -------------------------------------------------------------------------------- /Neko98/Res/Rightclaw2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/Rightclaw2.ico -------------------------------------------------------------------------------- /Neko98/Res/downright2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/downright2.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_downleft.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_downleft.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_upright.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_upright.ico -------------------------------------------------------------------------------- /Neko98/Res/rightclaw1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/rightclaw1.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/play.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/play.bmp -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/sounds.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/sounds.ico -------------------------------------------------------------------------------- /Neko98/Res/fp_downright.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/Res/fp_downright.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/AppIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/AppIcon.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/displayi.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/displayi.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/movement.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/movement.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/playing.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/playing.cur -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/tab_effects.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/tab_effects.ico -------------------------------------------------------------------------------- /Neko98/NekoCFG/Res/independence.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neozeed/neko98/HEAD/Neko98/NekoCFG/Res/independence.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # neko98 2 | 3 | This is the old source I found a while back, that I made a single line change to get it running on later (and earlier) versions of Visual C++. Ive been able to compile this with Visual C++ 4.0 for MIPS/PowerPC/DecAlpha & i386, 2010 for the Itanium and 2019 for the ARM. 4 | 5 | I take no responsiblity for this, as I just changed a single line. 6 | -------------------------------------------------------------------------------- /Neko98/NekoSettings.h: -------------------------------------------------------------------------------- 1 | /************************************ 2 | 3 | Neko's configuration header file 4 | 5 | *************************************/ 6 | 7 | #define WIN32_LEAN_AND_MEAN 8 | #include 9 | #include "NekoCommon.h" 10 | 11 | class CNekoSettings { 12 | public: 13 | CNekoSettings( LPCSTR key, BOOL fCreate = TRUE ); 14 | ~CNekoSettings(); 15 | 16 | BOOL IsOpen(); 17 | 18 | BOOL GetString( LPCSTR keyname, LPSTR result, ULONG size ); 19 | BOOL GetInt( LPCSTR keyname, DWORD * result ); 20 | BOOL GetBool( LPCSTR keyname, BOOL * result ); 21 | 22 | BOOL SetString( LPCSTR keyname, LPSTR value ); 23 | BOOL SetInt( LPCSTR keyname, DWORD value ); 24 | BOOL SetBool( LPCSTR keyname, BOOL value ); 25 | 26 | private: 27 | HKEY m_hKey; 28 | }; 29 | -------------------------------------------------------------------------------- /Neko98/Tray.h: -------------------------------------------------------------------------------- 1 | /************************************ 2 | 3 | Tray Class: Very simple interface 4 | onto the system tray 5 | 6 | *************************************/ 7 | 8 | #ifndef _TRAY_HPP 9 | #define _TRAY_HPP 10 | 11 | #define WIN32_LEAN_AND_MEAN 12 | #include 13 | 14 | //taskbar notification message 15 | #define MY_NOTIFYICON (WM_USER+32) 16 | 17 | 18 | class CTray { 19 | 20 | public: 21 | CTray( HINSTANCE hInstance ) { m_uIconCount = 0; m_hInstance = hInstance; }; 22 | 23 | BOOL AddIcon( HWND hWnd, HICON hIcon, UINT uID ); 24 | BOOL RemoveIcon( HWND hWnd, UINT uID ); 25 | 26 | void ShowPopupMenu( HWND hWnd ); 27 | 28 | UINT GetCount() { return m_uIconCount; }; 29 | 30 | private: 31 | UINT m_uIconCount; 32 | HINSTANCE m_hInstance; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Neko98/DesktopPet.h: -------------------------------------------------------------------------------- 1 | // DesktopPet.h: interface for the CDesktopPet class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_DESKTOPPET_H__A69EBAA3_385D_11D2_9FF9_00001C192944__INCLUDED_) 6 | #define AFX_DESKTOPPET_H__A69EBAA3_385D_11D2_9FF9_00001C192944__INCLUDED_ 7 | 8 | #if _MSC_VER >= 1000 9 | #pragma once 10 | #endif // _MSC_VER >= 1000 11 | 12 | #include "Pet.h" 13 | #include "DesktopHack.h" 14 | 15 | class CDesktopPet : public CDesktopHack, virtual public CPet 16 | { 17 | public: 18 | CDesktopPet(); 19 | virtual ~CDesktopPet(); 20 | 21 | virtual void DrawOnTarget( int x, int y, HICON hIcon ); 22 | 23 | protected: 24 | int m_nUpdateHWndCounter; 25 | virtual void Erase(); 26 | virtual void Draw( int nImage ); 27 | }; 28 | 29 | #endif // !defined(AFX_DESKTOPPET_H__A69EBAA3_385D_11D2_9FF9_00001C192944__INCLUDED_) 30 | -------------------------------------------------------------------------------- /Neko98/Neko98.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "Neko98"=".\Neko98.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "NekoCFG"=".\NekoCFG\NekoCFG.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Global: 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<3> 37 | {{{ 38 | }}} 39 | 40 | ############################################################################### 41 | 42 | -------------------------------------------------------------------------------- /Neko98/DesktopHack.h: -------------------------------------------------------------------------------- 1 | // DesktopHack.h: interface for the CDesktopHack class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_DESKTOPHACK_H__A69EBAA1_385D_11D2_9FF9_00001C192944__INCLUDED_) 6 | #define AFX_DESKTOPHACK_H__A69EBAA1_385D_11D2_9FF9_00001C192944__INCLUDED_ 7 | 8 | #if _MSC_VER >= 1000 9 | #pragma once 10 | #endif // _MSC_VER >= 1000 11 | 12 | #define WIN32_LEAN_AND_MEAN 13 | #include 14 | 15 | class CDesktopHack 16 | { 17 | public: 18 | void GetDesktopRect( RECT& rcDesktop ); 19 | void FindDesktopHandle(); 20 | CDesktopHack(); 21 | virtual ~CDesktopHack(); 22 | 23 | protected: 24 | HWND m_hWndDesktop; 25 | 26 | BOOL m_fActiveDesktop; //the desktop is an active (web) desktop 27 | BOOL m_fNoChicagoDesktop; //the desktop is not a windows 95/nt4 desktop 28 | 29 | }; 30 | 31 | #endif // !defined(AFX_DESKTOPHACK_H__A69EBAA1_385D_11D2_9FF9_00001C192944__INCLUDED_) 32 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Neko 95/98 Source Code License 2 | 3 | Note: Because Neko was originally written by 4 | Masayuki Koba, and ported from his X-Windows 5 | source code by David Harvey, different portions 6 | of the Neko source code carry different licenses. 7 | 8 | 9 | IF YOU WANT TO CHARGE FOR YOUR SOFTWARE 10 | --------------------------------------- 11 | If you use any of the following files in your software, 12 | you MAY NOT charge for it as it is covered by the GNU 13 | public license: 14 | Neko.h Neko.cpp 15 | Neko98.h Neko98.cpp 16 | 17 | 18 | If you use any of the following files in your software, 19 | you MAY charge for it, but must send 20% of the profit or 20 | from that software, or $1000 to the author (address at the bottom). 21 | Pet.h Pe1t.cpp 22 | DesktopHack.h DesktopHack.cpp 23 | DesktopPet.h DesktopPet.cpp 24 | AlwaysOnTopPet.h AlwaysOnTopPet.cpp 25 | 26 | 27 | All other files can be used freely as long as credit is given. 28 | 29 | 30 | IF YOU DO NOT WANT TO CHARGE FOR YOUR SOFTWARE 31 | ---------------------------------------------- 32 | You are free to use the source files in any way you wish, 33 | as long as credit is given. 34 | 35 | 36 | AUTHOR'S ADDRESS 37 | ---------------- 38 | dharvey@btinternet.com 39 | For security reasons, mail me and I'll give out my address. 40 | 41 | 42 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.h: -------------------------------------------------------------------------------- 1 | #ifndef _NEKOCFG_H 2 | #define _NEKOCFG_H 3 | 4 | #include "..\NekoCommon.h" 5 | 6 | //structures 7 | typedef struct tagTABINITDATA { 8 | char* szTitle; 9 | UINT uIDDialog; 10 | DLGPROC lpfnDlgProc; 11 | UINT uIDIcon; 12 | HWND hDlg; 13 | } TABINITDATA, *LPTABINITDATA; 14 | 15 | typedef struct tagCATSETTINGS { 16 | char szName[MAX_NEKO_NAME]; 17 | 18 | //display 19 | char szLibrary[MAX_PATH]; 20 | DWORD uScale; 21 | BOOL fAlwaysOnTop; 22 | 23 | //movement 24 | DWORD uSpeed; 25 | DWORD uMouseSensitivity; 26 | 27 | //sounds 28 | char szSndIdle1[MAX_PATH]; 29 | char szSndIdle2[MAX_PATH]; 30 | char szSndIdle3[MAX_PATH]; 31 | char szSndSleep[MAX_PATH]; 32 | char szSndAwake[MAX_PATH]; 33 | DWORD uSndFrequency; 34 | 35 | //independence 36 | DWORD uAction; 37 | 38 | //effects 39 | BOOL bFootprints; 40 | char szFootprintLib[MAX_PATH]; 41 | 42 | //list items 43 | BOOL fDeleted; 44 | struct tagCATSETTINGS* next; 45 | 46 | } CATSETTINGS, *LPCATSETTINGS; 47 | 48 | //ranges for slider bars 49 | #define MIN_SPEED 2 50 | #define MAX_SPEED 48 51 | #define MIN_SENSE 1 52 | #define MAX_SENSE 64 53 | #define MIN_SNDFREQ 0 54 | #define MAX_SNDFREQ 100 55 | #define MIN_SCALE 10 56 | #define MAX_SCALE 400 57 | 58 | //external functions 59 | extern void WINAPI InitialisePropertyDialog( HWND hWnd ); 60 | extern void WINAPI ShutdownPropertyDialog(); 61 | extern void WINAPI OnSelChanged( HWND hWnd ); 62 | extern void WINAPI SetActiveCat( LPCATSETTINGS lpCat ); 63 | extern void WINAPI GetDialogSettings(); 64 | 65 | //external variables 66 | extern HINSTANCE g_hInstance; 67 | extern const char* szHelpFile; 68 | 69 | #endif //_NEKOCFG_H 70 | -------------------------------------------------------------------------------- /Neko98/NekoCommon.h: -------------------------------------------------------------------------------- 1 | /************************************ 2 | 3 | Common Definitions header 4 | 5 | Contains definitions used by both 6 | Neko95 and NekoCFG applications 7 | 8 | *************************************/ 9 | 10 | #ifndef _NEKOCOMMON_H 11 | #define _NEKOCOMMON_H 12 | 13 | //class & window names 14 | #define szNekoClassName "Neko95Class" 15 | #define szNekoWindowTitle "Neko95" 16 | 17 | //registry key for Neko's settings 18 | #define szNekoRegKey "Software\\DHSoft\\Neko95" 19 | 20 | //sub-key names 21 | #define szNekoTaskbarKey "Taskbar Icon" 22 | 23 | #define szNekoSpeedKey "Speed" 24 | #define szNekoSenseKey "Sensitivity" 25 | #define szNekoLibraryKey "Library" 26 | #define szNekoSndIdle1Key "Snd_Idle1" 27 | #define szNekoSndIdle2Key "Snd_Idle2" 28 | #define szNekoSndIdle3Key "Snd_Idle3" 29 | #define szNekoSndSleepKey "Snd_Sleep" 30 | #define szNekoSndAwakeKey "Snd_Awake" 31 | #define szNekoSndFreqKey "Sound Frequency" 32 | #define szNekoScaleKey "Size" 33 | #define szNekoOnTopKey "On Top" 34 | #define szNekoFootprintLibKey "Footprint Library" 35 | #define szNekoFootprintKey "Footprints" 36 | 37 | #define szNekoActionKey "Action" 38 | 39 | #define szNekoNumCatsKey "NumNekos" 40 | 41 | 42 | //identifiers for different Neko actions 43 | #define CHASE_MOUSE 0 44 | #define RUN_AWAY_FROM_MOUSE 1 45 | #define RUN_AROUND_RANDOMLY 2 46 | #define PACE_AROUND_SCREEN 3 47 | #define RUN_AROUND 4 48 | 49 | 50 | //message sent from NekoCFG to Neko to signal settings have changed 51 | #define MY_UPDATENEKO (WM_USER+33) 52 | 53 | //maximum length of a neko 'Name' 54 | #define MAX_NEKO_NAME (64) 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /Neko98/Pet.h: -------------------------------------------------------------------------------- 1 | // Pet.h: interface for the CPet class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_PET_H__A69EBAA0_385D_11D2_9FF9_00001C192944__INCLUDED_) 6 | #define AFX_PET_H__A69EBAA0_385D_11D2_9FF9_00001C192944__INCLUDED_ 7 | 8 | #if _MSC_VER >= 1000 9 | #pragma once 10 | #endif // _MSC_VER >= 1000 11 | 12 | #define WIN32_LEAN_AND_MEAN 13 | #include 14 | 15 | class CPet { 16 | 17 | public: 18 | //constructor/destructor 19 | CPet(); 20 | virtual ~CPet(); 21 | 22 | //public configuration functions 23 | virtual void SetImages( HICON* hIconTable, int nIcons ); 24 | virtual void SetScale( float fScale ); 25 | 26 | //public interface 27 | virtual void SetImageAndMoveTo( int nImage, int nNewX, int nNewY ); 28 | virtual void MoveTo( int nNewX, int nNewY ); 29 | virtual void SetImage( int nImage ); 30 | 31 | virtual void DrawOnTarget( int x, int y, HICON hIcon ) {}; //no default implementation 32 | 33 | //data member access 34 | inline RECT GetBoundsRect() { return m_rcBounds; }; 35 | inline POINT& GetPosition() { return m_ptPosition; }; 36 | inline POINT& GetOldPosition() { return m_ptOldPosition; }; 37 | inline SIZE GetSize() { return m_sizeImage; }; 38 | 39 | protected: 40 | 41 | //pure virtual functions 42 | virtual void Erase() = 0; 43 | virtual void Draw( int nImage ) = 0; 44 | 45 | //image destruction 46 | virtual void DestroyImages(); 47 | 48 | //icon information 49 | HICON* m_hIcons; 50 | int m_nIcons; 51 | int m_nLastIcon; 52 | 53 | //position & size information 54 | POINT m_ptPosition; 55 | POINT m_ptOldPosition; 56 | SIZE m_sizeImage; 57 | float m_fScale; 58 | 59 | //bounding box information 60 | RECT m_rcBounds; 61 | }; 62 | 63 | #endif // !defined(AFX_PET_H__A69EBAA0_385D_11D2_9FF9_00001C192944__INCLUDED_) 64 | -------------------------------------------------------------------------------- /Neko98/Tray.cpp: -------------------------------------------------------------------------------- 1 | /************************************ 2 | 3 | Tray Class: Very simple interface 4 | onto the system tray for Neko95 5 | 6 | *************************************/ 7 | 8 | #include 9 | #include 10 | #include "tray.h" 11 | #include "resource.h" 12 | 13 | BOOL CTray::AddIcon( HWND hWnd, HICON hIcon, UINT uID ) 14 | { 15 | BOOL res; 16 | NOTIFYICONDATA tnid; 17 | 18 | //fill in the structure 19 | tnid.cbSize = sizeof(NOTIFYICONDATA); 20 | tnid.hWnd = hWnd; 21 | tnid.uID = uID; 22 | tnid.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; 23 | tnid.uCallbackMessage = MY_NOTIFYICON; 24 | tnid.hIcon = hIcon; 25 | strncpy( tnid.szTip, "Neko", sizeof(tnid.szTip) ); 26 | 27 | //give the command 28 | res = Shell_NotifyIcon( NIM_ADD, &tnid ); 29 | 30 | //delete the icon 31 | DestroyIcon( tnid.hIcon ); 32 | 33 | //increment the counter 34 | if( res ) m_uIconCount++; 35 | 36 | return res; 37 | } 38 | 39 | BOOL CTray::RemoveIcon( HWND hWnd, UINT uID ) 40 | { 41 | BOOL res; 42 | NOTIFYICONDATA tnid; 43 | 44 | //fill in the structure 45 | tnid.cbSize = sizeof(NOTIFYICONDATA); 46 | tnid.hWnd = hWnd; 47 | tnid.uID = uID; 48 | 49 | //give the notify command 50 | res = Shell_NotifyIcon( NIM_DELETE, &tnid ); 51 | 52 | //decrement the counter 53 | if( res ) m_uIconCount--; 54 | 55 | return res; 56 | } 57 | 58 | void CTray::ShowPopupMenu( HWND hWnd ) 59 | { 60 | //get the mouse position 61 | POINT mouse; 62 | GetCursorPos( &mouse ); 63 | 64 | //create the popup menu 65 | HMENU hMenu = CreatePopupMenu(); 66 | AppendMenu( hMenu, MF_STRING, ID_SETTINGS,"&Settings" ); 67 | AppendMenu( hMenu, MF_STRING, ID_EXIT, "E&xit" ); 68 | SetMenuDefaultItem( hMenu, ID_SETTINGS, FALSE ); 69 | 70 | //display the menu 71 | TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, mouse.x, mouse.y, 0, hWnd, NULL ); 72 | 73 | //destroy it 74 | DestroyMenu(hMenu); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /Neko98/Neko98.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Neko98", "Neko98.vcxproj", "{83EABCC5-4247-43DD-A941-F7E76FA7C5A6}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NekoCFG", "NekoCFG\NekoCFG.vcxproj", "{4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Debug|Win32.Build.0 = Debug|Win32 18 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Debug|x64.ActiveCfg = Debug|x64 19 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Debug|x64.Build.0 = Debug|x64 20 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Release|Win32.ActiveCfg = Release|Win32 21 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Release|Win32.Build.0 = Release|Win32 22 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Release|x64.ActiveCfg = Release|x64 23 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6}.Release|x64.Build.0 = Release|x64 24 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Debug|Win32.Build.0 = Debug|Win32 26 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Debug|x64.ActiveCfg = Debug|x64 27 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Debug|x64.Build.0 = Debug|x64 28 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Release|Win32.ActiveCfg = Release|Win32 29 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Release|Win32.Build.0 = Release|Win32 30 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Release|x64.ActiveCfg = Release|x64 31 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8}.Release|x64.Build.0 = Release|x64 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG_resource.hm: -------------------------------------------------------------------------------- 1 | // Microsoft Developer Studio generated Help ID include file. 2 | // Used by NekoCFG.rc 3 | // 4 | #define HIDCANCEL 0x809e0002 // IDD_CONFIG 5 | #define HIDC_ABOUT 0x809e0419 // IDD_CONFIG 6 | #define HIDC_ACTION 0x806e041e // IDD_INDEPENDENCE 7 | #define HIDC_ACTIONDESC 0x806e041f // IDD_INDEPENDENCE 8 | #define HIDC_ALWAYSONTOP 0x80700420 // IDD_DISPLAY 9 | #define HIDC_APPLY 0x809e0411 // IDD_CONFIG 10 | #define HIDC_BROWSE 0x80a20406 // IDD_SOUND 11 | #define HIDC_CHANGE 0x8070006b // IDD_DISPLAY 12 | #define HIDC_DEFAULT 0x8070006c // IDD_DISPLAY 13 | #define HIDC_DELETE 0x809e0414 // IDD_CONFIG 14 | #define HIDC_FOOTPRINTS 0x80a50422 // IDD_EFFECTS 15 | #define HIDC_HELP 0x809e041d // IDD_CONFIG 16 | #define HIDC_IMAGELIB 0x80700068 // IDD_DISPLAY 17 | #define HIDC_NAME 0x809e0415 // IDD_CONFIG 18 | #define HIDC_NEW 0x809e0413 // IDD_CONFIG 19 | #define HIDC_NONE 0x80a2040a // IDD_SOUND 20 | #define HIDC_PREVIEW 0x80a20069 // IDD_SOUND 21 | #define HIDC_SCALEDISPLAY 0x8070040d // IDD_DISPLAY 22 | #define HIDC_SCALESLIDER 0x8070040c // IDD_DISPLAY 23 | #define HIDC_SENSESLIDER 0x806d0067 // IDD_MOVEMENT 24 | #define HIDC_SET100 0x80700410 // IDD_DISPLAY 25 | #define HIDC_SOUNDFREQ 0x80a20409 // IDD_SOUND 26 | #define HIDC_SOUNDNAME 0x80a20405 // IDD_SOUND 27 | #define HIDC_SOUNDSAVAIL 0x80a203f6 // IDD_SOUND 28 | #define HIDC_SPEEDSLIDER 0x806d0066 // IDD_MOVEMENT 29 | #define HIDC_TABS 0x809e0412 // IDD_CONFIG 30 | #define HIDC_TASKBAR 0x809e006a // IDD_CONFIG 31 | #define HIDOK 0x809e0001 // IDD_CONFIG 32 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {d8b57da7-21aa-41f3-894e-a61aaef95fd6} 6 | .ico;.bmp;.rc;.cur 7 | 8 | 9 | {54122c0e-e3a6-46de-b048-b404c28aa7a2} 10 | .hpj;.rtf 11 | 12 | 13 | 14 | 15 | Resource 16 | 17 | 18 | Resource 19 | 20 | 21 | Resource 22 | 23 | 24 | Resource 25 | 26 | 27 | Resource 28 | 29 | 30 | Resource 31 | 32 | 33 | Resource 34 | 35 | 36 | Resource 37 | 38 | 39 | Resource 40 | 41 | 42 | Help 43 | 44 | 45 | Help 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Neko98/AlwaysOnTopPet.h: -------------------------------------------------------------------------------- 1 | // AlwaysOnTopPet.h: interface for the CAlwaysOnTopPet class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_ALWAYSONTOPPET_H__A69EBAA4_385D_11D2_9FF9_00001C192944__INCLUDED_) 6 | #define AFX_ALWAYSONTOPPET_H__A69EBAA4_385D_11D2_9FF9_00001C192944__INCLUDED_ 7 | 8 | #if _MSC_VER >= 1000 9 | #pragma once 10 | #endif // _MSC_VER >= 1000 11 | 12 | #include "Pet.h" 13 | 14 | class CAlwaysOnTopPet : virtual public CPet 15 | { 16 | public: 17 | virtual void MoveTo( int nNewX, int nNewY ); 18 | virtual void SetImage( int nImage ); 19 | virtual void SetImageAndMoveTo( int nImage, int nNewX, int nNewY ); 20 | virtual void SetImages( HICON* hIconTable, int nIcons ); 21 | CAlwaysOnTopPet(); 22 | virtual ~CAlwaysOnTopPet(); 23 | 24 | virtual void DrawOnTarget( int x, int y, HICON hIcon ); 25 | 26 | //virtual callback functions - these can all be overridden to perform different actions 27 | //depending on the various mouse clicks. Note: CAlwaysOnTopPet::OnLButtonDown() handles 28 | //the dragging - if this is overridden, OnLButtonUp is not called. 29 | 30 | virtual void OnLButtonDown(); //implementation is in .cpp file 31 | virtual void OnLButtonUp() {}; 32 | virtual void OnLButtonDblClk() {}; 33 | virtual void OnMButtonDown() {}; 34 | virtual void OnMButtonUp() {}; 35 | virtual void OnMButtonDblClk() {}; 36 | virtual void OnRButtonDown() {}; 37 | virtual void OnRButtonUp() {}; 38 | virtual void OnRButtonDblClk() {}; 39 | 40 | //class information functions 41 | inline BOOL IsDragging() { return m_fBeingDragged; }; 42 | 43 | protected: 44 | HWND m_hWndOnTop; 45 | BOOL m_fBeingDragged; 46 | HRGN IconMaskToRegion( HICON hIcon ); 47 | virtual void DestroyImages(); 48 | HRGN* m_hRgns; 49 | virtual void Erase(); 50 | virtual void Draw( int nImage ); 51 | 52 | private: 53 | void BuildRegions(); 54 | void DestroyRegions(); 55 | static BOOL m_fRegisteredClass; 56 | 57 | friend 58 | LRESULT CALLBACK WndProc_OnTop( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 59 | 60 | 61 | }; 62 | 63 | #endif // !defined(AFX_ALWAYSONTOPPET_H__A69EBAA4_385D_11D2_9FF9_00001C192944__INCLUDED_) 64 | -------------------------------------------------------------------------------- /Neko98/NekoSettings.cpp: -------------------------------------------------------------------------------- 1 | /************************************ 2 | 3 | Neko's configuration 4 | 5 | *************************************/ 6 | 7 | #define WIN32_LEAN_AND_MEAN 8 | #include 9 | #include "NekoSettings.h" 10 | 11 | CNekoSettings::CNekoSettings( LPCSTR key, BOOL fCreate /*TRUE*/ ) 12 | { 13 | m_hKey = NULL; 14 | if( fCreate ) 15 | { 16 | DWORD dwDisposition; 17 | RegCreateKeyEx( HKEY_CURRENT_USER, key, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &m_hKey, &dwDisposition ); 18 | } 19 | else 20 | { 21 | if( RegOpenKeyEx( HKEY_CURRENT_USER, key, 0, KEY_READ|KEY_WRITE, &m_hKey ) != ERROR_SUCCESS ) 22 | m_hKey = NULL; 23 | } 24 | } 25 | 26 | CNekoSettings::~CNekoSettings() 27 | { 28 | if( m_hKey ) RegCloseKey( m_hKey ); 29 | } 30 | 31 | BOOL CNekoSettings::IsOpen() 32 | { 33 | return( m_hKey != NULL ); 34 | } 35 | 36 | BOOL CNekoSettings::GetString( LPCSTR keyname, LPSTR result, ULONG size ) 37 | { 38 | DWORD dwType; 39 | return ( RegQueryValueEx( m_hKey, keyname, NULL, &dwType, (LPBYTE)result, &size ) == ERROR_SUCCESS ); 40 | } 41 | 42 | BOOL CNekoSettings::GetInt( LPCSTR keyname, DWORD * result ) 43 | { 44 | DWORD dwType; 45 | ULONG ulSize = sizeof(DWORD); 46 | return ( RegQueryValueEx( m_hKey, keyname, NULL, &dwType, (LPBYTE)result, &ulSize ) == ERROR_SUCCESS ); 47 | } 48 | 49 | BOOL CNekoSettings::GetBool( LPCSTR keyname, BOOL * result ) 50 | { 51 | DWORD dwType; 52 | ULONG ulSize = sizeof(BOOL); 53 | return ( RegQueryValueEx( m_hKey, keyname, NULL, &dwType, (LPBYTE)result, &ulSize ) == ERROR_SUCCESS ); 54 | } 55 | 56 | 57 | BOOL CNekoSettings::SetString( LPCSTR keyname, LPSTR value ) 58 | { 59 | ULONG ulSize = strlen( value ) + 1; 60 | return ( RegSetValueEx( m_hKey, keyname, NULL, REG_SZ, (LPBYTE)value, ulSize) == ERROR_SUCCESS ); 61 | } 62 | 63 | BOOL CNekoSettings::SetInt( LPCSTR keyname, DWORD value ) 64 | { 65 | ULONG ulSize = sizeof(DWORD); 66 | return ( RegSetValueEx( m_hKey, keyname, NULL, REG_DWORD, (LPBYTE)&value, ulSize ) == ERROR_SUCCESS ); 67 | } 68 | 69 | BOOL CNekoSettings::SetBool( LPCSTR keyname, BOOL value ) 70 | { 71 | ULONG ulSize = sizeof(BOOL); 72 | return ( RegSetValueEx( m_hKey, keyname, NULL, REG_BINARY, (LPBYTE)&value, ulSize ) == ERROR_SUCCESS ); 73 | } 74 | -------------------------------------------------------------------------------- /Neko98/DesktopPet.cpp: -------------------------------------------------------------------------------- 1 | // DesktopPet.cpp: implementation of the CDesktopPet class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "DesktopPet.h" 6 | 7 | //constants 8 | #define UPDATE_COUNTER_MAX 50 //number of redraws until desktop handle is recalculated 9 | 10 | ////////////////////////////////////////////////////////////////////// 11 | // Construction/Destruction 12 | ////////////////////////////////////////////////////////////////////// 13 | 14 | CDesktopPet::CDesktopPet() : CDesktopHack(), CPet() 15 | { 16 | //clear the update counter 17 | m_nUpdateHWndCounter = 0; 18 | 19 | //set bounds 20 | GetDesktopRect( m_rcBounds ); 21 | } 22 | 23 | CDesktopPet::~CDesktopPet() 24 | { 25 | RedrawWindow( m_hWndDesktop, NULL, NULL, RDW_INVALIDATE|RDW_ERASE ); 26 | } 27 | 28 | 29 | 30 | ////////////////////////////////////////////////////////////////////// 31 | // Member Functions 32 | ////////////////////////////////////////////////////////////////////// 33 | 34 | void CDesktopPet::Draw( int nImage ) 35 | { 36 | //grab the device context of the desktop 37 | HDC hDC = GetDC( m_hWndDesktop ); 38 | 39 | //draw the icon on it 40 | DrawIconEx( hDC, m_ptPosition.x, m_ptPosition.y, m_hIcons[nImage], m_sizeImage.cx, m_sizeImage.cy, 0, NULL, DI_NORMAL ); 41 | 42 | //release the device context 43 | ReleaseDC( m_hWndDesktop, hDC ); 44 | 45 | //increment the update counter and update if required 46 | if( ++m_nUpdateHWndCounter > UPDATE_COUNTER_MAX ) 47 | { 48 | FindDesktopHandle(); 49 | GetDesktopRect( m_rcBounds ); 50 | } 51 | } 52 | 53 | void CDesktopPet::Erase() 54 | { 55 | //set up rect to be erased 56 | RECT rcErase = { m_ptOldPosition.x, m_ptOldPosition.y, 57 | m_ptOldPosition.x + m_sizeImage.cx, m_ptOldPosition.y + m_sizeImage.cy }; 58 | 59 | //invalidate it and tell it to update 60 | InvalidateRect( m_hWndDesktop, &rcErase, TRUE ); 61 | UpdateWindow( m_hWndDesktop ); 62 | } 63 | 64 | void CDesktopPet::DrawOnTarget( int x, int y, HICON hIcon ) 65 | { 66 | //grab the device context of the desktop 67 | HDC hDC = GetDC( m_hWndDesktop ); 68 | 69 | //draw the icon on it 70 | DrawIconEx( hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL ); 71 | 72 | //release the device context 73 | ReleaseDC( m_hWndDesktop, hDC ); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /Neko98/Neko.h: -------------------------------------------------------------------------------- 1 | // Neko.h: interface for the CNeko class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_NEKO_H__A69EBAA5_385D_11D2_9FF9_00001C192944__INCLUDED_) 6 | #define AFX_NEKO_H__A69EBAA5_385D_11D2_9FF9_00001C192944__INCLUDED_ 7 | 8 | #if _MSC_VER >= 1000 9 | #pragma once 10 | #endif // _MSC_VER >= 1000 11 | 12 | #include "DesktopPet.h" 13 | #include "AlwaysOnTopPet.h" 14 | #include "NekoCommon.h" 15 | 16 | class CNeko { 17 | 18 | public: 19 | CNeko( char* pszName = "" ); 20 | virtual ~CNeko(); 21 | 22 | //public interface 23 | virtual void Update(); 24 | virtual void RunTowards( int nX, int nY ); 25 | 26 | protected: 27 | 28 | //states. (note: I know that the numbering is unnecessary, but you never know... - these MUST go from 0-17) 29 | enum State { STOP = 0, WASH = 1, SCRATCH = 2, YAWN = 3, SLEEP = 4, AWAKE = 5, U_MOVE = 6, 30 | D_MOVE = 7, L_MOVE = 8, R_MOVE = 9, UL_MOVE = 10, UR_MOVE = 11, DL_MOVE = 12, 31 | DR_MOVE = 13, U_CLAW = 14, D_CLAW = 15, L_CLAW = 16, R_CLAW = 17 }; 32 | 33 | //position info 34 | int m_nDX, m_nDY; 35 | int m_nOldToX, m_nOldToY; 36 | int m_nToX, m_nToY; 37 | 38 | //size info 39 | DWORD m_dwScale; 40 | 41 | //state info 42 | UINT m_uTickCount, m_uStateCount; 43 | State m_State; 44 | 45 | //action info 46 | int m_Action; 47 | int m_nActionCount; 48 | int m_nActionX, m_nActionY, m_nActionDX, m_nActionDY; 49 | 50 | //attributes 51 | DWORD m_dwSpeed; 52 | DWORD m_dwIdleSpace; 53 | char m_szLibname[MAX_PATH]; 54 | char m_szFootprintLibname[MAX_PATH]; 55 | BOOL m_bFootprints; 56 | 57 | //sound stuff 58 | char m_szSndIdle1[MAX_PATH], m_szSndIdle2[MAX_PATH], m_szSndIdle3[MAX_PATH]; 59 | char m_szSndSleep[MAX_PATH], m_szSndAwake[MAX_PATH]; 60 | DWORD m_dwSndFrequency; 61 | 62 | //named Neko stuff 63 | char m_szName[MAX_NEKO_NAME]; 64 | 65 | //animation lookup table 66 | int m_nAnimation[18][2]; 67 | 68 | State GetState() { return m_State; } 69 | 70 | HICON m_hIconFootprints[8]; 71 | 72 | private: 73 | CPet* m_pPet; 74 | BOOL LoadImages(); 75 | int GetStateAnimationFrameIndex(); 76 | void CalcDirection(); 77 | BOOL MoveStart(); 78 | void SetState( State state ); 79 | }; 80 | 81 | #endif // !defined(AFX_NEKO_H__A69EBAA5_385D_11D2_9FF9_00001C192944__INCLUDED_) 82 | -------------------------------------------------------------------------------- /Neko98/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by Neko95.rc 4 | // 5 | #define IDI_AWAKE 101 6 | #define ID_SETTINGS 101 7 | #define IDI_UP1 102 8 | #define ID_EXIT 102 9 | #define IDI_UP2 103 10 | #define ID_TIMER_NEKOUPDATE 103 11 | #define IDI_UPRIGHT1 104 12 | #define ID_TIMER_NEKO 104 13 | #define IDI_UPRIGHT2 105 14 | #define IDI_RIGHT1 106 15 | #define IDI_RIGHT2 107 16 | #define IDI_DOWNRIGHT1 108 17 | #define IDI_DOWNRIGHT2 109 18 | #define IDI_DOWN1 110 19 | #define IDI_DOWN2 111 20 | #define IDI_DOWNLEFT1 112 21 | #define IDI_DOWNLEFT2 113 22 | #define IDI_LEFT1 114 23 | #define IDI_LEFT2 115 24 | #define IDI_UPLEFT1 116 25 | #define IDI_UPLEFT2 117 26 | #define IDI_UPCLAW1 118 27 | #define IDI_UPCLAW2 119 28 | #define IDI_RIGHTCLAW1 120 29 | #define IDI_RIGHTCLAW2 121 30 | #define IDI_LEFTCLAW1 122 31 | #define IDI_LEFTCLAW2 123 32 | #define IDI_DOWNCLAW1 124 33 | #define IDI_DOWNCLAW2 125 34 | #define IDI_WASH2 126 35 | #define IDI_SCRATCH1 127 36 | #define IDI_SCRATCH2 128 37 | #define IDI_YAWN2 129 38 | #define IDI_YAWN3 130 39 | #define IDI_SLEEP1 131 40 | #define IDI_SLEEP2 132 41 | 42 | #define IDI_FP_UP 133 43 | #define IDI_FP_UPRIGHT 134 44 | #define IDI_FP_RIGHT 135 45 | #define IDI_FP_DOWNRIGHT 136 46 | #define IDI_FP_DOWN 137 47 | #define IDI_FP_DOWNLEFT 138 48 | #define IDI_FP_LEFT 139 49 | #define IDI_FP_UPLEFT 140 50 | 51 | 52 | // Next default values for new objects 53 | // 54 | #ifdef APSTUDIO_INVOKED 55 | #ifndef APSTUDIO_READONLY_SYMBOLS 56 | #define _APS_NEXT_RESOURCE_VALUE 141 57 | #define _APS_NEXT_COMMAND_VALUE 40001 58 | #define _APS_NEXT_CONTROL_VALUE 1000 59 | #define _APS_NEXT_SYMED_VALUE 105 60 | #endif 61 | #endif 62 | -------------------------------------------------------------------------------- /Neko98/Pet.cpp: -------------------------------------------------------------------------------- 1 | // Pet.cpp: implementation of the CPet class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "Pet.h" 6 | 7 | ////////////////////////////////////////////////////////////////////// 8 | // Construction/Destruction 9 | ////////////////////////////////////////////////////////////////////// 10 | 11 | CPet::CPet() 12 | { 13 | //prepare empty icon table 14 | m_nIcons = 0; 15 | m_nLastIcon = -1; 16 | m_hIcons = NULL; 17 | 18 | //set initial and old position 19 | m_ptPosition.x = 0; 20 | m_ptPosition.y = 0; 21 | m_ptOldPosition.x = -1; 22 | m_ptOldPosition.y = -1; 23 | 24 | //set initial size and scale 25 | m_sizeImage.cx = 0; 26 | m_sizeImage.cy = 0; 27 | m_fScale = 1.0f; 28 | 29 | //set initial bounding box (none) 30 | SetRect( &m_rcBounds, -1, -1, -1, -1 ); 31 | } 32 | 33 | 34 | 35 | CPet::~CPet() 36 | { 37 | //delete the images 38 | DestroyImages(); 39 | } 40 | 41 | 42 | ////////////////////////////////////////////////////////////////////// 43 | // Member Functions 44 | ////////////////////////////////////////////////////////////////////// 45 | 46 | 47 | void CPet::SetImages( HICON* hIconTable, int nIcons ) 48 | { 49 | //delete current images 50 | DestroyImages(); 51 | 52 | //we can't have 0 images 53 | if( nIcons <= 0 ) 54 | { 55 | nIcons = 1; 56 | #ifdef DEBUG 57 | OutputDebugString( "WARNING: CPet::SetImages() passed 0 as nIcons\n" ); 58 | #endif 59 | } 60 | 61 | //FIXME: it might be possible to use CopyImage() passing it the *scaled* width and height 62 | //in combination with the LR_COPYFROMRESOURCE. This might fix the non-32x32 icon problem 63 | 64 | //allocate icon table and clear all entries 65 | m_hIcons = new HICON[nIcons]; 66 | for( int i = 0; i < nIcons; i++ ) m_hIcons[i] = CopyIcon(hIconTable[i]); 67 | 68 | //store icon table size and set last drawn icon index 69 | m_nIcons = nIcons; 70 | m_nLastIcon = -1; 71 | 72 | //get size of first icon 73 | ICONINFO ii; 74 | GetIconInfo( m_hIcons[0], &ii ); 75 | 76 | BITMAP bm; 77 | GetObject( ii.hbmMask, sizeof(BITMAP), &bm ); 78 | DeleteObject( ii.hbmMask ); 79 | DeleteObject( ii.hbmColor ); 80 | 81 | //calculate scaled size 82 | m_sizeImage.cx = int( bm.bmWidth * m_fScale ); 83 | m_sizeImage.cy = int( bm.bmHeight * m_fScale ); 84 | } 85 | 86 | 87 | 88 | void CPet::DestroyImages() 89 | { 90 | //delete all images, if any 91 | if( m_nIcons > 0 ) 92 | { 93 | //delete all icons in the table 94 | for( int i = 0; i < m_nIcons; i++ ) DestroyIcon( m_hIcons[i] ); 95 | 96 | //delete the table 97 | delete[] m_hIcons; 98 | m_hIcons = NULL; 99 | } 100 | } 101 | 102 | 103 | 104 | void CPet::SetImage( int nImage ) 105 | { 106 | //only draw if the image has changed 107 | if( nImage != m_nLastIcon ) 108 | { 109 | Erase(); 110 | Draw( nImage ); 111 | m_nLastIcon = nImage; 112 | } 113 | } 114 | 115 | 116 | 117 | void CPet::MoveTo(int nNewX, int nNewY) 118 | { 119 | if( m_ptOldPosition.x == -1 ) 120 | { 121 | //set old position to the current position as we've not been moved before 122 | m_ptOldPosition.x = nNewX; 123 | m_ptOldPosition.y = nNewY; 124 | } 125 | else 126 | { 127 | //store current position 128 | m_ptOldPosition.x = m_ptPosition.x; 129 | m_ptOldPosition.y = m_ptPosition.y; 130 | } 131 | 132 | //remove current 133 | Erase(); 134 | 135 | //change current position 136 | m_ptPosition.x = nNewX; 137 | m_ptPosition.y = nNewY; 138 | 139 | //redraw 140 | Draw( m_nLastIcon ); 141 | } 142 | 143 | void CPet::SetImageAndMoveTo(int nImage, int nNewX, int nNewY) 144 | { 145 | //change image 146 | m_nLastIcon = nImage; 147 | 148 | //move 149 | MoveTo( nNewX, nNewY ); 150 | } 151 | 152 | 153 | void CPet::SetScale(float fScale) 154 | { 155 | if( fScale != 0.0f ) 156 | m_fScale = fScale; 157 | else 158 | m_fScale = 1.0f; 159 | } 160 | -------------------------------------------------------------------------------- /Neko98/DesktopHack.cpp: -------------------------------------------------------------------------------- 1 | // DesktopHack.cpp: implementation of the CDesktopHack class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #define WIN32_LEAN_AND_MEAN 6 | #include 7 | #include "DesktopHack.h" 8 | 9 | //constants used by callback function 10 | #define ENUM_ALLWINDOWS 1 11 | #define ENUM_SHELLDEFVIEW 2 12 | #define ENUM_GETDESKTOP 3 13 | 14 | //variables used by callback function 15 | HWND g_hWndDesktop = NULL; 16 | HWND g_hWndShellDefView = NULL; 17 | BOOL g_fActiveDesktop = FALSE; 18 | 19 | //callback function prototype 20 | BOOL CALLBACK DesktopHunter( HWND hWnd, LPARAM lParam ); 21 | 22 | 23 | 24 | ////////////////////////////////////////////////////////////////////// 25 | // Construction/Destruction 26 | ////////////////////////////////////////////////////////////////////// 27 | 28 | CDesktopHack::CDesktopHack() 29 | { 30 | //find the desktop 31 | FindDesktopHandle(); 32 | } 33 | 34 | CDesktopHack::~CDesktopHack() 35 | { 36 | 37 | } 38 | 39 | 40 | 41 | ////////////////////////////////////////////////////////////////////// 42 | // Member Functions 43 | ////////////////////////////////////////////////////////////////////// 44 | 45 | void CDesktopHack::FindDesktopHandle() 46 | { 47 | //reset everything 48 | g_hWndDesktop = NULL; 49 | g_hWndShellDefView = NULL; 50 | g_fActiveDesktop = FALSE; 51 | m_fNoChicagoDesktop = FALSE; 52 | 53 | //enumerate all of the windows 54 | EnumWindows( (WNDENUMPROC)DesktopHunter, ENUM_ALLWINDOWS ); 55 | 56 | //if no desktop was found, we're running on a non-chicago style shell (win32s/NT3) 57 | if( g_hWndDesktop == NULL ) 58 | { 59 | m_fNoChicagoDesktop = TRUE; 60 | g_hWndDesktop = GetDesktopWindow(); 61 | } 62 | 63 | //store the handle and whether it's an active desktop or not 64 | m_hWndDesktop = g_hWndDesktop; 65 | m_fActiveDesktop = g_fActiveDesktop; 66 | } 67 | 68 | void CDesktopHack::GetDesktopRect( RECT& rcDesktop ) 69 | { 70 | //retrieve the screen rect of the desktop 71 | SystemParametersInfo( SPI_GETWORKAREA, 0, &rcDesktop, FALSE ); 72 | } 73 | 74 | 75 | 76 | 77 | ////////////////////////////////////////////////////////////////////// 78 | // Callback Function 79 | ////////////////////////////////////////////////////////////////////// 80 | 81 | BOOL CALLBACK DesktopHunter( HWND hWnd, LPARAM lParam ) 82 | { 83 | char szBuffer[26]; 84 | 85 | switch( lParam ) 86 | { 87 | case ENUM_ALLWINDOWS: 88 | //try and find program manager window 89 | GetClassName( hWnd, szBuffer, 25 ); 90 | if( stricmp( szBuffer, "Progman" ) == 0 ) 91 | { 92 | EnumChildWindows( hWnd, (WNDENUMPROC)DesktopHunter, ENUM_SHELLDEFVIEW ); 93 | return ( g_hWndDesktop == NULL ); //keep looking if it's not found 94 | } 95 | break; 96 | 97 | case ENUM_SHELLDEFVIEW: 98 | GetClassName( hWnd, szBuffer, 25 ); 99 | if( stricmp( szBuffer, "SHELLDLL_DefView" ) == 0 ) 100 | { 101 | g_hWndShellDefView = hWnd; 102 | EnumChildWindows( hWnd, (WNDENUMPROC)DesktopHunter, ENUM_GETDESKTOP ); 103 | return FALSE; 104 | } 105 | break; 106 | 107 | case ENUM_GETDESKTOP: 108 | //only look at child windows of the shell default view 109 | if( GetParent( hWnd ) != g_hWndShellDefView ) break; 110 | 111 | GetClassName( hWnd, szBuffer, 25 ); 112 | 113 | //check for normal desktop 114 | if( stricmp( szBuffer, "SysListView32" ) == 0 ) 115 | { 116 | //store handle but continue looking 117 | g_hWndDesktop = hWnd; 118 | return TRUE; 119 | } 120 | 121 | //check for IE4 122 | if( stricmp( szBuffer, "Internet Explorer_Server" ) == 0 ) 123 | { 124 | g_hWndDesktop = hWnd; 125 | g_fActiveDesktop = TRUE; 126 | return FALSE; 127 | } 128 | break; 129 | } 130 | return TRUE; 131 | } 132 | -------------------------------------------------------------------------------- /Neko98/Neko98.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {fbd4ed39-75fc-48f1-8250-b4fe25fde2b8} 6 | .ico;.bmp;.rc 7 | 8 | 9 | 10 | 11 | Resources 12 | 13 | 14 | Resources 15 | 16 | 17 | Resources 18 | 19 | 20 | Resources 21 | 22 | 23 | Resources 24 | 25 | 26 | Resources 27 | 28 | 29 | Resources 30 | 31 | 32 | Resources 33 | 34 | 35 | Resources 36 | 37 | 38 | Resources 39 | 40 | 41 | Resources 42 | 43 | 44 | Resources 45 | 46 | 47 | Resources 48 | 49 | 50 | Resources 51 | 52 | 53 | Resources 54 | 55 | 56 | Resources 57 | 58 | 59 | Resources 60 | 61 | 62 | Resources 63 | 64 | 65 | Resources 66 | 67 | 68 | Resources 69 | 70 | 71 | Resources 72 | 73 | 74 | Resources 75 | 76 | 77 | Resources 78 | 79 | 80 | Resources 81 | 82 | 83 | Resources 84 | 85 | 86 | Resources 87 | 88 | 89 | Resources 90 | 91 | 92 | Resources 93 | 94 | 95 | Resources 96 | 97 | 98 | Resources 99 | 100 | 101 | Resources 102 | 103 | 104 | Resources 105 | 106 | 107 | Resources 108 | 109 | 110 | Resources 111 | 112 | 113 | Resources 114 | 115 | 116 | Resources 117 | 118 | 119 | Resources 120 | 121 | 122 | Resources 123 | 124 | 125 | Resources 126 | 127 | 128 | Resources 129 | 130 | 131 | 132 | 133 | Resources 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="NekoCFG" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=NekoCFG - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "NekoCFG.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "NekoCFG.mak" CFG="NekoCFG - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "NekoCFG - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "NekoCFG - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "NekoCFG - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 49 | # ADD BASE RSC /l 0x809 /d "NDEBUG" 50 | # ADD RSC /l 0x809 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # 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 /subsystem:windows /machine:I386 56 | # 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 comctl32.lib winmm.lib /nologo /subsystem:windows /machine:I386 57 | 58 | !ELSEIF "$(CFG)" == "NekoCFG - Win32 Debug" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Debug" 63 | # PROP BASE Intermediate_Dir "Debug" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "Debug" 68 | # PROP Intermediate_Dir "Debug" 69 | # PROP Ignore_Export_Lib 0 70 | # PROP Target_Dir "" 71 | # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c 72 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c 73 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 74 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 75 | # ADD BASE RSC /l 0x809 /d "_DEBUG" 76 | # ADD RSC /l 0x809 /d "_DEBUG" 77 | BSC32=bscmake.exe 78 | # ADD BASE BSC32 /nologo 79 | # ADD BSC32 /nologo 80 | LINK32=link.exe 81 | # 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 /subsystem:windows /debug /machine:I386 /pdbtype:sept 82 | # ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 83 | 84 | !ENDIF 85 | 86 | # Begin Target 87 | 88 | # Name "NekoCFG - Win32 Release" 89 | # Name "NekoCFG - Win32 Debug" 90 | # Begin Group "Resource" 91 | 92 | # PROP Default_Filter ".ico;.bmp;.rc;.cur" 93 | # Begin Source File 94 | 95 | SOURCE=.\Res\AppIcon.ico 96 | # End Source File 97 | # Begin Source File 98 | 99 | SOURCE=..\Res\Awake.ico 100 | # End Source File 101 | # Begin Source File 102 | 103 | SOURCE=.\Res\displayi.ico 104 | # End Source File 105 | # Begin Source File 106 | 107 | SOURCE=.\Res\independence.ico 108 | # End Source File 109 | # Begin Source File 110 | 111 | SOURCE=.\Res\movement.ico 112 | # End Source File 113 | # Begin Source File 114 | 115 | SOURCE=.\Res\play.bmp 116 | # End Source File 117 | # Begin Source File 118 | 119 | SOURCE=.\Res\playing.cur 120 | # End Source File 121 | # Begin Source File 122 | 123 | SOURCE=.\Res\sounds.ico 124 | # End Source File 125 | # Begin Source File 126 | 127 | SOURCE=.\Res\tab_effects.ico 128 | # End Source File 129 | # End Group 130 | # Begin Group "Help" 131 | 132 | # PROP Default_Filter ".hpj;.rtf" 133 | # Begin Source File 134 | 135 | SOURCE=..\NekoHelp\Neko98.HPJ 136 | # End Source File 137 | # Begin Source File 138 | 139 | SOURCE=..\NekoHelp\Neko98.RTF 140 | # End Source File 141 | # End Group 142 | # Begin Source File 143 | 144 | SOURCE=.\NekoCFG.cpp 145 | # End Source File 146 | # Begin Source File 147 | 148 | SOURCE=.\NekoCFG.h 149 | # End Source File 150 | # Begin Source File 151 | 152 | SOURCE=.\NekoCFG.rc 153 | # End Source File 154 | # Begin Source File 155 | 156 | SOURCE=.\NekoCFG_resource.h 157 | # End Source File 158 | # Begin Source File 159 | 160 | SOURCE=.\NekoCFG_Tabs.cpp 161 | # End Source File 162 | # Begin Source File 163 | 164 | SOURCE=..\NekoCommon.h 165 | # End Source File 166 | # Begin Source File 167 | 168 | SOURCE=..\NekoSettings.cpp 169 | # End Source File 170 | # Begin Source File 171 | 172 | SOURCE=..\NekoSettings.h 173 | # End Source File 174 | # End Target 175 | # End Project 176 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG_resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by NekoCFG.rc 4 | // 5 | #define IDS_DESC1 1 6 | #define IDS_DESC2 2 7 | #define IDS_DESC3 3 8 | #define IDS_DESC4 4 9 | #define IDS_DESC5 5 10 | #define IDS_DESC6 6 11 | #define IDI_APPICON 101 12 | #define ID_SETTINGS 101 13 | #define IDC_SPEEDSLIDER 102 14 | #define ID_EXIT 102 15 | #define IDC_SENSESLIDER 103 16 | #define ID_NEKOUPDATETIMER 103 17 | #define IDC_IMAGELIB 104 18 | #define IDC_PREVIEW 105 19 | #define IDC_TASKBAR 106 20 | #define IDC_CHANGE 107 21 | #define IDC_DEFAULT 108 22 | #define IDD_GENERAL 109 23 | #define IDD_MOVEMENT 109 24 | #define IDD_INDEPENDENCE 110 25 | #define IDD_DISPLAY 112 26 | #define IDI_AWAKE 113 27 | #define IDI_UP1 114 28 | #define IDI_UP2 115 29 | #define IDI_UPRIGHT1 116 30 | #define IDI_UPRIGHT2 117 31 | #define IDI_RIGHT1 118 32 | #define IDI_RIGHT2 119 33 | #define IDI_DOWNRIGHT1 120 34 | #define IDI_DOWNRIGHT2 121 35 | #define IDI_DOWN1 122 36 | #define IDI_DOWN2 123 37 | #define IDI_DOWNLEFT1 124 38 | #define IDI_DOWNLEFT2 125 39 | #define IDI_LEFT1 126 40 | #define IDI_LEFT2 127 41 | #define IDI_UPLEFT1 128 42 | #define IDI_UPLEFT2 129 43 | #define IDI_UPCLAW1 130 44 | #define IDI_UPCLAW2 131 45 | #define IDI_RIGHTCLAW1 132 46 | #define IDI_RIGHTCLAW2 133 47 | #define IDI_LEFTCLAW1 134 48 | #define IDI_LEFTCLAW2 135 49 | #define IDI_DOWNCLAW1 136 50 | #define IDI_DOWNCLAW2 137 51 | #define IDI_WASH2 138 52 | #define IDI_SCRATCH1 139 53 | #define IDI_SCRATCH2 140 54 | #define IDI_YAWN2 141 55 | #define IDI_YAWN3 142 56 | #define IDI_SLEEP1 143 57 | #define IDI_SLEEP2 144 58 | #define IDI_TASKBAR 145 59 | #define IDI_DEFAULT 146 60 | #define IDI_DISPLAYICON 147 61 | #define IDI_MOVEMENTICON 148 62 | #define IDI_ABOUTICON 149 63 | #define IDD_ABOUT 150 64 | #define IDI_SOUNDSICON 151 65 | #define IDD_SOUNDS 152 66 | #define IDB_TASKBAR 155 67 | #define IDB_CATCLOCK 156 68 | #define IDI_IE4 157 69 | #define IDD_CONFIG 158 70 | #define IDD_IMAGELIB 159 71 | #define IDD_SCALE 160 72 | #define IDD_SOUND 162 73 | #define IDD_NEWNEKO 163 74 | #define IDD_ABOUTBOX 164 75 | #define IDC_PLAYING 165 76 | #define IDD_EFFECTS 165 77 | #define IDI_TAB_SOUNDS 168 78 | #define IDI_TAB_MOVEMENT 169 79 | #define IDI_TAB_DISPLAY 170 80 | #define IDI_TAB_INDEPENDENCE 171 81 | #define IDR_PLAYBITMAP 172 82 | #define IDI_TAB_EFFECTS 172 83 | #define IDC_CHANCESLIDER 1000 84 | #define IDC_CHANCE 1002 85 | #define IDC_CHASECOMBO 1003 86 | #define IDC_CHASERANDOM 1007 87 | #define IDC_DESCRIPTION 1009 88 | #define IDC_WEBPAGE 1011 89 | #define IDC_EMAIL 1013 90 | #define IDC_LIST1 1014 91 | #define IDC_SOUNDSAVAIL 1014 92 | #define IDC_SOUNDNAME 1029 93 | #define IDC_BROWSE 1030 94 | #define IDC_SOUNDFREQ 1033 95 | #define IDC_NONE 1034 96 | #define IDC_CHEESE 1035 97 | #define IDC_SCALESCLIDE 1036 98 | #define IDC_SCALESLIDER 1036 99 | #define IDC_SCALEDISPLAY 1037 100 | #define IDC_IE4MODE 1039 101 | #define IDC_SET100 1040 102 | #define IDC_APPLY 1041 103 | #define IDC_TABS 1042 104 | #define IDC_NEWNEKO 1043 105 | #define IDC_NEW 1043 106 | #define IDC_DELETE 1044 107 | #define IDC_NAME 1045 108 | #define IDC_NEWNEKONAME 1048 109 | #define IDC_ABOUT 1049 110 | #define IDC_QUEUEDRAWING 1052 111 | #define IDC_HELP 1053 112 | #define IDC_ACTION 1054 113 | #define IDC_ACTIONDESC 1055 114 | #define IDC_ALWAYSONTOP 1056 115 | #define IDC_FOOTPRINTS 1058 116 | 117 | // Next default values for new objects 118 | // 119 | #ifdef APSTUDIO_INVOKED 120 | #ifndef APSTUDIO_READONLY_SYMBOLS 121 | #define _APS_NEXT_RESOURCE_VALUE 174 122 | #define _APS_NEXT_COMMAND_VALUE 40001 123 | #define _APS_NEXT_CONTROL_VALUE 1059 124 | #define _APS_NEXT_SYMED_VALUE 104 125 | #endif 126 | #endif 127 | -------------------------------------------------------------------------------- /Neko98/Neko98.cpp: -------------------------------------------------------------------------------- 1 | /************************************ 2 | Neko for Windows 3 | *************************************/ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "Tray.h" 10 | #include "NekoSettings.h" 11 | #include "NekoCommon.h" 12 | #include "resource.h" 13 | #include "Neko.h" 14 | 15 | //global variables 16 | HINSTANCE g_hInstance = NULL; 17 | HWND g_hWndMain = NULL; 18 | BOOL g_fTaskbar = TRUE; 19 | CTray * Tray = NULL; 20 | 21 | int g_nNumCats = 0; 22 | typedef CNeko* PNeko; 23 | PNeko* g_NekoArray = NULL; //array of CNeko pointers 24 | DWORD g_dwSleepTime = 100; 25 | 26 | BOOL g_fNeedReinit = TRUE; 27 | 28 | 29 | /* ExecuteConfigProcess - runs the configuration program *******************************/ 30 | void ExecuteConfigProcess() 31 | { 32 | if( (int)ShellExecute( NULL, "open", "NekoCFG.EXE", 0, "", SW_SHOWNORMAL ) <= 32 ) 33 | MessageBox( NULL, "Neko was unable to start the configuration program\n'NekoCFG.EXE'\n\nMake sure that this file is in the same folder as the main Neko program.", "Configure Neko", MB_ICONEXCLAMATION ); 34 | } 35 | 36 | 37 | 38 | /* LoadConfiguration - reloads the program configuration *******************************/ 39 | void LoadConfiguration() 40 | { 41 | //load in the new global settings 42 | CNekoSettings * NekoSettings = new CNekoSettings( szNekoRegKey ); 43 | NekoSettings->GetBool( szNekoTaskbarKey, &g_fTaskbar ); 44 | 45 | //delete all existing Nekos 46 | int i; 47 | for( i = 0; i < g_nNumCats; i++ ) delete g_NekoArray[i]; 48 | delete[] g_NekoArray; 49 | 50 | //load in new cats list 51 | DWORD dwNumCats = 0; 52 | NekoSettings->GetInt( szNekoNumCatsKey, &dwNumCats ); 53 | g_nNumCats = dwNumCats; 54 | 55 | if( g_nNumCats == 0 ) 56 | { 57 | //the user hasn't run the config program, or there are no Nekos - use default 58 | g_NekoArray = new PNeko[1]; 59 | g_NekoArray[0] = new CNeko(); 60 | g_nNumCats = 1; 61 | } 62 | else 63 | { 64 | g_NekoArray = new PNeko[g_nNumCats]; 65 | for( i = 0; i < g_nNumCats; i++ ) 66 | { 67 | //build the key index 68 | char szSubKey[MAX_PATH], szName[MAX_NEKO_NAME]; 69 | sprintf( szSubKey, "%d", i ); 70 | 71 | //load this cat's name from the registry 72 | NekoSettings->GetString( szSubKey, szName, MAX_NEKO_NAME-1 ); 73 | 74 | //add this Neko to the array 75 | g_NekoArray[i] = new CNeko( szName ); 76 | } 77 | } 78 | 79 | //erase the Neko settings 80 | delete NekoSettings; 81 | 82 | //calculate new sleep time 83 | g_dwSleepTime = 100; 84 | if( g_nNumCats <= 20 ) g_dwSleepTime = 200 - ( 5 * g_nNumCats ); 85 | 86 | //update task bar 87 | if( g_fTaskbar ) 88 | { 89 | if( Tray->GetCount() == 0 ) 90 | Tray->AddIcon( g_hWndMain, LoadIcon( g_hInstance, MAKEINTRESOURCE( IDI_AWAKE )), 1 ); 91 | } 92 | else 93 | { 94 | if( Tray->GetCount() > 0 ) 95 | Tray->RemoveIcon( g_hWndMain, 1 ); 96 | } 97 | 98 | } 99 | 100 | 101 | /* WndProc - message processing function for the hidden Neko window ********************/ 102 | LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) 103 | { 104 | switch( message ) 105 | { 106 | case WM_DESTROY: 107 | //terminate the program 108 | PostQuitMessage( 0 ); 109 | break; 110 | 111 | case WM_COMMAND: 112 | switch(LOWORD(wParam)) 113 | { 114 | case ID_SETTINGS: 115 | ExecuteConfigProcess(); 116 | break; 117 | 118 | case ID_EXIT: 119 | PostQuitMessage( 0 ); 120 | break; 121 | } 122 | break; 123 | 124 | case WM_DEVMODECHANGE: 125 | case WM_DISPLAYCHANGE: 126 | case WM_SETTINGCHANGE: 127 | case MY_UPDATENEKO: 128 | g_fNeedReinit = TRUE; 129 | break; 130 | 131 | case MY_NOTIFYICON: 132 | switch( lParam ) 133 | { 134 | case WM_LBUTTONDBLCLK: 135 | ExecuteConfigProcess(); 136 | break; 137 | 138 | case WM_RBUTTONUP: 139 | //this line is needed to make the menu go away! 140 | //(from Windows Developer FAQ [Robert Mashlan]) 141 | SetForegroundWindow( hWnd ); 142 | 143 | //show the context menu 144 | Tray->ShowPopupMenu( hWnd ); 145 | break; 146 | } 147 | break; 148 | 149 | case WM_TIMER: 150 | { 151 | //check to see if stuff needs reinitialisation 152 | if( g_fNeedReinit ) 153 | { 154 | LoadConfiguration(); 155 | g_fNeedReinit = FALSE; 156 | } 157 | 158 | //update all Nekos 159 | for( int i = 0; i < g_nNumCats; i++ ) g_NekoArray[i]->Update(); 160 | break; 161 | } 162 | 163 | default: 164 | return DefWindowProc( hWnd, message, wParam, lParam ); 165 | } 166 | 167 | return 0; 168 | } 169 | 170 | 171 | /* InitApplication - program initialisation function ***********************************/ 172 | BOOL InitApplication( HINSTANCE hInstance ) 173 | { 174 | //store the instance handle 175 | g_hInstance = hInstance; 176 | 177 | //create the (hidden) window 178 | WNDCLASS wc; 179 | wc.style = 0; 180 | wc.lpfnWndProc = (WNDPROC)WndProc; 181 | wc.cbClsExtra = 0; 182 | wc.cbWndExtra = 0; 183 | wc.hInstance = hInstance; 184 | wc.hIcon = NULL; 185 | wc.hCursor = NULL; 186 | wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); 187 | wc.lpszMenuName = NULL; 188 | wc.lpszClassName = szNekoClassName; 189 | 190 | if( RegisterClass(&wc) ) 191 | { 192 | //create the window 193 | g_hWndMain = CreateWindow( szNekoClassName, szNekoWindowTitle, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, hInstance, NULL); 194 | 195 | if( g_hWndMain == NULL ) return FALSE; 196 | } 197 | else 198 | return FALSE; 199 | 200 | //initialise random number generator 201 | srand( GetTickCount() ); 202 | return TRUE; 203 | } 204 | 205 | 206 | /* WinMain - program entry point *******************************************************/ 207 | int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) 208 | { 209 | //check for previous version & unload both if it's found 210 | HWND hWndOld = FindWindow( szNekoClassName, szNekoWindowTitle ); 211 | if( hWndOld != NULL ) 212 | { 213 | PostMessage( hWndOld, WM_QUIT, 0, 0 ); 214 | return FALSE; 215 | } 216 | 217 | //initialise the program 218 | if( !InitApplication( hInstance ) ) return FALSE; 219 | 220 | //create the tray object 221 | Tray = new CTray( hInstance ); 222 | 223 | //set a timer to update Neko 224 | SetTimer( g_hWndMain, ID_TIMER_NEKO, 200, NULL ); 225 | 226 | MSG msg; 227 | while( GetMessage( &msg, NULL, 0, 0 ) ) 228 | { 229 | //pass the message onto our WndProc 230 | TranslateMessage( &msg ); 231 | DispatchMessage( &msg ); 232 | } 233 | 234 | //remove the timer 235 | KillTimer( g_hWndMain, ID_TIMER_NEKO ); 236 | 237 | //delete all Nekos 238 | for( int i = 0; i < g_nNumCats; i++ ) delete g_NekoArray[i]; 239 | delete[] g_NekoArray; 240 | 241 | //remove the taskbar icon 242 | if( g_fTaskbar ) Tray->RemoveIcon( g_hWndMain, 1 ); 243 | delete Tray; 244 | 245 | return msg.wParam; 246 | } 247 | -------------------------------------------------------------------------------- /Neko98/Neko98.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="Neko98" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=Neko98 - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "Neko98.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "Neko98.mak" CFG="Neko98 - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "Neko98 - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "Neko98 - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "Neko98 - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 49 | # ADD BASE RSC /l 0x809 /d "NDEBUG" 50 | # ADD RSC /l 0x809 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # 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 /subsystem:windows /machine:I386 56 | # 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 winmm.lib /nologo /subsystem:windows /machine:I386 57 | 58 | !ELSEIF "$(CFG)" == "Neko98 - Win32 Debug" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Debug" 63 | # PROP BASE Intermediate_Dir "Debug" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "Debug" 68 | # PROP Intermediate_Dir "Debug" 69 | # PROP Ignore_Export_Lib 0 70 | # PROP Target_Dir "" 71 | # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c 72 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c 73 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 74 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 75 | # ADD BASE RSC /l 0x809 /d "_DEBUG" 76 | # ADD RSC /l 0x809 /d "_DEBUG" 77 | BSC32=bscmake.exe 78 | # ADD BASE BSC32 /nologo 79 | # ADD BSC32 /nologo 80 | LINK32=link.exe 81 | # 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 /subsystem:windows /debug /machine:I386 /pdbtype:sept 82 | # 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 winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 83 | 84 | !ENDIF 85 | 86 | # Begin Target 87 | 88 | # Name "Neko98 - Win32 Release" 89 | # Name "Neko98 - Win32 Debug" 90 | # Begin Group "Resources" 91 | 92 | # PROP Default_Filter ".ico;.bmp;.rc" 93 | # Begin Source File 94 | 95 | SOURCE=.\Res\Awake.ico 96 | # End Source File 97 | # Begin Source File 98 | 99 | SOURCE=.\Res\Down1.ico 100 | # End Source File 101 | # Begin Source File 102 | 103 | SOURCE=.\Res\down2.ico 104 | # End Source File 105 | # Begin Source File 106 | 107 | SOURCE=.\Res\downclaw1.ico 108 | # End Source File 109 | # Begin Source File 110 | 111 | SOURCE=.\Res\downclaw2.ico 112 | # End Source File 113 | # Begin Source File 114 | 115 | SOURCE=.\Res\downleft1.ico 116 | # End Source File 117 | # Begin Source File 118 | 119 | SOURCE=.\Res\Downleft2.ico 120 | # End Source File 121 | # Begin Source File 122 | 123 | SOURCE=.\Res\Downright1.ico 124 | # End Source File 125 | # Begin Source File 126 | 127 | SOURCE=.\Res\downright2.ico 128 | # End Source File 129 | # Begin Source File 130 | 131 | SOURCE=.\Res\fp_down.ico 132 | # End Source File 133 | # Begin Source File 134 | 135 | SOURCE=.\Res\fp_downleft.ico 136 | # End Source File 137 | # Begin Source File 138 | 139 | SOURCE=.\Res\fp_downright.ico 140 | # End Source File 141 | # Begin Source File 142 | 143 | SOURCE=.\Res\fp_left.ico 144 | # End Source File 145 | # Begin Source File 146 | 147 | SOURCE=.\Res\fp_right.ico 148 | # End Source File 149 | # Begin Source File 150 | 151 | SOURCE=.\Res\fp_up.ico 152 | # End Source File 153 | # Begin Source File 154 | 155 | SOURCE=.\Res\fp_upleft.ico 156 | # End Source File 157 | # Begin Source File 158 | 159 | SOURCE=.\Res\fp_upright.ico 160 | # End Source File 161 | # Begin Source File 162 | 163 | SOURCE=.\Res\left1.ico 164 | # End Source File 165 | # Begin Source File 166 | 167 | SOURCE=.\Res\left2.ico 168 | # End Source File 169 | # Begin Source File 170 | 171 | SOURCE=.\Res\leftclaw1.ico 172 | # End Source File 173 | # Begin Source File 174 | 175 | SOURCE=.\Res\leftclaw2.ico 176 | # End Source File 177 | # Begin Source File 178 | 179 | SOURCE=.\Neko95.rc 180 | # End Source File 181 | # Begin Source File 182 | 183 | SOURCE=.\Res\Right1.ico 184 | # End Source File 185 | # Begin Source File 186 | 187 | SOURCE=.\Res\right2.ico 188 | # End Source File 189 | # Begin Source File 190 | 191 | SOURCE=.\Res\rightclaw1.ico 192 | # End Source File 193 | # Begin Source File 194 | 195 | SOURCE=.\Res\Rightclaw2.ico 196 | # End Source File 197 | # Begin Source File 198 | 199 | SOURCE=.\Res\scratch1.ico 200 | # End Source File 201 | # Begin Source File 202 | 203 | SOURCE=.\Res\scratch2.ico 204 | # End Source File 205 | # Begin Source File 206 | 207 | SOURCE=.\Res\sleep1.ico 208 | # End Source File 209 | # Begin Source File 210 | 211 | SOURCE=.\Res\sleep2.ico 212 | # End Source File 213 | # Begin Source File 214 | 215 | SOURCE=.\Res\Up1.ico 216 | # End Source File 217 | # Begin Source File 218 | 219 | SOURCE=.\Res\Up2.ico 220 | # End Source File 221 | # Begin Source File 222 | 223 | SOURCE=.\Res\upclaw1.ico 224 | # End Source File 225 | # Begin Source File 226 | 227 | SOURCE=.\Res\upclaw2.ico 228 | # End Source File 229 | # Begin Source File 230 | 231 | SOURCE=.\Res\Upleft1.ico 232 | # End Source File 233 | # Begin Source File 234 | 235 | SOURCE=.\Res\Upleft2.ico 236 | # End Source File 237 | # Begin Source File 238 | 239 | SOURCE=.\Res\Upright1.ico 240 | # End Source File 241 | # Begin Source File 242 | 243 | SOURCE=.\Res\Upright2.ico 244 | # End Source File 245 | # Begin Source File 246 | 247 | SOURCE=.\Res\wash2.ico 248 | # End Source File 249 | # Begin Source File 250 | 251 | SOURCE=.\Res\yawn2.ico 252 | # End Source File 253 | # Begin Source File 254 | 255 | SOURCE=.\Res\yawn3.ico 256 | # End Source File 257 | # End Group 258 | # Begin Source File 259 | 260 | SOURCE=.\AlwaysOnTopPet.cpp 261 | # End Source File 262 | # Begin Source File 263 | 264 | SOURCE=.\AlwaysOnTopPet.h 265 | # End Source File 266 | # Begin Source File 267 | 268 | SOURCE=.\DesktopHack.cpp 269 | # End Source File 270 | # Begin Source File 271 | 272 | SOURCE=.\DesktopHack.h 273 | # End Source File 274 | # Begin Source File 275 | 276 | SOURCE=.\DesktopPet.cpp 277 | # End Source File 278 | # Begin Source File 279 | 280 | SOURCE=.\DesktopPet.h 281 | # End Source File 282 | # Begin Source File 283 | 284 | SOURCE=.\Neko.cpp 285 | # End Source File 286 | # Begin Source File 287 | 288 | SOURCE=.\Neko.h 289 | # End Source File 290 | # Begin Source File 291 | 292 | SOURCE=.\Neko98.cpp 293 | # End Source File 294 | # Begin Source File 295 | 296 | SOURCE=.\NekoCommon.h 297 | # End Source File 298 | # Begin Source File 299 | 300 | SOURCE=.\NekoSettings.cpp 301 | # End Source File 302 | # Begin Source File 303 | 304 | SOURCE=.\NekoSettings.h 305 | # End Source File 306 | # Begin Source File 307 | 308 | SOURCE=.\Pet.cpp 309 | # End Source File 310 | # Begin Source File 311 | 312 | SOURCE=.\Pet.h 313 | # End Source File 314 | # Begin Source File 315 | 316 | SOURCE=.\Tray.cpp 317 | # End Source File 318 | # Begin Source File 319 | 320 | SOURCE=.\Tray.h 321 | # End Source File 322 | # End Target 323 | # End Project 324 | -------------------------------------------------------------------------------- /Neko98/AlwaysOnTopPet.cpp: -------------------------------------------------------------------------------- 1 | // AlwaysOnTopPet.cpp: implementation of the CAlwaysOnTopPet class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "AlwaysOnTopPet.h" 6 | 7 | //class name constant 8 | static const char* g_szOnTopClassName = "NekoOnTop_Wnd"; 9 | 10 | //forward declaration 11 | LRESULT CALLBACK WndProc_OnTop( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 12 | 13 | //static member 14 | BOOL CAlwaysOnTopPet::m_fRegisteredClass = FALSE; 15 | 16 | //external global variable 17 | extern HINSTANCE g_hInstance; 18 | 19 | ////////////////////////////////////////////////////////////////////// 20 | // Construction/Destruction 21 | ////////////////////////////////////////////////////////////////////// 22 | 23 | CAlwaysOnTopPet::CAlwaysOnTopPet() : CPet() 24 | { 25 | //clear regions 26 | m_hRgns = NULL; 27 | 28 | //initialise members 29 | m_fBeingDragged = FALSE; 30 | m_hWndOnTop = NULL; 31 | 32 | //register class 33 | if( m_fRegisteredClass == FALSE ) 34 | { 35 | WNDCLASS wc; 36 | 37 | wc.style = CS_OWNDC|CS_DBLCLKS|CS_SAVEBITS; 38 | wc.lpfnWndProc = (WNDPROC)WndProc_OnTop; 39 | wc.cbClsExtra = 0; 40 | wc.cbWndExtra = sizeof(LPVOID); 41 | wc.hInstance = g_hInstance; 42 | wc.hIcon = NULL; 43 | wc.hCursor = LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ); 44 | wc.hbrBackground = NULL; 45 | wc.lpszMenuName = NULL; 46 | wc.lpszClassName = g_szOnTopClassName; 47 | 48 | m_fRegisteredClass = RegisterClass(&wc); 49 | } 50 | 51 | //set bounding rectangle 52 | SetRect( &m_rcBounds, 0, 0, GetSystemMetrics(SM_CXSCREEN)-1, GetSystemMetrics(SM_CYSCREEN)-1 ); 53 | 54 | //move this pet off-screen to start with 55 | m_ptPosition.x = m_rcBounds.right; 56 | m_ptPosition.y = m_rcBounds.bottom; 57 | } 58 | 59 | CAlwaysOnTopPet::~CAlwaysOnTopPet() 60 | { 61 | DestroyWindow( m_hWndOnTop ); 62 | } 63 | 64 | 65 | 66 | ////////////////////////////////////////////////////////////////////// 67 | // Member Functions 68 | ////////////////////////////////////////////////////////////////////// 69 | 70 | void CAlwaysOnTopPet::Draw( int nImage ) 71 | { 72 | //only draw if it's different && not being dragged 73 | if( nImage != m_nLastIcon && m_fBeingDragged == FALSE ) 74 | { 75 | //clip the window to the shape of the icon 76 | HRGN hRgnCopy = CreateRectRgn( 0, 0, m_sizeImage.cx, m_sizeImage.cy ); 77 | CombineRgn( hRgnCopy, m_hRgns[nImage], NULL, RGN_COPY ); 78 | SetWindowRgn( m_hWndOnTop, hRgnCopy, TRUE ); 79 | 80 | //draw the current frame on the window 81 | HDC hDC = GetDC( m_hWndOnTop ); 82 | DrawIconEx( hDC, 0, 0, m_hIcons[nImage], m_sizeImage.cx, m_sizeImage.cy, 0, NULL, DI_NORMAL ); 83 | ReleaseDC( m_hWndOnTop, hDC ); 84 | } 85 | } 86 | 87 | void CAlwaysOnTopPet::Erase() 88 | { 89 | //do nothing 90 | } 91 | 92 | void CAlwaysOnTopPet::SetImages(HICON * hIconTable, int nIcons ) 93 | { 94 | //remove current region handles 95 | DestroyRegions(); 96 | 97 | //call base class 98 | CPet::SetImages( hIconTable, nIcons ); 99 | 100 | //prepare region handles 101 | BuildRegions(); 102 | 103 | //create the window if it doesn't exist already 104 | if( m_hWndOnTop == NULL ) 105 | { 106 | m_hWndOnTop = CreateWindowEx( WS_EX_TOPMOST|WS_EX_TOOLWINDOW, g_szOnTopClassName, NULL, WS_POPUP, m_ptPosition.x, m_ptPosition.y, m_sizeImage.cx, m_sizeImage.cy, NULL, NULL, g_hInstance, NULL ); 107 | 108 | if( m_hWndOnTop ) 109 | { 110 | SetWindowLong( m_hWndOnTop, 0, (LONG)this ); 111 | ShowWindow( m_hWndOnTop, SW_SHOWNA ); 112 | UpdateWindow( m_hWndOnTop ); 113 | } 114 | } 115 | 116 | //FIXME: don't change it in the whole class, just this window!!! 117 | //change it's default icon 118 | //SetClassLong( m_hWndOnTop, GCL_HICON, m_hIcons[0] ); 119 | } 120 | 121 | void CAlwaysOnTopPet::DestroyImages() 122 | { 123 | //call base class 124 | CPet::DestroyImages(); 125 | 126 | //delete regions 127 | DestroyRegions(); 128 | } 129 | 130 | void CAlwaysOnTopPet::DrawOnTarget( int x, int y, HICON hIcon ) 131 | { 132 | //grab the device context of the display 133 | HDC hDC = GetDC( NULL ); 134 | 135 | //draw the icon on it 136 | DrawIconEx( hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL ); 137 | 138 | //release the device context 139 | ReleaseDC( NULL, hDC ); 140 | } 141 | 142 | 143 | 144 | 145 | 146 | ////////////////////////////////////////////////////////////////////// 147 | // On Top Window Procedure 148 | ////////////////////////////////////////////////////////////////////// 149 | 150 | LRESULT CALLBACK WndProc_OnTop( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) 151 | { 152 | switch( uMsg ) 153 | { 154 | case WM_PAINT: 155 | { 156 | //draw the most recent icon if the window is being dragged 157 | CAlwaysOnTopPet* pPet = (CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ); 158 | if( pPet->m_fBeingDragged ) 159 | { 160 | //draw the current icon onto the window (we can't call draw because it checks for icon index and changes the window's region 161 | HDC hDC = GetDC( hWnd ); 162 | DrawIconEx( hDC, 0, 0, pPet->m_hIcons[pPet->m_nLastIcon], pPet->GetSize().cx, pPet->GetSize().cy, 0, NULL, DI_NORMAL ); 163 | ReleaseDC( hWnd, hDC ); 164 | } 165 | ValidateRect( hWnd, NULL ); 166 | break; 167 | } 168 | 169 | case WM_SYSCOMMAND: 170 | //if the user alt+F4s us or (somehow) minimises or maximises us, ignore it 171 | if( LOWORD(wParam) != SC_CLOSE && LOWORD(wParam) != SC_MINIMIZE && LOWORD(wParam) != SC_MAXIMIZE ) 172 | return DefWindowProc( hWnd, uMsg, wParam, lParam ); 173 | break; 174 | 175 | case WM_ERASEBKGND: 176 | return TRUE; //don't erase the background 177 | 178 | //pass mouse messages onto the class 179 | case WM_LBUTTONDOWN: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnLButtonDown(); break; 180 | case WM_LBUTTONUP: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnLButtonUp(); break; 181 | case WM_LBUTTONDBLCLK: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnLButtonDblClk(); break; 182 | 183 | case WM_MBUTTONDOWN: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnMButtonDown(); break; 184 | case WM_MBUTTONUP: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnMButtonUp(); break; 185 | case WM_MBUTTONDBLCLK: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnMButtonDblClk(); break; 186 | 187 | case WM_RBUTTONDOWN: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnRButtonDown(); break; 188 | case WM_RBUTTONUP: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnRButtonUp(); break; 189 | case WM_RBUTTONDBLCLK: ((CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ))->OnRButtonDblClk(); break; 190 | 191 | //window is being dragged 192 | case WM_ENTERSIZEMOVE: 193 | { 194 | CAlwaysOnTopPet* pPet = (CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ); 195 | pPet->m_fBeingDragged = TRUE; 196 | break; 197 | } 198 | 199 | //window is being dropped 200 | case WM_EXITSIZEMOVE: 201 | { 202 | CAlwaysOnTopPet* pPet = (CAlwaysOnTopPet*)GetWindowLong( hWnd, 0 ); 203 | pPet->m_fBeingDragged = FALSE; 204 | RECT rc; 205 | GetWindowRect( hWnd, &rc ); 206 | pPet->MoveTo( rc.left, rc.top ); 207 | break; 208 | } 209 | 210 | default: 211 | return DefWindowProc( hWnd, uMsg, wParam, lParam ); 212 | } 213 | return 0; 214 | } 215 | 216 | void CAlwaysOnTopPet::OnLButtonDown() 217 | { 218 | //default left button handler - begin window dragging 219 | SendMessage( m_hWndOnTop, WM_SYSCOMMAND, SC_MOVE+2, 0 ); 220 | } 221 | 222 | void CAlwaysOnTopPet::DestroyRegions() 223 | { 224 | if( m_hRgns ) 225 | { 226 | //delete all regions and free the array 227 | for( int i = 0; i < m_nIcons; i++ ) if( m_hRgns[i] ) DeleteObject( m_hRgns[i] ); 228 | delete[] m_hRgns; 229 | m_hRgns = NULL; 230 | } 231 | } 232 | 233 | void CAlwaysOnTopPet::MoveTo(int nNewX, int nNewY) 234 | { 235 | if( m_fBeingDragged == FALSE ) 236 | { 237 | //store current position 238 | m_ptOldPosition.x = m_ptPosition.x; 239 | m_ptOldPosition.y = m_ptPosition.y; 240 | 241 | //change current position 242 | m_ptPosition.x = nNewX; 243 | m_ptPosition.y = nNewY; 244 | 245 | //move the window if it's not being moved by something else 246 | MoveWindow( m_hWndOnTop, nNewX, nNewY, m_sizeImage.cx, m_sizeImage.cy, TRUE ); 247 | } 248 | } 249 | 250 | 251 | void CAlwaysOnTopPet::SetImageAndMoveTo(int nImage, int nNewX, int nNewY) 252 | { 253 | if( m_fBeingDragged == FALSE ) 254 | { 255 | //move 256 | MoveTo( nNewX, nNewY ); 257 | 258 | //change image 259 | Draw( nImage ); 260 | m_nLastIcon = nImage; 261 | } 262 | } 263 | 264 | void CAlwaysOnTopPet::SetImage( int nImage ) 265 | { 266 | if( m_fBeingDragged == FALSE ) CPet::SetImage( nImage ); 267 | } 268 | 269 | 270 | 271 | //This function was based on the BitmapToRegion function found in www.codeguru.com's "bitmaps and palettes" section 272 | // Author : Jean-Edouard Lachand-Robert (http://www.geocities.com/Paris/LeftBank/1160/resume.htm), June 1998. 273 | void CAlwaysOnTopPet::BuildRegions() 274 | { 275 | //create a memory DC inside which we will scan the bitmap content 276 | HDC hMemDC = CreateCompatibleDC(NULL); 277 | 278 | //create a 32 bits depth bitmap and select it into the memory DC 279 | BITMAPINFOHEADER bi = { sizeof(BITMAPINFOHEADER), int(m_sizeImage.cx/m_fScale), int(m_sizeImage.cy/m_fScale), 1, 16, BI_RGB, 0, 0, 0, 0, 0 }; 280 | VOID* pBitsDib; 281 | HBITMAP hBmDib = CreateDIBSection( hMemDC, (BITMAPINFO*)&bi, DIB_RGB_COLORS, &pBitsDib, NULL, 0 ); 282 | HBITMAP hOldMemBmp = (HBITMAP)SelectObject( hMemDC, hBmDib ); 283 | 284 | //create a DC just to copy the bitmap into the memory DC 285 | HDC hDC = CreateCompatibleDC( hMemDC ); 286 | 287 | //get how many bytes per row we have for the bitmap bits (rounded up to 32 bits) 288 | BITMAP bmDib; 289 | GetObject( hBmDib, sizeof(bmDib), &bmDib ); 290 | while( bmDib.bmWidthBytes % 4 ) bmDib.bmWidthBytes++; 291 | 292 | //calculate scaling matrix 293 | XFORM xForm = { m_fScale, 0.0, 0.0, m_fScale, 0.0, 0.0 }; 294 | 295 | //allocate the region array 296 | m_hRgns = new HRGN[m_nIcons]; 297 | 298 | //build all regions 299 | for( int i = 0; i < m_nIcons; i++ ) 300 | { 301 | HRGN hRgn = NULL; 302 | 303 | //extract icon mask image 304 | ICONINFO ii; 305 | GetIconInfo( m_hIcons[i], &ii ); 306 | DeleteObject( ii.hbmColor ); 307 | 308 | //get bitmap size 309 | BITMAP bm; 310 | GetObject( ii.hbmMask, sizeof(bm), &bm ); 311 | 312 | //copy the bitmap into the memory DC 313 | HBITMAP hOldBmp = (HBITMAP)SelectObject( hDC, ii.hbmMask ); 314 | BitBlt( hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, hDC, 0, 0, SRCCOPY ); 315 | 316 | //For better performances, we will use the ExtCreateRegion() function to create the 317 | //region. This function take a RGNDATA structure on entry. We will add rectangles by 318 | //amount of ALLOC_UNIT number in this structure. 319 | #define ALLOC_UNIT 100 320 | DWORD dwMaxRects = ALLOC_UNIT; 321 | HANDLE hData = GlobalAlloc( GMEM_MOVEABLE, sizeof(RGNDATAHEADER) + (sizeof(RECT) * dwMaxRects) ); 322 | RGNDATA* pData = (RGNDATA *)GlobalLock( hData ); 323 | pData->rdh.dwSize = sizeof(RGNDATAHEADER); 324 | pData->rdh.iType = RDH_RECTANGLES; 325 | pData->rdh.nCount = pData->rdh.nRgnSize = 0; 326 | SetRect( &pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0 ); 327 | 328 | //scan each bitmap row from bottom to top (the bitmap is inverted vertically) 329 | BYTE* pDib = (BYTE*)bmDib.bmBits + (bmDib.bmHeight - 1) * bmDib.bmWidthBytes; 330 | for( int y = 0; y < bm.bmHeight; y++ ) 331 | { 332 | //scan each bitmap pixel from left to right 333 | for( int x = 0; x < bm.bmWidth; x++ ) 334 | { 335 | //search for a continuous range of "non transparent pixels" 336 | int x0 = x; 337 | WORD* p = (WORD*)pDib + x; 338 | while( x < bm.bmWidth) 339 | { 340 | if( *p != 0 ) 341 | //This pixel is "transparent" 342 | break; 343 | 344 | p++; 345 | x++; 346 | } 347 | 348 | if( x > x0 ) 349 | { 350 | //Add the pixels (x0, y) to (x, y+1) as a new rectangle in the region 351 | if( pData->rdh.nCount >= dwMaxRects ) 352 | { 353 | GlobalUnlock(hData); 354 | dwMaxRects += ALLOC_UNIT; 355 | hData = GlobalReAlloc( hData, sizeof(RGNDATAHEADER) + (sizeof(RECT) * dwMaxRects), GMEM_MOVEABLE ); 356 | pData = (RGNDATA*)GlobalLock(hData); 357 | } 358 | RECT* pr = (RECT*)&pData->Buffer; 359 | SetRect(&pr[pData->rdh.nCount], x0, y, x, y+1); 360 | if (x0 < pData->rdh.rcBound.left) pData->rdh.rcBound.left = x0; 361 | if (y < pData->rdh.rcBound.top) pData->rdh.rcBound.top = y; 362 | if (x > pData->rdh.rcBound.right) pData->rdh.rcBound.right = x; 363 | if (y+1 > pData->rdh.rcBound.bottom) pData->rdh.rcBound.bottom = y+1; 364 | pData->rdh.nCount++; 365 | 366 | //On Windows98, ExtCreateRegion() may fail if the number of rectangles is too 367 | //large (ie: > 4000). Therefore, we have to create the region by multiple steps. 368 | if( pData->rdh.nCount == 2000 ) 369 | { 370 | HRGN h = ExtCreateRegion( &xForm, sizeof(RGNDATAHEADER) + (sizeof(RECT) * dwMaxRects), pData); 371 | if( hRgn ) 372 | { 373 | CombineRgn( hRgn, hRgn, h, RGN_OR ); 374 | DeleteObject(h); 375 | } 376 | else 377 | hRgn = h; 378 | 379 | pData->rdh.nCount = 0; 380 | SetRect( &pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0 ); 381 | } 382 | } 383 | } 384 | 385 | //go to next row (remember, the bitmap is inverted vertically) 386 | pDib -= bmDib.bmWidthBytes; 387 | } 388 | 389 | //create or extend the region with the remaining rectangles 390 | HRGN h = ExtCreateRegion( &xForm, sizeof(RGNDATAHEADER) + (sizeof(RECT) * dwMaxRects), pData ); 391 | if( hRgn ) 392 | { 393 | CombineRgn( hRgn, hRgn, h, RGN_OR ); 394 | DeleteObject(h); 395 | } 396 | else 397 | hRgn = h; 398 | 399 | //clean up 400 | DeleteObject( SelectObject( hDC, hOldBmp ) ); 401 | GlobalFree(hData); 402 | 403 | //store the region 404 | m_hRgns[i] = hRgn; 405 | } 406 | 407 | //clean up 408 | DeleteDC(hDC); 409 | DeleteObject( SelectObject( hMemDC, hOldMemBmp ) ); 410 | DeleteDC( hMemDC ); 411 | } 412 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 16 | 17 | 18 | 19 | 20 | 29 | 32 | 35 | 38 | 41 | 50 | 65 | 68 | 73 | 76 | 88 | 91 | 94 | 97 | 102 | 105 | 108 | 111 | 112 | 121 | 124 | 127 | 130 | 133 | 142 | 156 | 159 | 164 | 167 | 180 | 183 | 186 | 189 | 194 | 197 | 200 | 203 | 204 | 213 | 216 | 219 | 222 | 225 | 234 | 249 | 252 | 257 | 260 | 272 | 275 | 278 | 281 | 286 | 289 | 292 | 295 | 296 | 305 | 308 | 311 | 314 | 317 | 326 | 340 | 343 | 348 | 351 | 364 | 367 | 370 | 373 | 378 | 381 | 384 | 387 | 388 | 389 | 390 | 391 | 392 | 396 | 399 | 400 | 403 | 404 | 407 | 408 | 411 | 412 | 415 | 416 | 419 | 420 | 423 | 424 | 427 | 428 | 431 | 432 | 433 | 437 | 440 | 441 | 444 | 445 | 446 | 449 | 452 | 456 | 457 | 460 | 464 | 465 | 468 | 472 | 473 | 476 | 480 | 481 | 482 | 485 | 486 | 489 | 492 | 496 | 497 | 500 | 504 | 505 | 508 | 512 | 513 | 516 | 520 | 521 | 522 | 525 | 526 | 529 | 532 | 536 | 537 | 540 | 544 | 545 | 548 | 552 | 553 | 556 | 560 | 561 | 562 | 565 | 566 | 569 | 572 | 576 | 577 | 580 | 584 | 585 | 588 | 592 | 593 | 596 | 600 | 601 | 602 | 605 | 606 | 607 | 608 | 609 | 610 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {4BD17A4F-5310-41E6-9BA6-D8BDF6ADD2F8} 23 | 24 | 25 | 26 | Application 27 | false 28 | 29 | 30 | Application 31 | false 32 | 33 | 34 | Application 35 | false 36 | 37 | 38 | Application 39 | false 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | <_ProjectFileVersion>10.0.40219.1 63 | .\Release\ 64 | .\Release\ 65 | false 66 | .\Debug\ 67 | .\Debug\ 68 | true 69 | $(Platform)\$(Configuration)\ 70 | $(Platform)\$(Configuration)\ 71 | false 72 | $(Platform)\$(Configuration)\ 73 | $(Platform)\$(Configuration)\ 74 | true 75 | AllRules.ruleset 76 | 77 | 78 | AllRules.ruleset 79 | 80 | 81 | AllRules.ruleset 82 | 83 | 84 | AllRules.ruleset 85 | 86 | 87 | 88 | 89 | 90 | NDEBUG;%(PreprocessorDefinitions) 91 | true 92 | true 93 | Win32 94 | .\Release/NekoCFG.tlb 95 | 96 | 97 | 98 | 99 | MaxSpeed 100 | OnlyExplicitInline 101 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 102 | true 103 | MultiThreaded 104 | true 105 | .\Release/NekoCFG.pch 106 | .\Release/ 107 | .\Release/ 108 | .\Release/ 109 | Level3 110 | true 111 | 112 | 113 | NDEBUG;%(PreprocessorDefinitions) 114 | 0x0809 115 | 116 | 117 | odbc32.lib;odbccp32.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies) 118 | .\Release/NekoCFG.exe 119 | true 120 | .\Release/NekoCFG.pdb 121 | Windows 122 | false 123 | 124 | 125 | MachineX86 126 | 127 | 128 | true 129 | .\Release/NekoCFG.bsc 130 | 131 | 132 | 133 | 134 | _DEBUG;%(PreprocessorDefinitions) 135 | true 136 | true 137 | Win32 138 | .\Debug/NekoCFG.tlb 139 | 140 | 141 | 142 | 143 | Disabled 144 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 145 | true 146 | MultiThreadedDebug 147 | .\Debug/NekoCFG.pch 148 | .\Debug/ 149 | .\Debug/ 150 | .\Debug/ 151 | Level3 152 | true 153 | EditAndContinue 154 | 155 | 156 | _DEBUG;%(PreprocessorDefinitions) 157 | 0x0809 158 | 159 | 160 | comctl32.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 161 | .\Debug/NekoCFG.exe 162 | true 163 | true 164 | .\Debug/NekoCFG.pdb 165 | Windows 166 | false 167 | 168 | 169 | MachineX86 170 | 171 | 172 | true 173 | .\Debug/NekoCFG.bsc 174 | 175 | 176 | 177 | 178 | NDEBUG;%(PreprocessorDefinitions) 179 | true 180 | true 181 | X64 182 | .\Release/NekoCFG.tlb 183 | 184 | 185 | 186 | 187 | MaxSpeed 188 | OnlyExplicitInline 189 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 190 | true 191 | MultiThreaded 192 | true 193 | .\Release/NekoCFG.pch 194 | .\Release/ 195 | .\Release/ 196 | .\Release/ 197 | Level3 198 | true 199 | 200 | 201 | NDEBUG;%(PreprocessorDefinitions) 202 | 0x0809 203 | 204 | 205 | odbc32.lib;odbccp32.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies) 206 | .\Release/NekoCFG.exe 207 | true 208 | .\Release/NekoCFG.pdb 209 | Windows 210 | false 211 | 212 | 213 | MachineX64 214 | 215 | 216 | true 217 | .\Release/NekoCFG.bsc 218 | 219 | 220 | 221 | 222 | _DEBUG;%(PreprocessorDefinitions) 223 | true 224 | true 225 | X64 226 | .\Debug/NekoCFG.tlb 227 | 228 | 229 | 230 | 231 | Disabled 232 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 233 | true 234 | MultiThreadedDebug 235 | .\Debug/NekoCFG.pch 236 | .\Debug/ 237 | .\Debug/ 238 | .\Debug/ 239 | Level3 240 | true 241 | ProgramDatabase 242 | 243 | 244 | _DEBUG;%(PreprocessorDefinitions) 245 | 0x0809 246 | 247 | 248 | comctl32.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 249 | .\Debug/NekoCFG.exe 250 | true 251 | true 252 | .\Debug/NekoCFG.pdb 253 | Windows 254 | false 255 | 256 | 257 | MachineX64 258 | 259 | 260 | true 261 | .\Debug/NekoCFG.bsc 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | %(PreprocessorDefinitions) 280 | %(PreprocessorDefinitions) 281 | %(PreprocessorDefinitions) 282 | %(PreprocessorDefinitions) 283 | 284 | 285 | %(PreprocessorDefinitions) 286 | %(PreprocessorDefinitions) 287 | %(PreprocessorDefinitions) 288 | %(PreprocessorDefinitions) 289 | 290 | 291 | %(PreprocessorDefinitions) 292 | %(PreprocessorDefinitions) 293 | %(PreprocessorDefinitions) 294 | %(PreprocessorDefinitions) 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | %(PreprocessorDefinitions) 306 | %(PreprocessorDefinitions) 307 | %(PreprocessorDefinitions) 308 | %(PreprocessorDefinitions) 309 | 310 | 311 | 312 | 313 | 314 | -------------------------------------------------------------------------------- /Neko98/Neko98.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 16 | 17 | 18 | 19 | 20 | 29 | 32 | 35 | 38 | 41 | 50 | 65 | 68 | 73 | 76 | 88 | 91 | 94 | 97 | 102 | 105 | 108 | 111 | 112 | 121 | 124 | 127 | 130 | 133 | 142 | 156 | 159 | 164 | 167 | 180 | 183 | 186 | 189 | 194 | 197 | 200 | 203 | 204 | 213 | 216 | 219 | 222 | 225 | 234 | 249 | 252 | 257 | 260 | 272 | 275 | 278 | 281 | 286 | 289 | 292 | 295 | 296 | 305 | 308 | 311 | 314 | 317 | 326 | 340 | 343 | 348 | 351 | 364 | 367 | 370 | 373 | 378 | 381 | 384 | 387 | 388 | 389 | 390 | 391 | 392 | 396 | 399 | 400 | 403 | 404 | 407 | 408 | 411 | 412 | 415 | 416 | 419 | 420 | 423 | 424 | 427 | 428 | 431 | 432 | 435 | 436 | 439 | 440 | 443 | 444 | 447 | 448 | 451 | 452 | 455 | 456 | 459 | 460 | 463 | 464 | 467 | 468 | 471 | 472 | 475 | 476 | 479 | 480 | 483 | 486 | 490 | 491 | 494 | 498 | 499 | 502 | 506 | 507 | 510 | 514 | 515 | 516 | 519 | 520 | 523 | 524 | 527 | 528 | 531 | 532 | 535 | 536 | 539 | 540 | 543 | 544 | 547 | 548 | 551 | 552 | 555 | 556 | 559 | 560 | 563 | 564 | 567 | 568 | 571 | 572 | 575 | 576 | 579 | 580 | 583 | 584 | 587 | 588 | 591 | 592 | 593 | 596 | 599 | 603 | 604 | 607 | 611 | 612 | 615 | 619 | 620 | 623 | 627 | 628 | 629 | 632 | 633 | 636 | 639 | 643 | 644 | 647 | 651 | 652 | 655 | 659 | 660 | 663 | 667 | 668 | 669 | 672 | 673 | 676 | 679 | 683 | 684 | 687 | 691 | 692 | 695 | 699 | 700 | 703 | 707 | 708 | 709 | 712 | 713 | 716 | 719 | 723 | 724 | 727 | 731 | 732 | 735 | 739 | 740 | 743 | 747 | 748 | 749 | 752 | 753 | 756 | 759 | 763 | 764 | 767 | 771 | 772 | 775 | 779 | 780 | 783 | 787 | 788 | 789 | 792 | 793 | 796 | 799 | 803 | 804 | 807 | 811 | 812 | 815 | 819 | 820 | 823 | 827 | 828 | 829 | 832 | 833 | 836 | 839 | 843 | 844 | 847 | 851 | 852 | 855 | 859 | 860 | 863 | 867 | 868 | 869 | 872 | 873 | 876 | 879 | 883 | 884 | 887 | 891 | 892 | 895 | 899 | 900 | 903 | 907 | 908 | 909 | 912 | 913 | 914 | 915 | 916 | 917 | -------------------------------------------------------------------------------- /Neko98/Neko98.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {83EABCC5-4247-43DD-A941-F7E76FA7C5A6} 23 | 24 | 25 | 26 | Application 27 | false 28 | 29 | 30 | Application 31 | false 32 | 33 | 34 | Application 35 | false 36 | 37 | 38 | Application 39 | false 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | <_ProjectFileVersion>10.0.40219.1 63 | .\Release\ 64 | .\Release\ 65 | false 66 | .\Debug\ 67 | .\Debug\ 68 | true 69 | $(Platform)\$(Configuration)\ 70 | $(Platform)\$(Configuration)\ 71 | false 72 | $(Platform)\$(Configuration)\ 73 | $(Platform)\$(Configuration)\ 74 | true 75 | AllRules.ruleset 76 | 77 | 78 | AllRules.ruleset 79 | 80 | 81 | AllRules.ruleset 82 | 83 | 84 | AllRules.ruleset 85 | 86 | 87 | 88 | 89 | 90 | NDEBUG;%(PreprocessorDefinitions) 91 | true 92 | true 93 | Win32 94 | .\Release/Neko98.tlb 95 | 96 | 97 | 98 | 99 | MaxSpeed 100 | AnySuitable 101 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 102 | true 103 | MultiThreaded 104 | true 105 | .\Release/Neko98.pch 106 | .\Release/ 107 | .\Release/ 108 | .\Release/ 109 | Level3 110 | true 111 | 112 | 113 | NDEBUG;%(PreprocessorDefinitions) 114 | 0x0809 115 | 116 | 117 | odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 118 | .\Release/Neko98.exe 119 | true 120 | .\Release/Neko98.pdb 121 | Windows 122 | false 123 | 124 | 125 | MachineX86 126 | 127 | 128 | true 129 | .\Release/Neko98.bsc 130 | 131 | 132 | 133 | 134 | _DEBUG;%(PreprocessorDefinitions) 135 | true 136 | true 137 | Win32 138 | .\Debug/Neko98.tlb 139 | 140 | 141 | 142 | 143 | Disabled 144 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 145 | true 146 | MultiThreadedDebug 147 | .\Debug/Neko98.pch 148 | .\Debug/ 149 | .\Debug/ 150 | .\Debug/ 151 | Level3 152 | true 153 | EditAndContinue 154 | 155 | 156 | _DEBUG;%(PreprocessorDefinitions) 157 | 0x0809 158 | 159 | 160 | odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 161 | .\Debug/Neko98.exe 162 | true 163 | true 164 | .\Debug/Neko98.pdb 165 | Windows 166 | false 167 | 168 | 169 | MachineX86 170 | 171 | 172 | true 173 | .\Debug/Neko98.bsc 174 | 175 | 176 | 177 | 178 | NDEBUG;%(PreprocessorDefinitions) 179 | true 180 | true 181 | X64 182 | .\Release/Neko98.tlb 183 | 184 | 185 | 186 | 187 | MaxSpeed 188 | AnySuitable 189 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 190 | true 191 | MultiThreaded 192 | true 193 | .\Release/Neko98.pch 194 | .\Release/ 195 | .\Release/ 196 | .\Release/ 197 | Level3 198 | true 199 | 200 | 201 | NDEBUG;%(PreprocessorDefinitions) 202 | 0x0809 203 | 204 | 205 | odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 206 | .\Release/Neko98.exe 207 | true 208 | .\Release/Neko98.pdb 209 | Windows 210 | false 211 | 212 | 213 | MachineX64 214 | 215 | 216 | true 217 | .\Release/Neko98.bsc 218 | 219 | 220 | 221 | 222 | _DEBUG;%(PreprocessorDefinitions) 223 | true 224 | true 225 | X64 226 | .\Debug/Neko98.tlb 227 | 228 | 229 | 230 | 231 | Disabled 232 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 233 | true 234 | MultiThreadedDebug 235 | .\Debug/Neko98.pch 236 | .\Debug/ 237 | .\Debug/ 238 | .\Debug/ 239 | Level3 240 | true 241 | ProgramDatabase 242 | 243 | 244 | _DEBUG;%(PreprocessorDefinitions) 245 | 0x0809 246 | 247 | 248 | odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 249 | .\Debug/Neko98.exe 250 | true 251 | true 252 | .\Debug/Neko98.pdb 253 | Windows 254 | false 255 | 256 | 257 | MachineX64 258 | 259 | 260 | true 261 | .\Debug/Neko98.bsc 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | %(PreprocessorDefinitions) 309 | %(PreprocessorDefinitions) 310 | %(PreprocessorDefinitions) 311 | %(PreprocessorDefinitions) 312 | 313 | 314 | 315 | 316 | %(PreprocessorDefinitions) 317 | %(PreprocessorDefinitions) 318 | %(PreprocessorDefinitions) 319 | %(PreprocessorDefinitions) 320 | 321 | 322 | %(PreprocessorDefinitions) 323 | %(PreprocessorDefinitions) 324 | %(PreprocessorDefinitions) 325 | %(PreprocessorDefinitions) 326 | 327 | 328 | %(PreprocessorDefinitions) 329 | %(PreprocessorDefinitions) 330 | %(PreprocessorDefinitions) 331 | %(PreprocessorDefinitions) 332 | 333 | 334 | %(PreprocessorDefinitions) 335 | %(PreprocessorDefinitions) 336 | %(PreprocessorDefinitions) 337 | %(PreprocessorDefinitions) 338 | 339 | 340 | %(PreprocessorDefinitions) 341 | %(PreprocessorDefinitions) 342 | %(PreprocessorDefinitions) 343 | %(PreprocessorDefinitions) 344 | 345 | 346 | %(PreprocessorDefinitions) 347 | %(PreprocessorDefinitions) 348 | %(PreprocessorDefinitions) 349 | %(PreprocessorDefinitions) 350 | 351 | 352 | %(PreprocessorDefinitions) 353 | %(PreprocessorDefinitions) 354 | %(PreprocessorDefinitions) 355 | %(PreprocessorDefinitions) 356 | 357 | 358 | %(PreprocessorDefinitions) 359 | %(PreprocessorDefinitions) 360 | %(PreprocessorDefinitions) 361 | %(PreprocessorDefinitions) 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | -------------------------------------------------------------------------------- /Neko98/Neko.cpp: -------------------------------------------------------------------------------- 1 | // Neko.cpp: implementation of the CNeko class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include 6 | #include "NekoCommon.h" 7 | #include "NekoSettings.h" 8 | #include "Neko.h" 9 | #include "resource.h" 10 | #include 11 | 12 | //maths calculations 13 | #define g_dSinPiPer8 0.3826834323651 // sin [pi/8] 14 | #define g_dSinPiPer8Times3 0.9238795325113 // sin ( [pi/8] x 3 ) 15 | 16 | //misc. constants 17 | #define MAX_TICK 9999 //Odd Only 18 | 19 | //animation control constants 20 | #define STOP_TIME 4 21 | #define WASH_TIME 10 22 | #define SCRATCH_TIME 4 23 | #define YAWN_TIME 3 24 | #define AWAKE_TIME 3 25 | #define CLAW_TIME 10 26 | 27 | //external system variable 28 | extern HINSTANCE g_hInstance; 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////// 32 | // Construction/Destruction 33 | ////////////////////////////////////////////////////////////////////// 34 | 35 | CNeko::CNeko( char* lpszName ) 36 | { 37 | //store pet 38 | m_pPet = NULL; 39 | 40 | //plug icons into animation table 41 | m_nAnimation[STOP][0] = 28; m_nAnimation[STOP][1] = 28; 42 | m_nAnimation[WASH][0] = 25; m_nAnimation[WASH][1] = 28; 43 | m_nAnimation[SCRATCH][0] = 26; m_nAnimation[SCRATCH][1] = 27; 44 | m_nAnimation[YAWN][0] = 29; m_nAnimation[YAWN][1] = 29; 45 | m_nAnimation[SLEEP][0] = 30; m_nAnimation[SLEEP][1] = 31; 46 | m_nAnimation[AWAKE][0] = 0; m_nAnimation[AWAKE][1] = 0; 47 | m_nAnimation[U_MOVE][0] = 1; m_nAnimation[U_MOVE][1] = 2; 48 | m_nAnimation[D_MOVE][0] = 9; m_nAnimation[D_MOVE][1] = 10; 49 | m_nAnimation[L_MOVE][0] = 13; m_nAnimation[L_MOVE][1] = 14; 50 | m_nAnimation[R_MOVE][0] = 5; m_nAnimation[R_MOVE][1] = 6; 51 | m_nAnimation[UL_MOVE][0] = 15; m_nAnimation[UL_MOVE][1] = 16; 52 | m_nAnimation[UR_MOVE][0] = 3; m_nAnimation[UR_MOVE][1] = 4; 53 | m_nAnimation[DL_MOVE][0] = 11; m_nAnimation[DL_MOVE][1] = 12; 54 | m_nAnimation[DR_MOVE][0] = 7; m_nAnimation[DR_MOVE][1] = 8; 55 | m_nAnimation[U_CLAW][0] = 17; m_nAnimation[U_CLAW][1] = 18; 56 | m_nAnimation[D_CLAW][0] = 23; m_nAnimation[D_CLAW][1] = 24; 57 | m_nAnimation[L_CLAW][0] = 21; m_nAnimation[L_CLAW][1] = 22; 58 | m_nAnimation[R_CLAW][0] = 19; m_nAnimation[R_CLAW][1] = 20; 59 | 60 | //set variables 61 | m_nDX = m_nDY = 0; 62 | strcpy( m_szName, lpszName ); 63 | m_dwSpeed = 16; 64 | m_dwIdleSpace = 6; 65 | m_Action = CHASE_MOUSE; 66 | m_nActionCount = 0; 67 | *m_szFootprintLibname = '\0'; 68 | *m_szLibname = '\0'; 69 | m_bFootprints = FALSE; 70 | 71 | strcpy( m_szSndIdle1, "" ); 72 | strcpy( m_szSndIdle2, "" ); 73 | strcpy( m_szSndIdle3, "" ); 74 | strcpy( m_szSndSleep, "" ); 75 | strcpy( m_szSndAwake, "" ); 76 | m_dwSndFrequency = 0; 77 | m_dwScale = 100; 78 | 79 | //build configuration registry key 80 | char szKey[1024]; 81 | strcpy( szKey, szNekoRegKey ); 82 | if( strlen( m_szName ) > 0 ) 83 | { 84 | strcat( szKey, "\\" ); 85 | strcat( szKey, m_szName ); 86 | } 87 | 88 | //load configuration 89 | CNekoSettings NekoSettings( szKey, (strlen(m_szName) == 0) ); 90 | if( NekoSettings.IsOpen() ) 91 | { 92 | //load in all of the settings 93 | NekoSettings.GetInt( szNekoScaleKey, &m_dwScale ); 94 | NekoSettings.GetInt( szNekoSpeedKey, &m_dwSpeed ); 95 | NekoSettings.GetInt( szNekoSenseKey, &m_dwIdleSpace ); 96 | NekoSettings.GetString( szNekoLibraryKey, m_szLibname, MAX_PATH-1 ); 97 | NekoSettings.GetString( szNekoSndIdle1Key, m_szSndIdle1, MAX_PATH-1 ); 98 | NekoSettings.GetString( szNekoSndIdle2Key, m_szSndIdle2, MAX_PATH-1 ); 99 | NekoSettings.GetString( szNekoSndIdle3Key, m_szSndIdle3, MAX_PATH-1 ); 100 | NekoSettings.GetString( szNekoSndSleepKey, m_szSndSleep, MAX_PATH-1 ); 101 | NekoSettings.GetString( szNekoSndAwakeKey, m_szSndAwake, MAX_PATH-1 ); 102 | NekoSettings.GetInt( szNekoSndFreqKey, &m_dwSndFrequency ); 103 | NekoSettings.GetBool( szNekoFootprintKey, &m_bFootprints ); 104 | NekoSettings.GetString( szNekoFootprintLibKey, m_szFootprintLibname, MAX_PATH-1 ); 105 | 106 | DWORD dwAction = m_Action; 107 | NekoSettings.GetInt( szNekoActionKey, &dwAction ); 108 | m_Action = dwAction; 109 | 110 | 111 | DWORD bAlwaysOnTop = FALSE; 112 | NekoSettings.GetInt( szNekoOnTopKey, &bAlwaysOnTop ); 113 | 114 | //create the correct pet 115 | if( bAlwaysOnTop ) 116 | m_pPet = new CAlwaysOnTopPet(); 117 | else 118 | m_pPet = new CDesktopPet(); 119 | 120 | } 121 | else 122 | { 123 | //configuration didn't open... create a desktop pet only 124 | m_pPet = new CDesktopPet(); 125 | } 126 | 127 | //initialse footprint icons 128 | for( int i = 0; i < 8; i++ ) m_hIconFootprints[i] = NULL; 129 | 130 | //apply scaling 131 | m_pPet->SetScale( ((float)m_dwScale / 100.0f ) ); 132 | 133 | //load the images 134 | BOOL fLoadProblems = FALSE; 135 | if( m_szLibname == NULL || *m_szLibname == '\0' || ((int)ExtractIcon( g_hInstance, m_szLibname, -1 ) < 32 )) 136 | { 137 | //use default images if there is no file or not enough icons 138 | GetModuleFileName( NULL, m_szLibname, MAX_PATH ); 139 | fLoadProblems = !LoadImages(); 140 | } 141 | else 142 | { 143 | //load all the icons in the file 144 | fLoadProblems = !LoadImages(); 145 | if( fLoadProblems ) 146 | { 147 | //use default images if it fails with the user's choice 148 | GetModuleFileName( NULL, m_szLibname, MAX_PATH ); 149 | fLoadProblems = !LoadImages(); 150 | } 151 | } 152 | 153 | /* FIXME: 154 | 155 | It appears that Windows offers no support for ExtractIcon 156 | on icons that are not 32x32 - this means that all icon 157 | libraries selected by the user to use will have their icons 158 | scaled down to 32x32. I have tried the following: 159 | 160 | 1) Used LoadLibrary() to load the icon library chosen. This 161 | worked on some, but not all. I then used LoadLibraryEx() 162 | and passed it the 'don't call DllMain' flags. This caused 163 | the libraries that weren't working to work, and vice-versa. 164 | 165 | 2) After LoadLibrary(), attempting to load all resource IDs 166 | until 32 valid icons were loaded. This nearly worked, but 167 | took ages and was therefor unacceptable. It also failed 168 | with LoadLibrary() as in 1. 169 | 170 | 3) Tried EnumResourceNames() for all icons. It only loaded some 171 | of them and then gave up. At this point, so did I. 172 | 173 | Result: It is only possible to use 32x32 icons in Neko, although 174 | these can be scaled up or down as required, resulting in blockyness 175 | etc. 176 | 177 | */ 178 | 179 | //set initial state 180 | SetState( STOP ); 181 | 182 | //set initial action 183 | m_nActionX = m_pPet->GetBoundsRect().left + ( rand() % (m_pPet->GetBoundsRect().right-(m_dwSpeed * 8)) ); 184 | m_nActionY = m_pPet->GetBoundsRect().top + ( rand() % (m_pPet->GetBoundsRect().bottom-(m_dwSpeed * 8)) ); 185 | m_nActionDX = ((( rand() % 2 ) ? 1 : -1) * (m_dwSpeed/2)) + 1; 186 | m_nActionDY = ((( rand() % 2 ) ? 1 : -1) * (m_dwSpeed/2)) + 1; 187 | 188 | //set initial position (random) 189 | m_nToX = m_pPet->GetBoundsRect().left + ( rand() % ( (m_pPet->GetBoundsRect().right- m_pPet->GetSize().cx) - m_pPet->GetBoundsRect().left ) ) ; 190 | m_nToY = m_pPet->GetBoundsRect().top + ( rand() % ( (m_pPet->GetBoundsRect().bottom - m_pPet->GetSize().cy) - m_pPet->GetBoundsRect().top ) ); 191 | 192 | m_pPet->MoveTo( m_nToX, m_nToY ); 193 | 194 | //deal with error (fixme?) 195 | /* 196 | if( fLoadProblems ) 197 | throw ICON_EXCEPTION; 198 | */ 199 | } 200 | 201 | CNeko::~CNeko() 202 | { 203 | delete m_pPet; 204 | for( int i = 0; i < 8; i++ ) if( m_hIconFootprints[i] ) DestroyIcon( m_hIconFootprints[i] ); 205 | } 206 | 207 | BOOL CNeko::MoveStart() 208 | { 209 | return( !(( m_nOldToX >= m_nToX-(int)m_dwIdleSpace ) && 210 | ( m_nOldToX <= m_nToX+(int)m_dwIdleSpace ) && 211 | ( m_nOldToY >= m_nToY-(int)m_dwIdleSpace ) && 212 | ( m_nOldToY <= m_nToY+(int)m_dwIdleSpace ))); 213 | } 214 | 215 | void CNeko::CalcDirection() 216 | { 217 | State NewState; 218 | double LargeX, LargeY, Length, SinTheta; 219 | 220 | if( (m_nDX == 0) && (m_nDY == 0) ) 221 | NewState = STOP; 222 | else 223 | { 224 | LargeX = (double)m_nDX; 225 | LargeY = (double)(-m_nDY); 226 | Length = sqrt(LargeX * LargeX + LargeY * LargeY); 227 | SinTheta = LargeY / Length; 228 | 229 | if( m_nDX > 0 ) 230 | { 231 | if( SinTheta > g_dSinPiPer8Times3 ) 232 | NewState = U_MOVE; 233 | else 234 | if( (SinTheta <= g_dSinPiPer8Times3 ) && ( SinTheta > g_dSinPiPer8 ) ) 235 | NewState = UR_MOVE; 236 | else 237 | if( (SinTheta <= g_dSinPiPer8) && (SinTheta > -(g_dSinPiPer8) ) ) 238 | NewState = R_MOVE; 239 | else 240 | if( (SinTheta <= -(g_dSinPiPer8) ) && (SinTheta > -(g_dSinPiPer8Times3) ) ) 241 | NewState = DR_MOVE; 242 | else 243 | NewState = D_MOVE; 244 | } 245 | else 246 | { 247 | if( SinTheta > g_dSinPiPer8Times3 ) 248 | NewState = U_MOVE; 249 | else 250 | if( (SinTheta <= g_dSinPiPer8Times3) && (SinTheta > g_dSinPiPer8) ) 251 | NewState = UL_MOVE; 252 | else 253 | if( (SinTheta <= g_dSinPiPer8) && (SinTheta > -(g_dSinPiPer8) ) ) 254 | NewState = L_MOVE; 255 | else 256 | if( (SinTheta <= -(g_dSinPiPer8)) && (SinTheta > -(g_dSinPiPer8Times3) ) ) 257 | NewState = DL_MOVE; 258 | else 259 | NewState = D_MOVE; 260 | } 261 | } 262 | 263 | if( m_State != NewState ) SetState( NewState ); 264 | 265 | } 266 | 267 | void CNeko::RunTowards(int nX, int nY) 268 | { 269 | //store old and new target 270 | m_nOldToX = m_nToX; m_nOldToY = m_nToY; 271 | m_nToX = nX; m_nToY = nY; 272 | 273 | //calculate distance to target and set delta positions 274 | double dLargeX, dLargeY, dDoubleLength, dLength; 275 | dLargeX = (double)(m_nToX - m_pPet->GetPosition().x - (int)m_pPet->GetSize().cx / 2); //stop in middle of cursor 276 | dLargeY = (double)(m_nToY - m_pPet->GetPosition().y - (int)m_pPet->GetSize().cy + 1); //...and just above 277 | dDoubleLength = dLargeX * dLargeX + dLargeY * dLargeY; 278 | 279 | if( dDoubleLength != 0.0 ) 280 | { 281 | dLength = sqrt( dDoubleLength ); 282 | if( dLength <= (int)m_dwSpeed ) 283 | { 284 | //less than top speed - jump the gap! 285 | m_nDX = (int)dLargeX; 286 | m_nDY = (int)dLargeY; 287 | } 288 | else 289 | { 290 | //more than top speed - run at top speed towards target 291 | m_nDX = (int)(((int)m_dwSpeed * dLargeX) / dLength ); 292 | m_nDY = (int)(((int)m_dwSpeed * dLargeY) / dLength ); 293 | } 294 | } 295 | else //we're at the target - stop 296 | m_nDX = m_nDY = 0; 297 | 298 | //increment animation counter 299 | if ( ++m_uTickCount >= MAX_TICK ) m_uTickCount = 0; 300 | 301 | if ( m_uTickCount%2 == 0 ) 302 | if (m_uStateCount < MAX_TICK) m_uStateCount++; 303 | 304 | //change state 305 | switch( m_State ) 306 | { 307 | case STOP: 308 | if( MoveStart() ) 309 | SetState( AWAKE ); 310 | else 311 | if( m_uStateCount >= STOP_TIME ) 312 | if( m_nDX < 0 && m_pPet->GetPosition().x <= 0 ) SetState( L_CLAW ); 313 | else 314 | if( m_nDX > 0 && m_pPet->GetPosition().x >= ( m_pPet->GetBoundsRect().right - m_pPet->GetBoundsRect().left ) - m_pPet->GetSize().cx ) SetState( R_CLAW ); 315 | else 316 | if( m_nDY < 0 && m_pPet->GetPosition().y <= 0 ) SetState( U_CLAW ); 317 | else 318 | if( m_nDY > 0 && m_pPet->GetPosition().y >= ( m_pPet->GetBoundsRect().bottom - m_pPet->GetBoundsRect().top ) - m_pPet->GetSize().cy ) SetState( D_CLAW ); 319 | else SetState( WASH ); 320 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 321 | break; 322 | 323 | case WASH: 324 | if( MoveStart() ) SetState( AWAKE ); 325 | else if( m_uStateCount >= WASH_TIME ) SetState( SCRATCH ); 326 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 327 | break; 328 | 329 | case SCRATCH: 330 | if( MoveStart() ) SetState( AWAKE ); 331 | else if (m_uStateCount >= SCRATCH_TIME ) SetState( YAWN ); 332 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 333 | break; 334 | 335 | case YAWN: 336 | if( MoveStart() ) SetState( AWAKE ); 337 | else if (m_uStateCount >= YAWN_TIME) SetState( SLEEP ); 338 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 339 | break; 340 | 341 | case SLEEP: 342 | if( MoveStart() ) SetState( AWAKE ); 343 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 344 | break; 345 | 346 | case AWAKE: 347 | if( m_uStateCount >= (UINT)(AWAKE_TIME + (rand()%20)) ) CalcDirection(); 348 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 349 | break; 350 | 351 | case U_MOVE: 352 | case D_MOVE: 353 | case L_MOVE: 354 | case R_MOVE: 355 | case UL_MOVE: 356 | case UR_MOVE: 357 | case DL_MOVE: 358 | case DR_MOVE: 359 | { 360 | //make sure Neko does not go outside boundary area 361 | int nX = m_pPet->GetPosition().x, nY = m_pPet->GetPosition().y; 362 | int nNewX = nX + m_nDX, nNewY = nY + m_nDY; 363 | int nWidth = ( m_pPet->GetBoundsRect().right - m_pPet->GetBoundsRect().left ) - m_pPet->GetSize().cx; 364 | int nHeight = ( m_pPet->GetBoundsRect().bottom - m_pPet->GetBoundsRect().top ) - m_pPet->GetSize().cy; 365 | BOOL fOutside = ( nNewX <= 0 || nNewX >= nWidth || nNewY <= 0 || nNewY >= nHeight ); 366 | 367 | //change the image and move Neko 368 | CalcDirection(); 369 | 370 | //clip new x and y positions and see if we've moved anywhere 371 | if( nNewX < 0 ) nNewX = 0; else if( nNewX > nWidth ) nNewX = nWidth; 372 | if( nNewY < 0 ) nNewY = 0; else if( nNewY > nHeight ) nNewY = nHeight; 373 | BOOL fNotMoved = ( nNewX == nX ) && ( nNewY == nY ); 374 | 375 | //stop if we can't go any further 376 | if( fOutside && fNotMoved ) 377 | SetState(STOP); 378 | else 379 | { 380 | m_pPet->SetImageAndMoveTo( GetStateAnimationFrameIndex(), nNewX, nNewY ); 381 | if( m_bFootprints ) 382 | { 383 | int iFpAnim = -1; 384 | switch( m_State ) 385 | { 386 | case U_MOVE: iFpAnim = 0; break; 387 | case D_MOVE: iFpAnim = 4; break; 388 | case L_MOVE: iFpAnim = 6; break; 389 | case R_MOVE: iFpAnim = 2; break; 390 | case UL_MOVE: iFpAnim = 7; break; 391 | case UR_MOVE: iFpAnim = 1; break; 392 | case DL_MOVE: iFpAnim = 5; break; 393 | case DR_MOVE: iFpAnim = 3; break; 394 | } 395 | if( iFpAnim != -1 ) 396 | { 397 | if( m_uTickCount & 1 ) 398 | m_pPet->DrawOnTarget( nX-(m_nDY/2), nY, m_hIconFootprints[iFpAnim] ); 399 | else 400 | m_pPet->DrawOnTarget( nX, nY-(m_nDX/2), m_hIconFootprints[iFpAnim] ); 401 | } 402 | } 403 | } 404 | break; 405 | } 406 | 407 | case U_CLAW: 408 | case D_CLAW: 409 | case L_CLAW: 410 | case R_CLAW: 411 | if( MoveStart() ) SetState( AWAKE ); 412 | else if( m_uStateCount >= CLAW_TIME ) SetState( SCRATCH ); 413 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 414 | break; 415 | 416 | default: 417 | //something bad has happened! 418 | MessageBeep( 0xFFFFFFFF ); 419 | SetState( STOP ); 420 | m_pPet->SetImage( GetStateAnimationFrameIndex() ); 421 | break; 422 | } 423 | } 424 | 425 | int CNeko::GetStateAnimationFrameIndex() 426 | { 427 | if ( m_State != SLEEP ) 428 | return m_nAnimation[m_State][m_uTickCount & 0x1]; 429 | else 430 | return m_nAnimation[m_State][(m_uTickCount>>2) & 0x1]; 431 | 432 | } 433 | 434 | void CNeko::SetState( State state ) 435 | { 436 | //reset the animation counters 437 | m_uTickCount = 0; 438 | m_uStateCount = 0; 439 | 440 | //update the state 441 | m_State = state; 442 | } 443 | 444 | 445 | BOOL CNeko::LoadImages() 446 | { 447 | /* Note: The icons should be in the following order in the file: 448 | 449 | Awake 450 | Up 1 451 | Up 2 452 | Up Right 1 453 | Up Right 2 454 | Right 1 455 | Right 2 456 | Down Right 1 457 | Down Right 2 458 | Down 1 459 | Down 2 460 | Down Left 1 461 | Down Left 2 462 | Left 1 463 | Left 2 464 | Up Left 1 465 | Up Left 2 466 | Up Claw 1 467 | Up Claw 2 468 | Right Claw 1 469 | Right Claw 2 470 | Left Claw 1 471 | Left Claw 2 472 | Down Claw 1 473 | Down Claw 2 474 | Wash 2 475 | Scratch 1 476 | Scratch 2 477 | Yawn 1 478 | Yawn 2 479 | Sleep 1 480 | Sleep 2 481 | */ 482 | 483 | //load the icons 484 | int n; 485 | HICON hIcons[32]; 486 | for( n = 0; n < 32; n++ ) 487 | hIcons[n] = ExtractIcon( g_hInstance, m_szLibname, n ); 488 | 489 | //check last icon 490 | if( (UINT)hIcons[31] <= 1 ) 491 | { 492 | //error - delete all icons 493 | for( n = 0; n < 32; n++ ) DestroyIcon( hIcons[n] ); 494 | 495 | char szBuffer[1024]; 496 | wsprintf( szBuffer, "There are not enough icons in this icon library\n%s\nIt must contain at least 32 icons", m_szLibname ); 497 | MessageBox( NULL, szBuffer, "Error", MB_ICONERROR|MB_TASKMODAL ); 498 | return FALSE; 499 | } 500 | 501 | //apply icons 502 | m_pPet->SetImages( hIcons, 32 ); 503 | 504 | //destroy icon table 505 | for( n = 0; n < 32; n++ ) DestroyIcon( hIcons[n] ); 506 | 507 | //load footprints 508 | if( m_bFootprints ) 509 | { 510 | if( *m_szFootprintLibname ) 511 | for( n = 0; n < 8; n++ ) m_hIconFootprints[n] = ExtractIcon( g_hInstance, m_szFootprintLibname, n ); 512 | else 513 | { 514 | UINT uID[] = { IDI_FP_UP, IDI_FP_UPRIGHT, IDI_FP_RIGHT, IDI_FP_DOWNRIGHT, IDI_FP_DOWN, IDI_FP_DOWNLEFT, IDI_FP_LEFT, IDI_FP_UPLEFT }; 515 | for( n = 0; n < 8; n++ ) m_hIconFootprints[n] = LoadIcon( g_hInstance, MAKEINTRESOURCE(uID[n]) ); 516 | } 517 | } 518 | 519 | return TRUE; 520 | } 521 | 522 | /********************************************************************************************************/ 523 | 524 | void CNeko::Update() 525 | { 526 | //apply VVPAI (very, very poor artificial intelligence!!!) 527 | switch( m_Action ) 528 | { 529 | default: 530 | case CHASE_MOUSE: 531 | { 532 | POINT pt; 533 | GetCursorPos( &pt ); 534 | RunTowards( pt.x, pt.y ); 535 | break; 536 | } 537 | 538 | case RUN_AWAY_FROM_MOUSE: 539 | { 540 | POINT pt; 541 | int xdiff, ydiff; 542 | GetCursorPos( &pt ); 543 | DWORD dwLimit = m_dwIdleSpace*16; 544 | 545 | xdiff = ( m_pPet->GetPosition().x + (m_pPet->GetSize().cx/2) ) - pt.x; 546 | ydiff = ( m_pPet->GetPosition().y + (m_pPet->GetSize().cy/2) ) - pt.y; 547 | 548 | if( abs(xdiff) < (int)dwLimit && abs(ydiff) < (int)dwLimit ) 549 | { 550 | //mouse cursor is too close 551 | int x, y; 552 | double dLength = sqrt((double)xdiff*xdiff + ydiff*ydiff); 553 | if( dLength != 0.0 ) 554 | { 555 | x = m_pPet->GetPosition().x + (int)((xdiff / dLength) * dwLimit); 556 | y = m_pPet->GetPosition().y + (int)((ydiff / dLength) * dwLimit); 557 | } 558 | else 559 | x = y = 32; 560 | 561 | //make Neko run away from the mouse 562 | RunTowards( x, y ); 563 | if( m_State == AWAKE ) CalcDirection(); //don't show awake animation 564 | } 565 | else 566 | RunTowards( m_nToX, m_nToY ); //keep running... 567 | break; 568 | } 569 | 570 | case RUN_AROUND_RANDOMLY: 571 | { 572 | if( m_State == SLEEP) m_nActionCount++; 573 | if( m_nActionCount > (int)m_dwIdleSpace*10 ) 574 | { 575 | m_nActionCount = 0; 576 | RunTowards( m_pPet->GetBoundsRect().left + (rand() % (m_pPet->GetBoundsRect().right-m_pPet->GetBoundsRect().left)), m_pPet->GetBoundsRect().top + (rand() % (m_pPet->GetBoundsRect().bottom-m_pPet->GetBoundsRect().top)) ); 577 | } 578 | else 579 | RunTowards( m_nToX, m_nToY ); 580 | break; 581 | } 582 | 583 | case PACE_AROUND_SCREEN: 584 | { 585 | if( (m_nDX == 0) && (m_nDY == 0) ) m_nActionCount = ( m_nActionCount + 1 ) % 4; 586 | switch( m_nActionCount ) 587 | { 588 | case 0: RunTowards( m_pPet->GetBoundsRect().left + m_pPet->GetSize().cx, m_pPet->GetBoundsRect().top + m_pPet->GetSize().cy ); break; 589 | case 1: RunTowards( m_pPet->GetBoundsRect().left + m_pPet->GetSize().cx, m_pPet->GetBoundsRect().bottom - m_pPet->GetSize().cy ); break; 590 | case 2: RunTowards( m_pPet->GetBoundsRect().right - m_pPet->GetSize().cx, m_pPet->GetBoundsRect().bottom - m_pPet->GetSize().cy ); break; 591 | case 3: RunTowards( m_pPet->GetBoundsRect().right - m_pPet->GetSize().cx, m_pPet->GetBoundsRect().top + m_pPet->GetSize().cy ); break; 592 | } 593 | break; 594 | } 595 | 596 | case RUN_AROUND: 597 | { 598 | //bounding box repel border 599 | DWORD dwBoundingBox = m_dwSpeed * 8; 600 | 601 | //move invisible ball 602 | m_nActionX += m_nActionDX; 603 | m_nActionY += m_nActionDY; 604 | 605 | //repel invisible ball from the edges of the screen. 606 | if( m_nActionX < (int)(m_pPet->GetBoundsRect().left + dwBoundingBox) ) 607 | if( m_nActionX > m_pPet->GetBoundsRect().left ) m_nActionDX++; else m_nActionDX = -m_nActionDX; 608 | else 609 | if( m_nActionX > (int)(m_pPet->GetBoundsRect().right - dwBoundingBox) ) 610 | if( m_nActionX < m_pPet->GetBoundsRect().right ) m_nActionDX--; else m_nActionDX = -m_nActionDX; 611 | 612 | if( m_nActionY < (int)(m_pPet->GetBoundsRect().top + dwBoundingBox) ) 613 | if( m_nActionY > m_pPet->GetBoundsRect().top ) m_nActionDY++; else m_nActionDY = -m_nActionDY; 614 | else 615 | if( m_nActionY > (int)(m_pPet->GetBoundsRect().bottom - dwBoundingBox) ) 616 | if( m_nActionY < m_pPet->GetBoundsRect().bottom ) m_nActionDY--; else m_nActionDY = -m_nActionDY; 617 | 618 | //tell Neko to run towards the new point 619 | RunTowards( m_nActionX, m_nActionY ); 620 | break; 621 | } 622 | } 623 | 624 | //play idle sounds 625 | if( m_dwSndFrequency ) 626 | { 627 | if( (DWORD)(rand()%100) <= m_dwSndFrequency ) 628 | { 629 | switch( GetState() ) 630 | { 631 | case AWAKE: 632 | PlaySound( m_szSndAwake, NULL, SND_NOSTOP|SND_NOWAIT|SND_FILENAME|SND_NODEFAULT|SND_ASYNC ); 633 | break; 634 | 635 | case SLEEP: 636 | PlaySound( m_szSndSleep, NULL, SND_NOSTOP|SND_NOWAIT|SND_FILENAME|SND_NODEFAULT|SND_ASYNC ); 637 | break; 638 | 639 | default: 640 | switch( rand()%3 ) 641 | { 642 | case 0: PlaySound( m_szSndIdle1, NULL, SND_NOSTOP|SND_NOWAIT|SND_FILENAME|SND_NODEFAULT|SND_ASYNC ); break; 643 | case 1: PlaySound( m_szSndIdle2, NULL, SND_NOSTOP|SND_NOWAIT|SND_FILENAME|SND_NODEFAULT|SND_ASYNC ); break; 644 | default: PlaySound( m_szSndIdle3, NULL, SND_NOSTOP|SND_NOWAIT|SND_FILENAME|SND_NODEFAULT|SND_ASYNC ); break; 645 | } 646 | break; 647 | } 648 | } 649 | } 650 | } 651 | 652 | -------------------------------------------------------------------------------- /Neko98/NekoCFG/NekoCFG.cpp: -------------------------------------------------------------------------------- 1 | /**************** 2 | NekoCFG 3 | 4 | Configuration 5 | program for 6 | Neko95 v4.0 7 | 8 | *****************/ 9 | 10 | #define WIN32_LEAN_AND_MEAN 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "NekoCFG.h" 16 | #include "..\NekoCommon.h" 17 | #include "..\NekoSettings.h" 18 | #include "NekoCFG_resource.h" 19 | #include "NekoCFG_resource.hm" 20 | 21 | /*************************************************************************************************/ 22 | 23 | const char* szWindowTitle = "Configure Neko"; 24 | const char* szDefaultName = "Neko (default)"; 25 | const char* szHelpFile = "Neko98.hlp"; 26 | 27 | /* help ID lookup table */ 28 | static DWORD dwHelpID[] = { 29 | IDC_NAME, HIDC_NAME, 30 | IDC_NEW, HIDC_NEW, 31 | IDC_DELETE, HIDC_DELETE, 32 | IDC_TASKBAR, HIDC_TASKBAR, 33 | IDC_ABOUT, HIDC_ABOUT, 34 | IDOK, HIDOK, 35 | IDCANCEL, HIDCANCEL, 36 | IDC_APPLY, HIDC_APPLY, 37 | IDC_HELP, HIDC_HELP, 38 | IDC_TABS, HIDC_TABS, 39 | 0,0 40 | }; 41 | 42 | //global variables 43 | HINSTANCE g_hInstance = NULL; 44 | HWND g_hWndNeko = NULL; 45 | 46 | 47 | //global settings 48 | BOOL g_fShowTaskbar = TRUE; 49 | 50 | //list of all cats 51 | LPCATSETTINGS catSettings = NULL; 52 | 53 | //function forward declaration 54 | void WINAPI WriteSettings(); 55 | 56 | /*************************************************************************************************/ 57 | 58 | /* DeleteCatSettings - removes the given cat from the list */ 59 | BOOL WINAPI DeleteCatSettings( LPCATSETTINGS cat ) 60 | { 61 | cat->fDeleted = TRUE; 62 | return TRUE; 63 | } 64 | 65 | /* DlgProc_NewNeko - dialog box procedure to add a neko */ 66 | BOOL CALLBACK DlgProc_NewNeko( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) 67 | { 68 | switch( uMsg ) 69 | { 70 | case WM_INITDIALOG: 71 | { 72 | //make sure the user isn't adding *too* many Nekos! 73 | LPCATSETTINGS cat = catSettings; 74 | int nCats = 0; 75 | while( cat ) 76 | { 77 | if( cat->fDeleted == FALSE ) nCats++; 78 | cat = cat->next; 79 | } 80 | 81 | if( nCats > 5 ) 82 | { 83 | char szBuffer[128]; 84 | sprintf( szBuffer, "You already have %d Nekos!\nAdding more is likely to slow down your computer - do you want to add one anyway?", nCats ); 85 | if( IDNO == MessageBox( hDlg, szBuffer, "Add Neko", MB_YESNO|MB_ICONQUESTION ) ) 86 | { 87 | EndDialog( hDlg, FALSE ); 88 | return TRUE; 89 | } 90 | } 91 | 92 | //initialise the text box 93 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_LIMITTEXT, IDC_NEWNEKONAME-2, 0 ); 94 | 95 | //add some demo items 96 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Arthur" ); 97 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Boris" ); 98 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Kitty" ); 99 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Lucy" ); 100 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Garfield" ); 101 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Tom" ); 102 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Bast" ); 103 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Ginger" ); 104 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Bob" ); 105 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Tabs" ); 106 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Tigger" ); 107 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"James" ); 108 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Cooper" ); 109 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Hey You" ); 110 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Greebo" ); 111 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Furball" ); 112 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Sylvester" ); 113 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Buffy" ); 114 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Willow" ); 115 | SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Sarah" ); 116 | //SendDlgItemMessage( hDlg, IDC_NEWNEKONAME, CB_ADDSTRING, 0, (LPARAM)"Vicious Bastard" ); 117 | break; 118 | } 119 | 120 | case WM_COMMAND: 121 | switch( LOWORD(wParam) ) 122 | { 123 | case IDOK: 124 | { 125 | char szName[MAX_NEKO_NAME]; 126 | GetDlgItemText( hDlg, IDC_NEWNEKONAME, szName, MAX_NEKO_NAME ); 127 | char* lpszPtr = szName; 128 | 129 | //make sure it's not empty 130 | if( strlen( szName ) == 0 ) 131 | { 132 | MessageBox( hDlg, "Invalid Name: You must type a name", "New Neko", MB_ICONINFORMATION ); 133 | return TRUE; 134 | } 135 | 136 | //make sure it only has letters, numbers and spaces in 137 | while( lpszPtr && *lpszPtr != '\0' ) 138 | { 139 | if( !( isalpha(*lpszPtr) || isdigit(*lpszPtr) || *lpszPtr == ' ' ) ) 140 | { 141 | MessageBox( hDlg, "Invalid Name: Sorry - a name can only contain letters, numbers and spaces", "Add Neko", MB_ICONINFORMATION ); 142 | return TRUE; 143 | } 144 | lpszPtr++; 145 | } 146 | 147 | //make sure it's unique 148 | LPCATSETTINGS cat = catSettings; 149 | while( cat ) 150 | { 151 | if( !cat->fDeleted && (stricmp( cat->szName, szName ) == 0 || stricmp( cat->szName, szDefaultName ) == 0 )) 152 | { 153 | MessageBox( hDlg, "Invalid Name: This neko already exists!", "New Neko", MB_ICONINFORMATION ); 154 | return TRUE; 155 | } 156 | cat = cat->next; 157 | } 158 | 159 | 160 | //create a new neko 161 | cat = new CATSETTINGS; 162 | strcpy( cat->szName, szName ); 163 | 164 | //set defaults 165 | strcpy( cat->szLibrary, "" ); 166 | cat->uScale = 100; 167 | cat->uSpeed = 16; 168 | cat->uMouseSensitivity = 6; 169 | strcpy( cat->szSndIdle1, "" ); 170 | strcpy( cat->szSndIdle2, "" ); 171 | strcpy( cat->szSndIdle3, "" ); 172 | strcpy( cat->szSndSleep, "" ); 173 | strcpy( cat->szSndAwake, "" ); 174 | cat->uSndFrequency = 0; 175 | cat->uAction = CHASE_MOUSE; 176 | cat->fAlwaysOnTop = FALSE; 177 | cat->bFootprints = FALSE; 178 | *cat->szFootprintLib = '\0'; 179 | 180 | //link it in 181 | cat->fDeleted = FALSE; 182 | cat->next = catSettings; 183 | catSettings = cat; 184 | 185 | //add it to the list box & select it 186 | int i = SendDlgItemMessage( GetParent(hDlg), IDC_NAME, LB_ADDSTRING, 0, (LPARAM)szName ); 187 | SendDlgItemMessage( GetParent(hDlg), IDC_NAME, LB_SETCURSEL, i, 0 ); 188 | PostMessage( GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDC_NAME, CBN_SELCHANGE), 0 ); 189 | 190 | //close the dialog 191 | EndDialog( hDlg, TRUE ); 192 | break; 193 | } 194 | 195 | case IDCANCEL: 196 | EndDialog( hDlg, FALSE ); 197 | break; 198 | } 199 | break; 200 | 201 | default: 202 | return FALSE; 203 | } 204 | return TRUE; 205 | } 206 | 207 | /* DlgProc_About - dialog box procedure for about dialog */ 208 | BOOL CALLBACK DlgProc_About( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) 209 | { 210 | if( ( uMsg == WM_CLOSE ) || ( uMsg == WM_COMMAND && LOWORD(wParam)==IDOK ) ) EndDialog( hDlg, TRUE ); else return FALSE; 211 | return TRUE; 212 | } 213 | 214 | /* DlgProc_Config - dialog box procedure for configuration dialog */ 215 | BOOL CALLBACK DlgProc_Config( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) 216 | { 217 | switch( uMsg ) 218 | { 219 | case WM_INITDIALOG: 220 | { 221 | SendDlgItemMessage( hDlg, IDC_TASKBAR, BM_SETCHECK, g_fShowTaskbar, 0 ); 222 | 223 | LPCATSETTINGS cat = catSettings; 224 | while( cat ) 225 | { 226 | if( !cat->fDeleted ) SendDlgItemMessage( hDlg, IDC_NAME, LB_ADDSTRING, 0, ( strcmp( cat->szName, "" ) == 0 ) ? (LPARAM)szDefaultName : (LPARAM)cat->szName ); 227 | cat = cat->next; 228 | } 229 | SendDlgItemMessage( hDlg, IDC_NAME, LB_SELECTSTRING, 0, (LPARAM)szDefaultName ); 230 | EnableWindow( GetDlgItem( hDlg, IDC_DELETE ), FALSE ); 231 | EnableWindow( GetDlgItem( hDlg, IDC_APPLY ), (g_hWndNeko != NULL ) ? TRUE : FALSE ); 232 | 233 | InitialisePropertyDialog( GetDlgItem( hDlg, IDC_TABS ) ); 234 | SendMessage( hDlg, WM_COMMAND, MAKEWPARAM(IDC_NAME, LBN_SELCHANGE), 0 ); 235 | return TRUE; 236 | } 237 | 238 | case WM_DESTROY: 239 | break; 240 | 241 | case WM_COMMAND: 242 | switch( LOWORD(wParam) ) 243 | { 244 | case IDOK: 245 | SetCursor( LoadCursor( NULL, IDC_WAIT ) ); 246 | g_fShowTaskbar = ( IsDlgButtonChecked( hDlg, IDC_TASKBAR ) == BST_CHECKED ); 247 | WriteSettings(); 248 | if( IsWindow( g_hWndNeko ) == FALSE ) g_hWndNeko = FindWindow( szNekoClassName, szNekoWindowTitle ); 249 | SendMessage( g_hWndNeko, MY_UPDATENEKO, 0, 0 ); 250 | SetCursor( LoadCursor( NULL, IDC_ARROW ) ); 251 | EndDialog( hDlg, TRUE ); 252 | break; 253 | 254 | case IDCANCEL: 255 | EndDialog( hDlg, FALSE ); break; 256 | 257 | case IDC_APPLY: 258 | SetCursor( LoadCursor( NULL, IDC_WAIT ) ); 259 | g_fShowTaskbar = ( IsDlgButtonChecked( hDlg, IDC_TASKBAR ) == BST_CHECKED ); 260 | WriteSettings(); 261 | if( IsWindow( g_hWndNeko ) == FALSE ) g_hWndNeko = FindWindow( szNekoClassName, szNekoWindowTitle ); 262 | SendMessage( g_hWndNeko, MY_UPDATENEKO, 0, 0 ); 263 | SetCursor( LoadCursor( NULL, IDC_ARROW ) ); 264 | break; 265 | 266 | case IDC_ABOUT: 267 | DialogBox( g_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hDlg, (DLGPROC)DlgProc_About ); 268 | break; 269 | 270 | case IDC_NEW: 271 | DialogBox( g_hInstance, MAKEINTRESOURCE(IDD_NEWNEKO), hDlg, (DLGPROC)DlgProc_NewNeko ); 272 | break; 273 | 274 | case IDC_DELETE: 275 | { 276 | int iItem = SendDlgItemMessage( hDlg, IDC_NAME, LB_GETCURSEL, 0, 0 ); 277 | char szDoomed[MAX_NEKO_NAME] = ""; 278 | 279 | //get string 280 | SendDlgItemMessage( hDlg, IDC_NAME, LB_GETTEXT, iItem, (LPARAM)szDoomed ); 281 | if( strcmp( szDoomed, szDefaultName ) == 0 ) strcpy( szDoomed, "" ); 282 | 283 | //find it in the settings list and continue 284 | LPCATSETTINGS cat = catSettings; 285 | while( cat ) 286 | { 287 | if( !cat->fDeleted ) 288 | if( strcmp( cat->szName, szDoomed ) == 0 ) break; 289 | 290 | cat = cat->next; 291 | } 292 | 293 | if( cat ) 294 | { 295 | //remove it from the list box 296 | SendDlgItemMessage( hDlg, IDC_NAME, LB_DELETESTRING, iItem, 0 ); 297 | 298 | //select another item 299 | SendDlgItemMessage( hDlg, IDC_NAME, LB_SETCURSEL, (iItem ? iItem-1 : 0), 0 ); 300 | SendMessage( hDlg, WM_COMMAND, MAKEWPARAM(IDC_NAME,LBN_SELCHANGE), 0 ); 301 | 302 | //remove it from memory 303 | if( DeleteCatSettings( cat ) == FALSE ) 304 | MessageBox( hDlg, "Internal Error: Could not delete cat!", szWindowTitle, MB_ICONERROR ); 305 | } 306 | else 307 | MessageBox( hDlg, "Internal Error: Dropped off the end of the cat list!", szWindowTitle, MB_ICONERROR ); 308 | 309 | break; 310 | } 311 | 312 | case IDC_HELP: 313 | WinHelp( hDlg, szHelpFile, HELP_FINDER, 0 ); 314 | break; 315 | 316 | case IDC_NAME: 317 | if( HIWORD(wParam) == LBN_SELCHANGE ) 318 | { 319 | int iNew = SendDlgItemMessage( hDlg, IDC_NAME, LB_GETCURSEL, 0, 0 ); 320 | char szNew[MAX_NEKO_NAME] = ""; 321 | 322 | //get string and enable delete if it's not the default item (first) 323 | SendDlgItemMessage( hDlg, IDC_NAME, LB_GETTEXT, iNew, (LPARAM)szNew ); 324 | if( strcmp( szNew, szDefaultName ) == 0 ) 325 | { 326 | strcpy( szNew, "" ); 327 | EnableWindow( GetDlgItem( hDlg, IDC_DELETE ), FALSE ); 328 | } 329 | else EnableWindow( GetDlgItem( hDlg, IDC_DELETE ), TRUE ); 330 | 331 | //the user has selected a different name - find it in the settings list and continue 332 | LPCATSETTINGS cat = catSettings; 333 | while( cat ) 334 | { 335 | if( !cat->fDeleted ) 336 | if( strcmp( cat->szName, szNew ) == 0 ) break; 337 | 338 | cat = cat->next; 339 | } 340 | 341 | if( cat ) 342 | SetActiveCat( cat ); 343 | else 344 | MessageBox( hDlg, "Internal Error: Dropped off the end of the cat list!", szWindowTitle, MB_ICONERROR ); 345 | } 346 | break; 347 | } 348 | break; 349 | 350 | case WM_NOTIFY: 351 | { 352 | LPNMHDR nmhdr = (LPNMHDR)lParam; 353 | switch( nmhdr->idFrom ) 354 | { 355 | case IDC_TABS: 356 | if( nmhdr->code == TCN_SELCHANGE ) OnSelChanged( GetDlgItem( hDlg, IDC_TABS ) ); 357 | break; 358 | } 359 | break; 360 | } 361 | 362 | /* help stuff */ 363 | case WM_HELP: 364 | if( ((LPHELPINFO)lParam)->iCtrlId != (-1) ) 365 | WinHelp( (HWND)((LPHELPINFO)lParam)->hItemHandle, szHelpFile, HELP_WM_HELP, (DWORD)(LPSTR)dwHelpID ); 366 | else 367 | return FALSE; 368 | break; 369 | 370 | case WM_CONTEXTMENU: 371 | WinHelp( (HWND)wParam, szHelpFile, HELP_CONTEXTMENU, (DWORD)(LPVOID)dwHelpID ); 372 | break; 373 | 374 | default: 375 | return FALSE; 376 | } 377 | return TRUE; 378 | } 379 | 380 | /*************************************************************************************************/ 381 | 382 | /* WriteCatSetting - write a cat from the registry with the given cat settings block */ 383 | void WINAPI WriteCatSettings( LPCATSETTINGS cat, LPCSTR szName ) 384 | { 385 | //see if this cat is flagged as deleted 386 | if( cat->fDeleted == TRUE ) 387 | { 388 | //remove this item from the registry 389 | if( strlen( szName ) > 0 ) 390 | { 391 | HKEY hKey; 392 | char szKeyName[MAX_PATH]; 393 | strcpy( szKeyName, szNekoRegKey ); 394 | if( RegOpenKeyEx( HKEY_CURRENT_USER, szKeyName, 0, KEY_WRITE, &hKey ) == ERROR_SUCCESS ) 395 | { 396 | LONG l = RegDeleteKey( hKey, cat->szName ); 397 | if( l != ERROR_SUCCESS ) 398 | { 399 | /* 400 | LPVOID lpMsgBuf; 401 | 402 | FormatMessage( 403 | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 404 | NULL, 405 | l, 406 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language 407 | (LPTSTR) &lpMsgBuf, 408 | 0, 409 | NULL 410 | ); 411 | // Display the string. 412 | MessageBox( NULL, (char*)lpMsgBuf, "Can't Delete Key", MB_OK|MB_ICONINFORMATION ); 413 | 414 | // Free the buffer. 415 | LocalFree( lpMsgBuf ); 416 | */ 417 | 418 | } 419 | RegCloseKey( hKey ); 420 | } 421 | else 422 | MessageBox( NULL, "Internal Error: Couldn't open registry key!", 0, MB_TASKMODAL ); 423 | } 424 | else 425 | MessageBox( NULL, "Internal Error: Tried to delete default Neko!", 0, MB_TASKMODAL ); 426 | } 427 | else 428 | { 429 | //build & open key 430 | char szKey[1024]; 431 | strcpy( szKey, szNekoRegKey ); 432 | if( strlen( szName ) > 0 ) 433 | { 434 | strcat( szKey, "\\" ); 435 | strcat( szKey, szName ); 436 | } 437 | 438 | //write cat to the registry 439 | CNekoSettings NekoSettings( szKey ); 440 | 441 | //display 442 | NekoSettings.SetString( szNekoLibraryKey, cat->szLibrary ); 443 | NekoSettings.SetInt( szNekoScaleKey, cat->uScale ); 444 | NekoSettings.SetInt( szNekoOnTopKey, cat->fAlwaysOnTop ); 445 | 446 | //movement 447 | NekoSettings.SetInt( szNekoSpeedKey, cat->uSpeed ); 448 | NekoSettings.SetInt( szNekoSenseKey, cat->uMouseSensitivity ); 449 | 450 | //sounds 451 | NekoSettings.SetString( szNekoSndIdle1Key, cat->szSndIdle1 ); 452 | NekoSettings.SetString( szNekoSndIdle2Key, cat->szSndIdle2 ); 453 | NekoSettings.SetString( szNekoSndIdle3Key, cat->szSndIdle3 ); 454 | NekoSettings.SetString( szNekoSndSleepKey, cat->szSndSleep ); 455 | NekoSettings.SetString( szNekoSndAwakeKey, cat->szSndAwake ); 456 | NekoSettings.SetInt( szNekoSndFreqKey, cat->uSndFrequency ); 457 | 458 | //independence 459 | NekoSettings.SetInt( szNekoActionKey, cat->uAction ); 460 | 461 | //effects 462 | NekoSettings.SetBool( szNekoFootprintKey, cat->bFootprints ); 463 | NekoSettings.SetString( szNekoFootprintLibKey, cat->szFootprintLib ); 464 | } 465 | } 466 | 467 | 468 | /* WriteSettings - writes all of the settings to the registry */ 469 | void WINAPI WriteSettings() 470 | { 471 | //tell all dialogs to write what they've got so far into the data structure 472 | GetDialogSettings(); 473 | 474 | //write global settings 475 | CNekoSettings NekoSettings( szNekoRegKey ); 476 | NekoSettings.SetBool( szNekoTaskbarKey, g_fShowTaskbar ); 477 | 478 | int nNumCats = 0; 479 | LPCATSETTINGS cat = catSettings; 480 | while( cat ) 481 | { 482 | //write this cat's settings 483 | WriteCatSettings( cat, cat->szName ); 484 | 485 | //unlink it if it's been deleted, or write out the name index key if not 486 | if( cat->fDeleted == FALSE ) 487 | { 488 | //build the key index 489 | char szSubKey[MAX_PATH]; 490 | sprintf( szSubKey, "%d", nNumCats ); 491 | 492 | //write this cat's name to the registry 493 | NekoSettings.SetString( szSubKey, cat->szName ); 494 | 495 | //advance the list 496 | nNumCats++; 497 | cat = cat->next; 498 | } 499 | else 500 | { 501 | cat = cat->next; 502 | } 503 | } 504 | 505 | NekoSettings.SetInt( szNekoNumCatsKey, nNumCats ); 506 | } 507 | 508 | /* ReadCatSetting - loads a cat from the registry into the given cat settings block */ 509 | void WINAPI ReadCatSettings( LPCATSETTINGS cat, LPCSTR szName ) 510 | { 511 | strcpy( cat->szName, szName ); 512 | 513 | //set defaults 514 | strcpy( cat->szLibrary, "" ); 515 | cat->uScale = 100; 516 | cat->uSpeed = 16; 517 | cat->uMouseSensitivity = 6; 518 | strcpy( cat->szSndIdle1, "" ); 519 | strcpy( cat->szSndIdle2, "" ); 520 | strcpy( cat->szSndIdle3, "" ); 521 | strcpy( cat->szSndSleep, "" ); 522 | strcpy( cat->szSndAwake, "" ); 523 | cat->uSndFrequency = 0; 524 | cat->uAction = CHASE_MOUSE; 525 | cat->fDeleted = FALSE; 526 | cat->fAlwaysOnTop = FALSE; 527 | cat->bFootprints = FALSE; 528 | *cat->szFootprintLib = '\0'; 529 | 530 | //build & open key 531 | char szKey[1024]; 532 | strcpy( szKey, szNekoRegKey ); 533 | if( strlen( szName ) > 0 ) 534 | { 535 | strcat( szKey, "\\" ); 536 | strcat( szKey, szName ); 537 | } 538 | 539 | CNekoSettings NekoSettings( szKey ); 540 | 541 | //display 542 | NekoSettings.GetString( szNekoLibraryKey, cat->szLibrary, MAX_PATH-1 ); 543 | NekoSettings.GetInt( szNekoScaleKey, &cat->uScale ); 544 | DWORD fAlwaysOnTop = cat->fAlwaysOnTop; 545 | NekoSettings.GetInt( szNekoOnTopKey, &fAlwaysOnTop ); 546 | cat->fAlwaysOnTop = fAlwaysOnTop; 547 | 548 | //movement 549 | NekoSettings.GetInt( szNekoSpeedKey, &cat->uSpeed ); 550 | NekoSettings.GetInt( szNekoSenseKey, &cat->uMouseSensitivity ); 551 | 552 | //sounds 553 | NekoSettings.GetString( szNekoSndIdle1Key, cat->szSndIdle1, MAX_PATH-1 ); 554 | NekoSettings.GetString( szNekoSndIdle2Key, cat->szSndIdle2, MAX_PATH-1 ); 555 | NekoSettings.GetString( szNekoSndIdle3Key, cat->szSndIdle3, MAX_PATH-1 ); 556 | NekoSettings.GetString( szNekoSndSleepKey, cat->szSndSleep, MAX_PATH-1 ); 557 | NekoSettings.GetString( szNekoSndAwakeKey, cat->szSndAwake, MAX_PATH-1 ); 558 | NekoSettings.GetInt( szNekoSndFreqKey, &cat->uSndFrequency ); 559 | 560 | //independence 561 | NekoSettings.GetInt( szNekoActionKey, &cat->uAction ); 562 | 563 | NekoSettings.GetBool( szNekoFootprintKey, &cat->bFootprints ); 564 | NekoSettings.GetString( szNekoFootprintLibKey, cat->szFootprintLib, MAX_PATH-1 ); 565 | } 566 | 567 | /* ReadSettings - reads all of the settings from the registry and creates the global settings array */ 568 | void WINAPI ReadSettings() 569 | { 570 | LPCATSETTINGS cat; 571 | 572 | CNekoSettings * NekoSettings = new CNekoSettings( szNekoRegKey ); 573 | NekoSettings->GetBool( szNekoTaskbarKey, &g_fShowTaskbar ); 574 | 575 | //load in new cats list 576 | DWORD nNumCats = 0; 577 | NekoSettings->GetInt( szNekoNumCatsKey, &nNumCats ); 578 | 579 | if( nNumCats == 0 ) 580 | { 581 | //the user hasn't run the config program, or there are no Nekos - use default 582 | cat = new CATSETTINGS; 583 | cat->next = NULL; 584 | ReadCatSettings( cat, "" ); 585 | 586 | catSettings = cat; 587 | } 588 | else 589 | { 590 | for( DWORD i = 0; i < nNumCats; i++ ) 591 | { 592 | //build the key index 593 | char szSubKey[MAX_PATH], szName[MAX_NEKO_NAME]; 594 | sprintf( szSubKey, "%d", i ); 595 | 596 | //load this cat's name from the registry 597 | NekoSettings->GetString( szSubKey, szName, MAX_NEKO_NAME-1 ); 598 | 599 | //create a new setting for it and put the object into the list 600 | cat = new CATSETTINGS; 601 | cat->next = catSettings; 602 | ReadCatSettings( cat, szName ); 603 | catSettings = cat; 604 | } 605 | } 606 | 607 | delete NekoSettings; 608 | } 609 | 610 | /* DeleteConfigList - deletes the list of settings from memory */ 611 | void WINAPI DeleteConfigList() 612 | { 613 | LPCATSETTINGS cat = catSettings; 614 | while( catSettings ) 615 | { 616 | cat = catSettings; 617 | catSettings = catSettings->next; 618 | delete cat; 619 | } 620 | } 621 | 622 | 623 | /* FindAndActivateOldInstance - activates the old instance of the configuration program 624 | if it has been loaded twice */ 625 | BOOL FindAndActivateOldInstance() 626 | { 627 | HWND hWnd = FindWindow( NULL, szWindowTitle ); 628 | if( hWnd ) 629 | { 630 | OpenIcon(hWnd); 631 | SetForegroundWindow(hWnd); 632 | return TRUE; 633 | } 634 | 635 | return FALSE; 636 | } 637 | 638 | /* WinMain - main program start point */ 639 | int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) 640 | { 641 | //see if the configuration program is loaded already 642 | if( FindAndActivateOldInstance() ) return 0; 643 | 644 | //ensure the common control library is loaded 645 | InitCommonControls(); 646 | 647 | //store the instance handle and find the Neko window 648 | g_hInstance = hInstance; 649 | g_hWndNeko = FindWindow( szNekoClassName, szNekoWindowTitle ); 650 | 651 | //initialise program and display dialog 652 | ReadSettings(); 653 | DialogBox( g_hInstance, MAKEINTRESOURCE(IDD_CONFIG), NULL, (DLGPROC)DlgProc_Config ); 654 | DeleteConfigList(); 655 | ShutdownPropertyDialog(); 656 | return 0; 657 | } 658 | --------------------------------------------------------------------------------