Hi,

I have done quite a lot of modifications in the CL07 branch. Here is an explanation.

First of all, I have rewritten keyboard.cpp and mouse.cpp, so these objects don't have to know which is the weapon used at any time. In the last "commit", I have reintroduce key bindings for choosing weapons (this function was removed previously). The key-bindings are set in weapons_list.cpp. In the same idea, the "team" class (team.cpp) doesn't know anymore which weapon is selected.

Secondly, I have write some default methods (Dessine, Active, Desactive, IsLoading,...) in the file weapon.cpp. To write this method, I have add, of course, some variables. Now, there is only one strength(progress) bar for every weapons, which is used only if max_strength != 0. There are also variables to specify the min and the max angle possible for the weapon, and the default methods take care of this :-) So the code of bazooka, grenade, and auto_bazooka is simplier.

Hum, well, the most doubtful decision is about weapon position and rotation. Now, the center of the image must be the rotation point of the weapon. So the weapon will rotate about this point, and this is easy to place weapon in the good place, near the hand. I know this technics make big image, but it's easier than to had variables to say where is the rotation point on the image and to calculate to re-position the weapon to the good place after a rotation...

All the modification haven't been done. In fact, there are special weapons... For example, in the original game Worms, you can play 2 times with the shotgun in the same turn, or you can use a ninja cord and then use a another weapon. That's why I add "bool can_change_weapon" and "uint nb_replay" in the weapon class. This is still not used but it should be implemented fast ! The problem is I don't know where to manage the "State" of the game_loop, would I manage it in keyboard.cpp, or will it be better to manage it in weapon.cpp ?

Matt






Répondre à