[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src include/missile.h include/stratag...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src include/missile.h include/stratag... |
Date: |
20 Jan 2004 00:03:47 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/20 00:03:47
Modified files:
src/include : missile.h stratagus.h
src/missile : missile.c script_missile.c
src/stratagus : script.c
src/video : graphic.c
Log message:
META_LUA missile types.
Patches:
Index: stratagus/src/include/missile.h
diff -u stratagus/src/include/missile.h:1.83
stratagus/src/include/missile.h:1.84
--- stratagus/src/include/missile.h:1.83 Mon Jan 19 09:36:25 2004
+++ stratagus/src/include/missile.h Tue Jan 20 00:03:44 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.h,v 1.83 2004/01/18 22:36:25 nobody_ Exp $
+// $Id: missile.h,v 1.84 2004/01/19 13:03:44 nobody_ Exp $
#ifndef __MISSILE_H__
#define __MISSILE_H__
@@ -560,7 +560,7 @@
#ifdef META_LUA
/// Initialize Spell scripting.
-extern void ScriptSpellInit(void);
+extern void ScriptMissileTypesInit(void);
#endif
//@}
Index: stratagus/src/include/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.40
stratagus/src/include/stratagus.h:1.41
--- stratagus/src/include/stratagus.h:1.40 Mon Jan 19 09:36:26 2004
+++ stratagus/src/include/stratagus.h Tue Jan 20 00:03:44 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: stratagus.h,v 1.40 2004/01/18 22:36:26 nobody_ Exp $
+// $Id: stratagus.h,v 1.41 2004/01/19 13:03:44 nobody_ Exp $
#ifndef __STRATAGUS_H__
#define __STRATAGUS_H__
@@ -44,7 +44,10 @@
#define NEW_UNIT_CACHE
// New Lua scripting.
-#define META_LUA
+//#define META_LUA
+
+// Dynamic loading.
+//#define DYNAMIC_LOAD
//
// Default speed for many things, set it higher for faster
actions.
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.130
stratagus/src/missile/missile.c:1.131
--- stratagus/src/missile/missile.c:1.130 Mon Jan 19 09:36:26 2004
+++ stratagus/src/missile/missile.c Tue Jan 20 00:03:45 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.c,v 1.130 2004/01/18 22:36:26 nobody_ Exp $
+// $Id: missile.c,v 1.131 2004/01/19 13:03:45 nobody_ Exp $
//@{
@@ -188,16 +188,7 @@
MissileType* const* mtype;
mtype = (MissileType**)hash_find(MissileTypeHash, (char*)ident);
- if (mtype) {
- return *mtype;
- }
-
-#ifdef DEBUG
- if (!NoWarningMissileType) {
- DebugLevel0Fn("Missile %s not found\n" _C_ ident);
- }
-#endif
- return NULL;
+ return mtype ? *mtype : 0;
}
/**
@@ -1298,7 +1289,7 @@
DebugCheck(file == NULL);
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.130
2004/01/18 22:36:26 nobody_ Exp $\n\n");
+ CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.131
2004/01/19 13:03:45 nobody_ Exp $\n\n");
//
// Original number to internal missile-type name.
@@ -1420,7 +1411,7 @@
Missile* const* missiles;
CLprintf(file,"\n--- -----------------------------------------\n");
- CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.130 2004/01/18
22:36:26 nobody_ Exp $\n\n");
+ CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.131 2004/01/19
13:03:45 nobody_ Exp $\n\n");
for (missiles = GlobalMissiles; *missiles; ++missiles) {
SaveMissile(*missiles, file);
Index: stratagus/src/missile/script_missile.c
diff -u stratagus/src/missile/script_missile.c:1.59
stratagus/src/missile/script_missile.c:1.60
--- stratagus/src/missile/script_missile.c:1.59 Mon Jan 19 09:36:27 2004
+++ stratagus/src/missile/script_missile.c Tue Jan 20 00:03:45 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: script_missile.c,v 1.59 2004/01/18 22:36:27 nobody_ Exp $
+// $Id: script_missile.c,v 1.60 2004/01/19 13:03:45 nobody_ Exp $
//@{
@@ -449,9 +449,16 @@
mtype = MissileTypeByIdent(name);
if (mtype != NULL) {
- LuaError(l, "Spell allready exists");
+ LuaError(l, "Missile allready exists");
} else {
- ScriptCreateUserdata(l, NewMissileTypeSlot(strdup(name)),
+ mtype = NewMissileTypeSlot(strdup(name));
+
+ // Defaults.
+ mtype->NumDirections = 1;
+ mtype->Flip = 1;
+ mtype->SplashFactor = 100;
+
+ ScriptCreateUserdata(l, mtype,
ScriptMissileTypeGet, ScriptMissileTypeSet);
return 1;
}
@@ -463,9 +470,34 @@
** @param missiletype Pointer to the missile type.
** @param key Key string.
*/
-local int ScriptMissileTypeGet(MissileType* missiletype, const char* key,
lua_State* l)
+local int ScriptMissileTypeGet(MissileType* mtype, const char* key, lua_State*
l)
{
- LuaError(l, "Function not implemented.\n");
+ META_GET_STRING("Ident", mtype->Ident);
+ META_GET_STRING("File", mtype->File);
+
+ META_GET_INT("Transparency", mtype->Transparency);
+ META_GET_INT("Width", mtype->Width);
+ META_GET_INT("Height", mtype->Height);
+ META_GET_INT("DrawLevel", mtype->DrawLevel);
+ META_GET_INT("SpriteFrames", mtype->SpriteFrames);
+ META_GET_INT("NumDirections", mtype->NumDirections);
+
+ META_GET_INT("NumBounces", mtype->NumBounces);
+ META_GET_INT("Sleep", mtype->Sleep);
+ META_GET_INT("Speed", mtype->Speed);
+ META_GET_INT("Range", mtype->Range);
+ META_GET_INT("SplashFactor", mtype->SplashFactor);
+ META_GET_BOOL("CanHitOwner", mtype->CanHitOwner);
+ META_GET_BOOL("FriendlyFire", mtype->FriendlyFire);
+
+ META_GET_STRING("ImpactMissile", mtype->ImpactName);
+ META_GET_STRING("SmokeMissile", mtype->SmokeName);
+
+ META_GET_STRING("FiredSound", mtype->FiredSound.Name);
+ META_GET_STRING("ImpactSound", mtype->ImpactSound.Name);
+ META_GET_STRING("Class", MissileClassNames[mtype->Class]);
+
+ LuaError(l, "Field \"%s\" is innexistent or write-only (yes, we have
those).\n" _C_ key);
}
/**
@@ -474,9 +506,46 @@
** @param missiletype Pointer to the missile type.
** @param key Key string.
*/
-local int ScriptMissileTypeSet(MissileType* missiletype, const char* key,
lua_State* l)
+local int ScriptMissileTypeSet(MissileType* mtype, const char* key, lua_State*
l)
{
- LuaError(l, "Function not implemented.\n");
+ META_SET_STRING("File", mtype->File);
+
+ META_SET_INT("Transparency", mtype->Transparency);
+ META_SET_INT("Width", mtype->Width);
+ META_SET_INT("Height", mtype->Height);
+ META_SET_INT("DrawLevel", mtype->DrawLevel);
+ META_SET_INT("SpriteFrames", mtype->SpriteFrames);
+ META_SET_INT("NumDirections", mtype->NumDirections);
+
+ META_SET_INT("NumBounces", mtype->NumBounces);
+ META_SET_INT("Sleep", mtype->Sleep);
+ META_SET_INT("Speed", mtype->Speed);
+ META_SET_INT("Range", mtype->Range);
+ META_SET_INT("SplashFactor", mtype->SplashFactor);
+ META_SET_BOOL("CanHitOwner", mtype->CanHitOwner);
+ META_SET_BOOL("FriendlyFire", mtype->FriendlyFire);
+
+ META_SET_STRING("ImpactMissile", mtype->ImpactName);
+ META_SET_STRING("SmokeMissile", mtype->SmokeName);
+
+ META_SET_STRING("FiredSound", mtype->FiredSound.Name);
+ META_SET_STRING("ImpactSound", mtype->ImpactSound.Name);
+
+ if (!strcmp(key, "Class")) {
+ const char* value;
+ int i;
+
+ value = LuaToString(l, -1);
+ for (i = 0; MissileClassNames[i]; ++i) {
+ if (!strcmp(value, MissileClassNames[i])) {
+ mtype->Class = i;
+ return 0;
+ }
+ }
+ LuaError(l, "Unsupported missile class: %s" _C_ value);
+ }
+
+ LuaError(l, "Field \"%s\" is innexistent or read-only.\n" _C_ key);
}
/**
@@ -517,7 +586,7 @@
**
** @param l The lua state.
*/
-global void ScriptMissileInit(void)
+global void ScriptMissileTypesInit(void)
{
// Create Stratagus.Missiles namespace.
// No userdata, there's no data. And no finalizer
Index: stratagus/src/stratagus/script.c
diff -u stratagus/src/stratagus/script.c:1.159
stratagus/src/stratagus/script.c:1.160
--- stratagus/src/stratagus/script.c:1.159 Mon Jan 19 06:41:00 2004
+++ stratagus/src/stratagus/script.c Tue Jan 20 00:03:46 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: script.c,v 1.159 2004/01/18 19:41:00 nobody_ Exp $
+// $Id: script.c,v 1.160 2004/01/19 13:03:46 nobody_ Exp $
//@{
@@ -1166,6 +1166,7 @@
/* Add all our namesspaces and stuff.*/
ScriptSpellInit();
+ ScriptMissileTypesInit();
lua_settable(Lua, LUA_GLOBALSINDEX);
}
@@ -1329,7 +1330,7 @@
}
fprintf(fd, "--- -----------------------------------------\n");
- fprintf(fd, "--- $Id: script.c,v 1.159 2004/01/18 19:41:00 nobody_ Exp
$\n");
+ fprintf(fd, "--- $Id: script.c,v 1.160 2004/01/19 13:03:46 nobody_ Exp
$\n");
fprintf(fd, "SetVideoResolution(%d, %d)\n", VideoWidth, VideoHeight);
fprintf(fd, "SetGroupKeys(\"");
@@ -1365,7 +1366,7 @@
}
fprintf(fd, "--- -----------------------------------------\n");
- fprintf(fd, "--- $Id: script.c,v 1.159 2004/01/18 19:41:00 nobody_ Exp
$\n");
+ fprintf(fd, "--- $Id: script.c,v 1.160 2004/01/19 13:03:46 nobody_ Exp
$\n");
// Global options
if (OriginalFogOfWar) {
@@ -1468,7 +1469,7 @@
extern SCM oblistvar;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: CCL $Id: script.c,v 1.159 2004/01/18
19:41:00 nobody_ Exp $\n\n");
+ CLprintf(file, ";;; MODULE: CCL $Id: script.c,v 1.160 2004/01/19
13:03:46 nobody_ Exp $\n\n");
for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
SCM sym;
Index: stratagus/src/video/graphic.c
diff -u stratagus/src/video/graphic.c:1.66 stratagus/src/video/graphic.c:1.67
--- stratagus/src/video/graphic.c:1.66 Sat Jan 17 05:17:28 2004
+++ stratagus/src/video/graphic.c Tue Jan 20 00:03:46 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: graphic.c,v 1.66 2004/01/16 18:17:28 nobody_ Exp $
+// $Id: graphic.c,v 1.67 2004/01/19 13:03:46 nobody_ Exp $
//@{
@@ -267,6 +267,9 @@
*/
global void FlipGraphic(Graphic* graphic)
{
+#ifdef USE_OPENGL
+ return;
+#else
int i;
int j;
SDL_Surface* s;
@@ -287,6 +290,7 @@
}
}
SDL_UnlockSurface(s);
+#endif
}
/**
@@ -374,8 +378,7 @@
}
}
SDL_UnlockSurface(graphic->Surface);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA,
GL_UNSIGNED_BYTE, tex);
#ifdef DEBUG
i = glGetError();
if (i) {
@@ -464,8 +467,7 @@
}
}
SDL_UnlockSurface(graphic->Surface);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA,
GL_UNSIGNED_BYTE, tex);
#ifdef DEBUG
i = glGetError();
if (i) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src include/missile.h include/stratag...,
address@hidden <=