diff --git a/code/parse/lua.cpp b/code/parse/lua.cpp index cec9207467..3839fa8ef3 100644 --- a/code/parse/lua.cpp +++ b/code/parse/lua.cpp @@ -1131,7 +1131,7 @@ ADE_VIRTVAR(Filename, l_Font, "string", "Filename of font (including extension)" { int font = -1; char *newname = NULL; - if(!ade_get_args(L, "o|s", &font, &newname)) + if(!ade_get_args(L, "o|s", l_Font.Get(&font), &newname)) return ADE_RETURN_NIL; if(font < 0 || font >= Num_fonts) @@ -1144,11 +1144,11 @@ ADE_VIRTVAR(Filename, l_Font, "string", "Filename of font (including extension)" return ade_set_args(L, "s", Fonts[font].filename); } -ADE_VIRTVAR(Height, l_Font, "string", "Filename of font (including extension)") +ADE_VIRTVAR(Height, l_Font, "number", "Height of font (in pixels)") { int font = -1; int newheight = -1; - if(!ade_get_args(L, "o|i", &font, &newheight)) + if(!ade_get_args(L, "o|i", l_Font.Get(&font), &newheight)) return ADE_RETURN_NIL; if(font < 0 || font >= Num_fonts) @@ -1158,13 +1158,13 @@ ADE_VIRTVAR(Height, l_Font, "string", "Filename of font (including extension)") Fonts[font].h = newheight; } - return ade_set_args(L, "s", Fonts[font].h); + return ade_set_args(L, "i", Fonts[font].h); } ADE_FUNC(isValid, l_Font, NULL, "True if valid, false or nil if not", "Detects whether handle is valid") { int font; - if(!ade_get_args(L, "o", &font)) + if(!ade_get_args(L, "o", l_Font.Get(&font))) return ADE_RETURN_NIL; if(font < 0 || font >= Num_fonts) @@ -2486,78 +2486,6 @@ ADE_INDEXER(l_Directives, "Directive number", "directive handle", NULL) //**********HANDLE: Weaponclass //ade_obj l_Weaponclass("weaponclass", "Weapon class handle"); -ADE_VIRTVAR(DesiredVelocity, l_Object, "Local vector", "Object local desired velocity") -{ - object_h *objh; - vec3d *v3=NULL; - if(!ade_get_args(L, "o|o", l_Object.GetPtr(&objh), l_Vector.GetPtr(&v3))) - return ADE_RETURN_NIL; - - if(!objh->IsValid()) - return ADE_RETURN_NIL; - - if(ADE_SETTING_VAR && v3 != NULL) { - objh->objp->phys_info.desired_vel = *v3; - } - - return ade_set_args(L, "o", l_Vector.Set(objh->objp->phys_info.desired_vel)); -} - - -ADE_VIRTVAR(RotationalVelocity, l_Object, "Local vector", "Object local rotational velocity") -{ - object_h *objh; - vec3d *v3=NULL; - if(!ade_get_args(L, "o|o", l_Object.GetPtr(&objh), l_Vector.GetPtr(&v3))) - return ADE_RETURN_NIL; - - if(!objh->IsValid()) - return ADE_RETURN_NIL; - - if(ADE_SETTING_VAR && v3 != NULL) { - objh->objp->phys_info.rotvel = *v3; - } - - return ade_set_args(L, "o", l_Vector.Set(objh->objp->phys_info.rotvel)); -} - -ADE_VIRTVAR(DesiredRotationalVelocity, l_Object, "Local vector", "Object local desired rotational velocity") -{ - object_h *objh; - vec3d *v3=NULL; - if(!ade_get_args(L, "o|o", l_Object.GetPtr(&objh), l_Vector.GetPtr(&v3))) - return ADE_RETURN_NIL; - - if(!objh->IsValid()) - return ADE_RETURN_NIL; - - if(ADE_SETTING_VAR && v3 != NULL) { - objh->objp->phys_info.desired_rotvel = *v3; - } - - return ade_set_args(L, "o", l_Vector.Set(objh->objp->phys_info.desired_rotvel)); -} - -ADE_VIRTVAR(RotDamp, l_Object, "Number", "rotational damp") -{ - object_h *objh = NULL; - float f = 0.0f; - if(!ade_get_args(L, "o|f", l_Object.GetPtr(&objh), &f)) - return ADE_RETURN_NIL; - - if(!objh->IsValid()) - return ADE_RETURN_NIL; - - //Set hull strength. - if(ADE_SETTING_VAR && f >= 0.0f) { - objh->objp->phys_info.rotdamp = f; - } - - return ade_set_args(L, "f", objh->objp->phys_info.rotdamp); -} - - - ADE_VIRTVAR(Name, l_Weaponclass, "string", "Weapon class name") { @@ -3022,6 +2950,79 @@ ADE_FUNC(getBreedName, l_Object, NULL, "Object type name", "Gets object type") return ade_set_args(L, "s", Object_type_names[objh->objp->type]); } +//WMC - These are already defined in the object Physics handle. +/* +ADE_VIRTVAR(DesiredVelocity, l_Object, "Local vector", "Object local desired velocity") +{ + object_h *objh; + vec3d *v3=NULL; + if(!ade_get_args(L, "o|o", l_Object.GetPtr(&objh), l_Vector.GetPtr(&v3))) + return ADE_RETURN_NIL; + + if(!objh->IsValid()) + return ADE_RETURN_NIL; + + if(ADE_SETTING_VAR && v3 != NULL) { + objh->objp->phys_info.desired_vel = *v3; + } + + return ade_set_args(L, "o", l_Vector.Set(objh->objp->phys_info.desired_vel)); +} + + +ADE_VIRTVAR(RotationalVelocity, l_Object, "Local vector", "Object local rotational velocity") +{ + object_h *objh; + vec3d *v3=NULL; + if(!ade_get_args(L, "o|o", l_Object.GetPtr(&objh), l_Vector.GetPtr(&v3))) + return ADE_RETURN_NIL; + + if(!objh->IsValid()) + return ADE_RETURN_NIL; + + if(ADE_SETTING_VAR && v3 != NULL) { + objh->objp->phys_info.rotvel = *v3; + } + + return ade_set_args(L, "o", l_Vector.Set(objh->objp->phys_info.rotvel)); +} + +ADE_VIRTVAR(DesiredRotationalVelocity, l_Object, "Local vector", "Object local desired rotational velocity") +{ + object_h *objh; + vec3d *v3=NULL; + if(!ade_get_args(L, "o|o", l_Object.GetPtr(&objh), l_Vector.GetPtr(&v3))) + return ADE_RETURN_NIL; + + if(!objh->IsValid()) + return ADE_RETURN_NIL; + + if(ADE_SETTING_VAR && v3 != NULL) { + objh->objp->phys_info.desired_rotvel = *v3; + } + + return ade_set_args(L, "o", l_Vector.Set(objh->objp->phys_info.desired_rotvel)); +} + +ADE_VIRTVAR(RotDamp, l_Object, "Number", "rotational damp") +{ + object_h *objh = NULL; + float f = 0.0f; + if(!ade_get_args(L, "o|f", l_Object.GetPtr(&objh), &f)) + return ADE_RETURN_NIL; + + if(!objh->IsValid()) + return ADE_RETURN_NIL; + + //Set hull strength. + if(ADE_SETTING_VAR && f >= 0.0f) { + objh->objp->phys_info.rotdamp = f; + } + + return ade_set_args(L, "f", objh->objp->phys_info.rotdamp); +} +*/ + //ade_obj l_Subsystem("subsystem", "Ship subsystem handle"); //**********HANDLE: Asteroid ade_obj l_Asteroid("asteroid", "Asteroid handle", &l_Object); diff --git a/code/weapon/weapons.cpp b/code/weapon/weapons.cpp index 1b15fadd8f..e1801bfaa3 100644 --- a/code/weapon/weapons.cpp +++ b/code/weapon/weapons.cpp @@ -12,6 +12,11 @@ * * * $Log: not supported by cvs2svn $ + * Revision 2.191 2007/01/14 14:03:40 bobboau + * ok, something aparently went wrong, last time, so I'm commiting again + * hopefully it should work this time + * damnit WORK!!! + * * Revision 2.190 2007/01/12 04:33:49 Goober5000 * hmm... I guess when I fixed this back in 2004, I fixed it the wrong way :D * @@ -1717,7 +1722,7 @@ void init_weapon_entry(int weap_info_index) { Assert(weap_info_index > -1 && weap_info_index < MAX_WEAPON_TYPES); weapon_info *wip = &Weapon_info[weap_info_index]; - int i, j; + int i; wip->wi_flags = WIF_DEFAULT_VALUE; wip->wi_flags2 = WIF2_DEFAULT_VALUE; @@ -3020,7 +3025,7 @@ int parse_weapon(int subtype, bool replace) if(optional_string("+Index:")) { stuff_int(&bsw_index_override); - if(bsw_index_override < 0 || bsw_index_override >= wip->b_info.sections.size()) + if(bsw_index_override < 0 || bsw_index_override >= (int)wip->b_info.sections.size()) { Warning(LOCATION, "Invalid +Index value of %d specified for beam section on weapon '%s'; valid values at this point are %d to %d.", bsw_index_override, wip->name, 0, wip->b_info.sections.size() -1); } @@ -3032,7 +3037,7 @@ int parse_weapon(int subtype, bool replace) //Where are we saving data? if(bsw_index_override >= 0) { - if(bsw_index_override < wip->b_info.sections.size()) + if(bsw_index_override < (int)wip->b_info.sections.size()) { ip = &wip->b_info.sections[bsw_index_override]; } @@ -3050,7 +3055,7 @@ int parse_weapon(int subtype, bool replace) { //here we can just make a new one wip->b_info.sections.resize(wip->b_info.sections.size()+1); - ip = wip->b_info.sections.end()-1; + ip = &wip->b_info.sections[wip->b_info.sections.size()-1]; } } @@ -3058,7 +3063,7 @@ int parse_weapon(int subtype, bool replace) else { wip->b_info.sections.resize(wip->b_info.sections.size()+1); - ip = wip->b_info.sections.end()-1; + ip = &wip->b_info.sections[wip->b_info.sections.size()-1]; } char tex_name[MAX_FILENAME_LEN]; @@ -6172,7 +6177,8 @@ void weapon_mark_as_used(int weapon_type) void weapons_page_in() { - int i, j, idx; + int i, j; + uint idx; Assert( used_weapons != NULL );